Page 1 of 1

ZBuffer issues between ClassEDisplay->Render() and OpenGL

PostPosted: Jan 13, 2009 @ 2:44am
by Planet9Dave

PostPosted: Jan 13, 2009 @ 2:11pm
by edge

PostPosted: Jan 13, 2009 @ 9:29pm
by Planet9Dave

PostPosted: Jan 14, 2009 @ 12:07pm
by edge
Hi Dave,

EDGELIB renders models as they are stored in the 3D surface structure, no sorting or depth testing is done when OpenGL is enabled. Perhaps the moving of the objects will cause the z-buffer to mess up, because they are all rendered in the same position?

A good test to see if OpenGL is enabled in EDGELIB is to make a call to Perspective2D, followed by a call to Blt.

PostPosted: Jan 14, 2009 @ 9:25pm
by Planet9Dave
First, the models handled via EdgeLib are -not- rendered at the same position -- different values for the translation, rotation and scale are computed for each model.

Second, the EdgeLib-rendered models are rendered correctly with respect to each other, depth-wise: they correctly pass in front of and behind each other, the depth errors are -only- between objects rendered directly with OpenGL calls, and objects rendered with EdgeLib calls.

Third, I'm happy to try your test of calling Perspective2D() followed by Blt(), but what behavior should I see if OpenGL is enabled vs. disabled?

Thanks,
Dave

PostPosted: Jan 15, 2009 @ 8:48am
by edge
Hi Dave,

After reading your post I think the test is not neccessary anymore, because you can drawn an OpenGL scene correctly with working OpenGL functions.

In your sample you enable depth testing with the glEnable(GL_DEPTH_TEST) command. Unfortunately, I can't see the code which renders the OpenGL scene without the EDGELIB calls.

Perhaps depth testing is disabled in that part of the code? Also, make sure the z-buffer is actually filled with values. This can be specified with the glDepthMask(GL_TRUE) call. Another cause could be that the coordinate system isn't the same?

PostPosted: Jan 15, 2009 @ 11:34pm
by Planet9Dave

PostPosted: Jan 16, 2009 @ 8:56am
by edge

PostPosted: Jan 23, 2009 @ 5:12am
by Planet9Dave

PostPosted: Jan 26, 2009 @ 10:14am
by edge