This topic is 4334 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

hi all. Im new to 3d programing, Im starting to build an engine the thing is that I got the model to load and the texture but I have problems to see it correctly. I have missing faces and shadows in the map, now the thing is that I know that those faces are there because I can see them when I move the camera. here is an example: This is are my initial settings in the engine:
 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glClearColor(0.0, 0.0, 0.0, 0.0);              // Black Background
glClearDepth(1.0f);                                // Depth Buffer Setup
glDepthFunc(GL_LEQUAL);                            // The Type Of Depth Testing To Do
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations
glEnable(GL_COLOR_MATERIAL);						  glClearColor(0.0, 0.0, 0.0, 0.0);


Texturing:
  glGenTextures(1, (GLuint *) &texc->texnum);
glBindTexture(GL_TEXTURE_2D, texc->texnum);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
texc->image->xsize, texc->image->ysize, 0,
GL_RGB, GL_UNSIGNED_BYTE, texc->image->pixmap);
GLint param = GL_LINEAR;// : GL_NEAREST;
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, param);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, param);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);


What could be caussing it? Thanks!

Share on other sites
I'm not sure what you mean by shadows, but the missing faces could be a culling issue. Try glDisable(GL_CULL_FACE); and if things start looking normal then your polys are being wrongly culled. This is usually because the winding order (order in which the vertices is specified) is wrong. Bad exporters or malformed models can cause this.

It could also be a depth buffer problem. You seem to have set the depth testing state ok, but your actual display might be lacking a depth buffer. Try glGet(GL_DEPTH_BUFFER_BITS) and if it returns 0 then have a close look at your display creation and check you're requesting a display with 16bits or greater depth buffer.

Share on other sites
It looks like there's no depth testing. Make sure you have a depth buffer and use glEnable( GL_DEPTH_TEST );

Share on other sites
great ! the glEnable( GL_DEPTH_TEST ) solved the missing faces problem, I still have the weird "shadow" (is the black thing you can see in the top right part of the image).

BTW are you sure the fnction glGet(GL_DEPTH_BUFFER_BITS) exist? I dont seem to get it work.

Share on other sites
Is it always affecting polys in the distance? It could be your far clip plane. Look for your projection matrix setup (probably gluPerspective) and push the far plane (last param) further out.

(I don't have my docs handy, I think the exact glGet command should be glGetIntegerv(GL_DEPTH_BITS, &outInt);

Share on other sites
that was it! thanks a lot !

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 26
• 9
• 11
• 9
• 9
• Forum Statistics

• Total Topics
633710
• Total Posts
3013486
×