Flickering triangle

Started by
4 comments, last by AzraelilMeraz 15 years, 6 months ago
Hello GameDev What is this? Thank you in advance
Advertisement
Looks like a far clip issue. What are you setting near and far clip planes to, and z-buffer accuracy?
Also, what sort of geometry is your background constructed from? The above presumes there's some sort of skybox/dome.
It could be that you specify a small vertex scope when you draw your triangles.

I don't know OpenGl, but in D3D the problem could be in

DrawIndexedPrimitive(
D3DPRIMITIVETYPE Type,
INT BaseVertexIndex,
UINT MinIndex,
->UINT NumVertices,
UINT StartIndex,
UINT PrimitiveCount
)

Have your tried switching between debug/release on your application?
Peter
gluPerspective(                            60,                            // Field of view = 60 degrees        static_cast<double>(WinXSize)/        static_cast<double>(WinYSize),      // Window aspect (assumes square pixels)        0,                             // Near Z clipping plane        1000                         // Far Z clippling plane    );


and
glClearDepth(1.0);glEnable(GL_DEPTH_TEST);glDepthFunc(GL_LEQUAL);


Did I forget something?

There's no difference between Debug/Release
This doesn't happen with the Direct3D implementation of my Engine

Edit: Hm - Just checked my Mesh exporting plugin - it didn't export normals properly. Though I don't see any connnection to a flickering triangle...

[Edited by - AzraelilMeraz on October 10, 2008 3:37:12 PM]
Eek! That near clip essentially asks your z-buffer to be accurate over an infinite amount of possibilities (up to 1km at least).
For best results use a near clip of 1.0, and if you want to get the camera right up close then 0.1 is fair (together with your 1000.0 far clip).

edit: so correcting your exported normals have solved this? I guess you are culling back faces and the normal was pointing sideways to the camera (making front face visibility borderline).
Yep, I also set the near clipping plane to 1.0 because of another mesh which didn't render properly. Thank you for your help and for explaining why 1.0 for near plane is better. :)

This topic is closed to new replies.

Advertisement