Problem with D3D8...

Started by
3 comments, last by BeRSeRKeR[DGT] 23 years, 4 months ago
Hi all! I have 2 questions for you about D3D8: 1st) I have drawn a cube (with DrawIndexedPrimitive...24 vertices and 36 indices) that is shown perfectly (culling mode CCW so backfaces aren''t drawn) but when I draw another cube behind the first, the last cube is shown in front of the first one!!...I have enabled the ZBuffer and I clear the screen with D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER but the problem persist...what must I do to show the second cube hide for the first one?... 2nd) I want make a smoke effect like q3a when you fire the rocket launcher. I thought that the view look vector would be the direction that represent the smoke quad direction so if I add some value to this vector I get the quad at some distance in the view direction but it isn''t work...do you know how to make this?... Ok that''s all for now.....THANK YOU!!
Advertisement
I just started learning about the Z-Buffer, so I don''t know if this will be of any help. I would try using SetRenderState(D3DRS_ZFUNC, value) The value would probablly depend on what corrd system your using. Either D3DCMP_LESS or D3DCMP_GREATER should do it. Hope this helps!

"I kinda think, therefore, I kinda... am?"
You only need 8 vertices in that indexed cube. Think about it. That is what struck me at first. And also the two cubes can use the same index buffer. Set the Z function and set the value for it to be compared with as well. Have a look at the samples and see how they do Z-Buffering. That''s what they''re there for.


Please state the nature of the debugging emergency.


sharewaregames.20m.com

Ok...my first cube was created with 8 vertices, but I didn''t know how to texture this cube with only 8 vertices...because I tried with some combinations but the texture was applied to the face incorrectly because 2 faces had the following texture coordinates:

(0.0f, 0.0f)
(1.0f, 0.0f)
(0.0f, 0.0f)
(1.0f, 1.0f)

or something similar...

Can you tell me how must I define the texture coordinates and the indices to apply the texture correctly on a 8 vertices cube??

Thankx
Ok...my first cube was created with 8 vertices, but I didn''t know how to texture this cube with only 8 vertices...because I tried with some combinations but the texture was applied to the face incorrectly because 2 faces had the following texture coordinates:

(0.0f, 0.0f)
(1.0f, 0.0f)
(0.0f, 0.0f)
(1.0f, 1.0f)

or something similar...

Can you tell me how must I define the texture coordinates and the indices to apply the texture correctly on a 8 vertices cube??

Thankx

This topic is closed to new replies.

Advertisement