-2

I tried a lot of methods on the Internet but it still not working. now i think about if the trouble is related to my OS (ubuntu).

void init(void){
glClearColor(1.0, 1.0, 1.0, 0.0);
glShadeModel(GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glClearDepth(1.0);
glDepthFunc(GL_LESS);
glFrontFace(GL_CCW);
glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
init2();
}

void reshape(int w, int h){
int t = min (w,h);
glViewport (0, 0,  t, t);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-100.0, 100.0, -100.0, 100.0, 1.1, 200.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(40.0, 40.0, 100.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);
}

Two functions above are from my code..

genpfault
  • 51,148
  • 11
  • 85
  • 139
fish7
  • 21
  • 3

1 Answers1

0

glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT) must be called at the beginning of every frame to clear both the color buffer and the depth buffer.

Other than that, you should post more details. What are you seeing? How are you requesting the OpenGL context? Could you post the whole draw loop?

Dani Torramilans
  • 340
  • 1
  • 2
  • 7