PDA

View Full Version : glClearColor and glClear under glFrustum



Andre Simoes
03-26-2010, 06:56 AM
Hello gentlemen.

I've been working with ortho 2D projections for long time.

Nowadays i've started C++ classes to:
-> perform camera operations
-> to use glFrustum as a perspective camera.

All the camera and frustum operations/configuration and visualization are ok. But when i make my camera to zoom out couple of times i see that my background becames smaller than my viewport.

Do the background can be smaller than the viewport ????
Maybe I'm telling something wrong but i believe yes if the camera is out of the box of visualization.

an example of my renderization code is:



void draw( void )
{
glViewport( 0, 0, window_wid, window_height );

glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glFrustum( my_frustum );

glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
camera->postAttitudeAndTranslation();

glClearColor( my_bkg_color );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

for( unsigned i = 0; i < objects.size(); ++i )
{
glPushMatrix();
objects[ i ].callDisplayList();
glPopMatrix();
}

glFlush();
}