Archived

This topic is now archived and is closed to further replies.

Nomen

Raw Edges when Quad hits Quad

Recommended Posts

I have started writing a program that generates an artifical terrain with water and mountains. The water is one big blue quad on Y 0, the mountains are constructed of many small quads (Y+). The problem is that where the mountains reach into the water the edges become terribly raw the further you move away (sometimes parts of the whole mountain disappear!). So you better understand the problem I have uploaded a screenshot and the executable here: http://members.aon.at/gpf/ogl/ (you can move back/forward with j/u and rotate with a,s,d,w). When I remove the Quad that generates the water everything looks correct so I guess OpenGL is lazy when rendering the crossing from one quad (mountain) into the other (water). Any ideas what is causing this/How I can fix it? thanks in advance, Max PS.: I use a Geforce 256 SDR/Athlon 700/WinNT 4

Share this post


Link to post
Share on other sites
This is happening because the Zbuffer isn''t accurate enough. You could try using a 32 bit zbuffer.

Or, when calling glPerspective, make the last two parameters(the near and far clip plane) closer together. This will improve the accuracy.

Share this post


Link to post
Share on other sites
Thanks for the answer.
I''ll try to modify the call to gluPerspective() and see if it works.

How/where could i enable the 32bit z buffer?

Share this post


Link to post
Share on other sites
static PIXELFORMATDESCRIPTOR pfd= // pfd Tells Windows How We Want Things To Be
{
sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor
1, // Version Number
PFD_DRAW_TO_WINDOW | // Format Must Support Window
PFD_SUPPORT_OPENGL | // Format Must Support OpenGL
PFD_DOUBLEBUFFER, // Must Support Double Buffering
PFD_TYPE_RGBA, // Request An RGBA Format
bits, // Select Our Color Depth
0, 0, 0, 0, 0, 0, // Color Bits Ignored
0, // No Alpha Buffer
0, // Shift Bit Ignored
0, // No Accumulation Buffer
0, 0, 0, 0, // Accumulation Bits Ignored
16, // 16Bit Z-Buffer (Depth Buffer)
0, // No Stencil Buffer
0, // No Auxiliary Buffer
PFD_MAIN_PLANE, // Main Drawing Layer
0, // Reserved
0, 0, 0 // Layer Masks Ignored
};

in the pixelformatdescriptor, there is 16,// 16Bit Z-Buffer (Depth Buffer)

there write 32 in


we wanna play, not watch the pictures

Share this post


Link to post
Share on other sites
sorry i forgot to mention that i have used glut. i found this method of setting a 32bit Z buffer at google.com, but nothing about how this is done with glut.

Share this post


Link to post
Share on other sites