• Advertisement

Archived

This topic is now archived and is closed to further replies.

Rendertarget problem

This topic is 5034 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

got following problem,when i clear a rendertarget with code line: m_pD3DDevice->Clear(0L,NULL,D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,0), 1.0f, 0L ); i got the following error in the output: Direct3D9: (ERROR) :DepthStencil Buffer must be at least as big as the RenderTarget. The Rendertarget texture is created with the following code line: D3DXCreateTexture(_device, iSideSize, iSideSize, 1,D3DUSAGE_RENDERTARGET,D3DFMT_R8G8B8, D3DPOOL_DEFAULT,&m_pRenderTexture); where _device is a legal device and iSideSize is the size of the Texture. m_pRenderTexture is a IDirect3DTexture9*. when i use sizes like 16,128,256, its ok, but when using sizes like 512 and 1024 i got the error. The gfx card is quite old (RIVA TNT2 ULTRA, or something like that) but i checked the caps and the minimum texture size is 2048.i had also testet this application on a system with a GF4 MX, but didn''t get this error, atleast i didn''t notice it. so my question is what is the problem? i guess it has something to do with the depthStencil, i didn''t attaced any type of depthstencil buffer to the texture, but i''m clearing the Z-buffer. if this is the problem I want to know how to attach the depthstencil buffer. this is a second rendertarget i had created, i already got a primary one,with working z-buffer. / thanks

Share this post


Link to post
Share on other sites
Advertisement
If you have not attached any depth stencil surface to your rendertarget surface then the previously attached depthstencil is being used. If you render anything with z-buffer and it works then you probably have one depthstencil set - it might be automatically created at device creation and is the size of your window. You can create your own depthstencil surface with device method CreateDepthStencilSurface - the size must be at least as big as your rendertarget size. Also check if RT surface depth match with depthstencil depth (direct3d9::CheckDepthStencilMatch()). Later after seting your new rendertarget use SetDepthStencilSurface() - this should solve problem.

I have a question - have any one succeeded at using z-buffer with floating point render targets on ATI 9800PRO? - it seams that it is ignoring z value.

Share this post


Link to post
Share on other sites
Thanks, I realised that the problem was that my application was window based, and the depthbuffer then became smaller than the new rendertarget, and that was the problem.

i can''t though answer your question , sorry

Share this post


Link to post
Share on other sites

  • Advertisement