Hello,
I used this post to do a gradient background :
http://www.opengl.org/discussion_boards/showthread.php/164345-Gradient-background?p=1161258
The principle is to draw a background quad with glOrtho and then to draw the model in the perspective view.
Here is the code ; I added it in my existing ClearBackground function ; it is called before every drawing.
Code :glClear(/*GL_COLOR_BUFFER_BIT |*/ GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION ); glLoadIdentity(); [COLOR=#ff0000]glOrtho(0,1,0,1,-1,1);[/COLOR] glDisable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); glDepthMask(GL_FALSE); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glBegin(GL_QUADS); glColor3f(85/255.0f, 85/255.0f, 255/255.0f); ... glEnd(); glDepthMask(GL_TRUE); glEnable(GL_DEPTH_TEST); glEnable(GL_LIGHTING);
Here is the problem (see the attached image) : after the first view drawing the background is a small quad in the bottom left. And after a refresh the background is on the full view.
It seems that some initializations are missing before the first drawing...
Do you have an idea of what causes this problem ?
Thanks for your help






