Jump to content
  • Advertisement
Sign in to follow this  
Sleicreider

OpenGL OpenGL Texture Problem

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey,

 

I have following problem:

 

Somehow my textures aren't displaying correctly.

This should be a simple Box, but somehow some faces are missing..

 

f4e74ae2e7.png

 

b4dc283fa5.png

 

 

Is this a depth problem?

 

Can anyone help?

 

Share this post


Link to post
Share on other sites
Advertisement


Is this a depth problem?

Feels more like wrong face orientation.

Change culling to opposite (CW->CCW, or CCW->CW), or check face orientation in your boxes.

Share this post


Link to post
Share on other sites

i only call once 

 

    glEnable(GL_DEPTH_TEST);

    glClearDepth(1.0);

 

on init()

 

and 

 

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

 

per frame

Share this post


Link to post
Share on other sites

That is odd. am I correct in assuming the second image is with the camera below the ground? It's a bit hard to tell with the odd stuff going on. It certainly could be the face orientation as Vstrakh suggests. If you have disable face culling and have depth testing on then everything should at least look normal. Do you change the depth function at all? 

glDepthFunc().

 

Might be worth checking it's values to see:

int value = 0;

glGetIntegerv(GL_DEPTH_FUNC, &value);

 

int cullFace = 0;

glGetIntergerv(GL_CULL_FACE_MODE, &cullFace);

 

Do that at the start of your render function and see what you get.

Edited by Nanoha

Share this post


Link to post
Share on other sites

GL context created without a depth buffer, or glDepthMask (0) called somewhere.

Edited by mhagain

Share this post


Link to post
Share on other sites

GL context created without a depth buffer, or glDepthMask (0) called somewhere.

That's a good point.

 

Sleicreier, you could do the following to check:

 
int depth = 0;
glGetIntegerv(GL_DEPTH_BITS, &depth);
 
If it is zero you don't have a depth buffer at all.
 
And to check your depth mask use:
GL_DEPTH_WRITEMASK
Edited by Nanoha

Share this post


Link to post
Share on other sites

ok 

 

int depth = 0;
glGetIntegerv(GL_DEPTH_BITS, &depth);
 
here depth is 0

 

  int depth = 0;

    glGetIntegerv(GL_DEPTH_WRITEMASK, &depth);

 

here it is 1

Share this post


Link to post
Share on other sites

ok 

 

int depth = 0;
glGetIntegerv(GL_DEPTH_BITS, &depth);
 
here depth is 0

 

  int depth = 0;

    glGetIntegerv(GL_DEPTH_WRITEMASK, &depth);

 

here it is 1

Ah there's your issue, you don't have a depth buffer to use. Could you post some code where you initialise opengl?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!