|
|
Direct3d Setrenderstate(d3drs_zenable,true) Has No Effect ? - Depth Testing is not working | ||
Discussion by qwijibow with 4 Replies.
Last Update: July 24, 2008, 6:28 am | |||
![]() |
|
|
And i've noticed that Depth testing is not working on my first few programs, Nor is it working on the book's cd's demo applications ( even pre-compiled)
In other words, some objects are beeing drawn over the top of objects closer to the camera.
Very early in the book, ( Chapter 1 ) the book descibes this problem, and how to resolve it by enableing Depth testing using the Depth Buffer.
the solution it says is a single line of code
CODE
g_D3DDevice->SetRenderState(D3DRS_ZENABLE, TRUE);
However, this seems to have no effect.. Distant objects are still beeing drawn over the top of some closer ones.
Any Idea's as to what is going on ?
I am using DirectX Runtime 9.0c
SDK 9.0c
Graphics Card is NVidia GeForce FX 5700 LE ( latest drivers )
The PRE-compiled programs on the CD were compiled with Visual Studio 2005.
I Was using GCC-3.4 (cygwin) compiler, but in an act of desperation, also attempted compiling with Microsoft Visual C++ Toolkit 2003.
which resulted with the same rendering issue !!!
HOWEVER... DirectX games all work fine.
Im hoping this must be due to a programming error..i have noticed one or two in the book... but i cant fint it, and MSDN states that that the single line of code above is the ONLY requirement for correct 3d depth rendering.
oes anyone have any ideas ???
unfortunatly, i am not able to past the demo application here, as i am not the author, and it is probably under some kind of copyright.
Also, make sure you're using the debug version of directx runtime, so you can see the "extra" messages from directx regarding error or warning that you should take note.
If you are not using the debug function in the IDE, of can't get debug message from the IDE, then get DebugView from Sysinternal (http://www.microsoft.com/technet/sysinternals/utilities/debugview.mspx), it will do the job. It helped me a lot, cause i'm using managed directx, and that won't show the debug messages in the IDE.
QUOTE (qwijibow)
Hi, i've recently started working my way through a book on Using DirectX 9.0c SDK.
And i've noticed that Depth testing is not working on my first few programs, Nor is it working on the book's cd's demo applications ( even pre-compiled)
In other words, some objects are beeing drawn over the top of objects closer to the camera.
Very early in the book, ( Chapter 1 ) the book descibes this problem, and how to resolve it by enableing Depth testing using the Depth Buffer.
the solution it says is a single line of code
CODE
g_D3DDevice->SetRenderState(D3DRS_ZENABLE, TRUE);
However, this seems to have no effect.. Distant objects are still beeing drawn over the top of some closer ones.
Any Idea's as to what is going on ?
I am using DirectX Runtime 9.0c
SDK 9.0c
Graphics Card is NVidia GeForce FX 5700 LE ( latest drivers )
The PRE-compiled programs on the CD were compiled with Visual Studio 2005.
I Was using GCC-3.4 (cygwin) compiler, but in an act of desperation, also attempted compiling with Microsoft Visual C++ Toolkit 2003.
which resulted with the same rendering issue !!!
HOWEVER... DirectX games all work fine.
Im hoping this must be due to a programming error..i have noticed one or two in the book... but i cant fint it, and MSDN states that that the single line of code above is the ONLY requirement for correct 3d depth rendering.
oes anyone have any ideas ???
unfortunatly, i am not able to past the demo application here, as i am not the author, and it is probably under some kind of copyright.
Link: view Post: 88765
Direct3d Setrenderstate(d3drs_zenable,true) Has No Effect ?
No but I believe I'm making progress
Zenable
ZWRITEENABLE
D3ddev->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESSEQUAL);
D3ddev->Clear(0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
But I to still have nothing
-reply by matthew
You also need to set some parameters in your D3DPRESENT_PARAMETERS struct
D3dpp.EnableAutoDepthStencil = TRUE;
D3dpp.AutoDepthStencilFormat = D3DFMT_D16;
And to clear make you are doing something like this
Clear(0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
-reply by saus
You also need to set some parameters in your D3DPRESENT_PARAMETERS struct
D3dpp.EnableAutoDepthStencil = TRUE;
D3dpp.AutoDepthStencilFormat = D3DFMT_D16;
And to clear make you are doing something like this
Clear(0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
-reply by saus
Similar Topics:
True Image Help
Testing
[cd] True Live - The Shape Of It
Gba Game Program (6)
|
(1) Intro introduction and question
|
HOME 






