DevMaster.net Forums
[[ Home | Forums | 3D Engines Database | Wiki | Articles/Tutorials | Game Dev Jobs | IRC Chat Network | Contact Us ]]

Go Back   DevMaster.net Forums > Programming & Development > Graphics Theory & Programming
User Name
Password
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
Old 09-25-2007, 11:44 AM   #1
Akinak
Member
 
Akinak's Avatar
 
Join Date: Aug 2007
Location: tehran
Posts: 52
Thumbs down directX , Clear buffer problem

hi

i want to use stencil buffer to render a mirror effect.

Code:
1 - render mirror surface 2 - render mirror just in stencil 3 - render reflection of object using stencil 4 - render objects

but when i try to clear buffers
Code:
device->Clear(0 , 0 , D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL, 0x000000 , 1.0f , 0); device->BeginScene();

it seems that TARGET isnt cleard when is add "D3DCLEAR_STENCIL" !!
even if id dont set : Stencil buffer active, by clearing it , TARGET wont clear !
i'm really confeused !! (
please HELP ME !!
Akinak is offline   Reply With Quote
Old 09-29-2007, 01:54 PM   #2
yakul
Member
 
Join Date: Sep 2004
Posts: 55
Default Re: directX , Clear buffer problem

I think you need to put the clear after the begin scene.
yakul is offline   Reply With Quote
Old 10-01-2007, 02:39 PM   #3
Akinak
Member
 
Akinak's Avatar
 
Join Date: Aug 2007
Location: tehran
Posts: 52
Default Re: directX , Clear buffer problem

yakul
it wont solve the problem
Akinak is offline   Reply With Quote
Old 10-01-2007, 02:45 PM   #4
roel
Senior Member
 
roel's Avatar
 
Join Date: Sep 2005
Location: .nl
Posts: 573
Default Re: directX , Clear buffer problem

I googled for the documentation about D3DCLEAR_STENCIL, and the first hit was a very similar problem: http://www.gamedev.net/community/for...opic_id=199232

But that thread isn't very helpful. The documentation tells me this

Quote:
This method fails if you specify the D3DCLEAR_ZBUFFER or D3DCLEAR_STENCIL flags when the render target does not have an attached depth buffer. Similarly, if you specify the D3DCLEAR_STENCIL flag when the depth-buffer format does not contain stencil buffer information, this method fails.

Is that correct? You can/could/should try this too: turn the direct3d debug version on in the control panel, and watch your debug output (with dbmon.exe for example)
roel is offline   Reply With Quote
Old 10-02-2007, 10:38 AM   #5
Akinak
Member
 
Akinak's Avatar
 
Join Date: Aug 2007
Location: tehran
Posts: 52
Default Re: directX , Clear buffer problem

i think problem comes frome: D3DPRESENT_PARAMETER !
Stencil format is : D3DFMT_D24FS8, but if it failes
format is changed to : D3DFMT_D16,
does "D3DFMT_D16" mean not to use stencil ?
i use this type of code in another project too. its works fine, but in this one..!
Akinak is offline   Reply With Quote
Old 10-02-2007, 01:38 PM   #6
Akinak
Member
 
Akinak's Avatar
 
Join Date: Aug 2007
Location: tehran
Posts: 52
Default Re: directX , Clear buffer problem

and on more thing : i have installed DirectX SDK but there is no directx icon in my control panel...!
Akinak is offline   Reply With Quote
Old 10-02-2007, 01:45 PM   #7
.oisyn
DevMaster Staff
 
.oisyn's Avatar
 
Join Date: Sep 2005
Location: The Netherlands
Posts: 1,573
Default Re: directX , Clear buffer problem

Quote:
Originally Posted by Akinak
i think problem comes frome: D3DPRESENT_PARAMETER !
Stencil format is : D3DFMT_D24FS8, but if it failes
format is changed to : D3DFMT_D16,
does "D3DFMT_D16" mean not to use stencil ?
Quite so. It means "only use a 16 bit depth format". You should try to fallback to D3DFMT_D24S8, most videocards support that mode (as opposed to the 24 bit floating point z-buffer that D3DFMT_D24FS8 is).
___________________________________________
C++ addict
-
Currently working on: the 3D engine for Deus Ex 3.
.oisyn is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Forum Jump


All times are GMT -7. The time now is 07:39 PM.


Powered by vBulletin
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.