From c7256fc872830a71c24ab4daf30e9840e63a2417 Mon Sep 17 00:00:00 2001 From: aignacio_sf <> Date: Fri, 18 Apr 2008 19:17:08 +0000 Subject: [PATCH] Remove hard coded 0 for render target index. Remove (comment out) color_tex->set_format(Texture::F_rgba); So that the texture format can be selected. --- panda/src/dxgsg9/wdxGraphicsBuffer9.cxx | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/panda/src/dxgsg9/wdxGraphicsBuffer9.cxx b/panda/src/dxgsg9/wdxGraphicsBuffer9.cxx index 6bdfad57de..7d8ab1a865 100644 --- a/panda/src/dxgsg9/wdxGraphicsBuffer9.cxx +++ b/panda/src/dxgsg9/wdxGraphicsBuffer9.cxx @@ -181,8 +181,11 @@ end_frame(FrameMode mode, Thread *current_thread) { bool wdxGraphicsBuffer9:: save_bitplanes() { HRESULT hr; + DWORD render_target_index; + + render_target_index = 0; - hr = _dxgsg -> _d3d_device -> GetRenderTarget (0, &_saved_color_buffer); + hr = _dxgsg -> _d3d_device -> GetRenderTarget (render_target_index, &_saved_color_buffer); if (!SUCCEEDED (hr)) { dxgsg9_cat.error ( ) << "GetRenderTarget " << D3DERRORSTRING(hr) FL; return false; @@ -207,9 +210,12 @@ restore_bitplanes() { DCAST_INTO_V(dxgsg, _gsg); HRESULT hr; + DWORD render_target_index; + + render_target_index = 0; hr = dxgsg -> _d3d_device -> - SetRenderTarget (0, _saved_color_buffer); + SetRenderTarget (render_target_index, _saved_color_buffer); if (!SUCCEEDED (hr)) { dxgsg9_cat.error ( ) << "SetRenderTarget " << D3DERRORSTRING(hr) FL; } @@ -244,7 +250,10 @@ rebuild_bitplanes() { IDirect3DCubeTexture9 *depth_cube = 0; IDirect3DSurface9 *color_surf = 0; IDirect3DSurface9 *depth_surf = 0; - + DWORD render_target_index; + + render_target_index = 0; + // Decide how big the bitplanes should be. if ((_host != 0)&&(_creation_flags & GraphicsPipe::BF_size_track_host)) { @@ -305,7 +314,7 @@ rebuild_bitplanes() { } color_tex = get_texture(color_tex_index); color_tex->set_size_padded(_x_size, _y_size); - color_tex->set_format(Texture::F_rgba); +// color_tex->set_format(Texture::F_rgba); color_ctx = DCAST(DXTextureContext9, color_tex->prepare_now(_gsg->get_prepared_objects(), _gsg)); @@ -404,9 +413,8 @@ rebuild_bitplanes() { _backing_sizey = bitplane_y; // Load up the bitplanes. - if (color_surf) { - hr = _dxgsg -> _d3d_device -> SetRenderTarget (0, color_surf); + hr = _dxgsg -> _d3d_device -> SetRenderTarget (render_target_index, color_surf); if (!SUCCEEDED (hr)) { dxgsg9_cat.error ( ) << "SetRenderTarget " << D3DERRORSTRING(hr) FL; }