DirectX8.1 SDK : Vertex: D3DFVF_XYZ - Flag

Started by
13 comments, last by Ozzuary 22 years, 3 months ago
Turn lighting off

dankydoo
Advertisement
nope already thought of lights.... on or off no diffrence =)
The Great Milenko"Don't stick a pretzel up your ass, it might get stuck in there.""Computer Programming is findding the right wrench to hammer in the correct screw."
Some things to check:

- The debug output from the debug version of the SDK to see if D3D is unhappy about anything. (The DirectX control panel applet).


- D3DRS_CULLMODE is set appropriately for your data.


- If you aren''t using a Z buffer, make sure D3DRS_ZENABLE to D3DZB_FALSE.


- If you are using a Z buffer, make sure:
a) the distance between your near and far clip planes isn''t too large.

b) the bitdepth of the z buffer is the same as the bitdepth of the frame buffer (a restriction on nVidia hardware).

c) your Clear() call has the D3DCLEAR_ZBUFFER flag set.


- The vertex (and index) buffers are being unlocked after being filled.


- Your TextureStageStates are handling the vertex colours correctly. For the vertex format you mention, you want stage 0 colour to do SELECTARG1 where ARG1 is DIFFUSE. For stage 0 alpha you want to do DISABLE, for stage 1 colour you want DISABLE.


- There is only one set of BeginScene()/EndScene() per frame.


- That you call SetVertexShader() with your vertex format.



A good thing to do to aid debugging of "I can''t see anything" problems is to set the colour you have in Clear() to something other than black so that if your triangles are being rendered, but in black you can see it.


--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

ok checked everything.... no diffrence.... although thats good to know about nvidia.... yea I know about using non black on the target clear... bright red =) no triangles =)
The Great Milenko"Don't stick a pretzel up your ass, it might get stuck in there.""Computer Programming is findding the right wrench to hammer in the correct screw."
Thanks for the help all!

I fixed it.


Those of you who suggested culling and lighting were right..
I didnt give some detailed code analysis- harder to correct code errors when you cant see all the code

Here was the fix:

Added to InitD3D:

// Turn off culling so we see front and 'back' of triangle
lpD3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);

// Turn off lighting
lpD3DDevice->SetRenderState(D3DRS_LIGHTING, FALSE);


Note:
If you do NOT turn lighting off, you cant see anything.
If you do not turn off culling you see only 1 side of the triangle.



Edited by - Ozzuary on December 30, 2001 11:39:28 PM

This topic is closed to new replies.

Advertisement