strange problem in drawing my models right
I encounter a problem on drawing my OpenGL models smoothly in VC++ with MFC applications..
I have read alot of references and examples and am pretty sure that my OpenGL settings are all correct. NOTE, the buffers are clear and my models are drawn ONCE per frame... however, there's a ghost view of the previous frames appear on my current frame.. In the other words, what i see is that the models are drawn twice and the geometries of them are slightly apart while i do the navigation.. Can anyone help me out...
Thanks a million!!!!
The following is the sample codes
// one of the case that i update my drawings
CPaintDC dc(this); // device context for painting
glClearColor(0.0f, 0.0f, 0.0f, 0.0f) ;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT|GL_ACCUM_BUFFER_BIT|GL_STENCIL _BUFFER_BIT);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST );
// THis is where i draw my models
glTranslatef(myposition.x, myposition.y, myposition.z);
Re: strange problem in drawing my models right
1) Try getting rid of the glDrawBuffer(GL_BACK) call. I've never used it, and I've never had this problem.
2) Check your glError string just after your glClear call. It may be that you are failing your clear because you are specifying bits (accum?) that you didn't allocate in your pixel format. You probably don't want an accumulation buffer anyway.
3) You really should have that glLoadIdentity() call after your "// THis is where i draw my models". By calling this, you're taking away the camera matrix. That is, your model's position does not change based on the camera matrix anymore.