Loading...


bookmark - Direct3d Setrenderstate(d3drs_zenable,true) Has No Effect ? Depth Testing is not working

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
 
bookmark - Direct3d Setrenderstate(d3drs_zenable,true) Has No Effect ? Depth Testing is not working  
Quickly Post to Direct3d Setrenderstate(d3drs_zenable,true) Has No Effect ? Depth Testing is not working w/o signup Share Info about Direct3d Setrenderstate(d3drs_zenable,true) Has No Effect ? Depth Testing is not working using Facebook, Twitter etc. email your friend about Direct3d Setrenderstate(d3drs_zenable,true) Has No Effect ? Depth Testing is not working Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

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.

   Sun Oct 8, 2006    Reply         

You can refer to this site for more info on Z-Buffer http://www.toymaker.info/Games/html/z_buffer.html

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

   Tue Nov 14, 2006    Reply         

z-buffer
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

   Wed Jun 25, 2008    Reply         


Replying to faulty.Lee

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

   Thu Jul 24, 2008    Reply         

Replying to faulty.Lee

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

   Thu Jul 24, 2008    Reply         

Quickly Post to Direct3d Setrenderstate(d3drs_zenable,true) Has No Effect ? Depth Testing is not working w/o signup Share Info about Direct3d Setrenderstate(d3drs_zenable,true) Has No Effect ? Depth Testing is not working using Facebook, Twitter etc. email your friend about Direct3d Setrenderstate(d3drs_zenable,true) Has No Effect ? Depth Testing is not working Print
Reply / Comment New Discussion / Topic Share / Bookmark E-Mail a Friend Print

Similar Topics:

True Image Help

I made a backup of some files a year ago with True Image, and I want to restore some of them. I used Windows backup Utility, and it can explore .tib files, but it cant restore. I used True Image, but it doesn't show all the files in the backup. In fact, more than half the files are hidden/mis ...more

   06-Jul-2005    Reply         

Testing

testing, i wish to edit back later... wher eis the edit butotn? ...more

   05-Nov-2005    Reply         

[cd] True Live - The Shape Of It

True Live - The Shape of It Since True Live’s beginning they have been entrancing audiences all over Melbourne and even Sydney. With an EP and a single under their belt True Li ...more

   05-Dec-2006    Reply         

Gba Game Program    Gba Game Program (6) (1) Intro introduction and question  Intro introduction and question