Skip to main content
gamedev.net
🔒 Locked

Rendertarget problem

Started by Keba 1 reply 3.1k views
Original Post
Keba
Keba
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
luskan
luskan
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.

Keba
Keba
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.