PDA

View Full Version : noob scene cliping problem



arctbl
02-23-2009, 01:18 PM
I am trying to write a program in which the user walks through a 'starfield' where the stars blur the faster you move through the scene. The problem is that when I move a certain distance or turn too far, the stars blur/screen area does not clear.

To me it seems that my 'world area' is not updating after the initial creation, although it is supposed to be ...

Any clues would be appreciated

void cstarfield::displayFunc( )
{
glClear( GL_DEPTH_BUFFER_BIT );

// enable blending - shows 'tails' on stars
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );

glDisable( GL_LIGHTING );
glDisable( GL_DEPTH_TEST );

glColor4f(0.0,0.0,0.0,g_alpha); //turn off flashin

glPushMatrix();

glMatrixMode(GL_PROJECTION);
// load the identity matrix
glLoadIdentity();
// set the perspective matrix

float angle=64.0, ratio=(GLdouble) 800*1.0/600;
float nearD=3.0, farD=100.0;
gluPerspective( angle, ratio, nearD, farD );

// set the matrix mode to the modelview matrix
glMatrixMode(GL_MODELVIEW);
// load the identity matrix into the modelview matrix
glLoadIdentity();

camera.drawPlanes();// clears screen

glEnable( GL_DEPTH_TEST );
glDisable( GL_BLEND );

// save the current matrix state, so transformation will
// not persist across displayFunc calls, since we
// will do a glPopMatrix() at the end of this function
glPushMatrix( );

camera.Render();//updates frustum

//camera.drawPlanes();// - erases trails here. if done above it doesn't follow the camera

// draw the scene
render( );

glPopMatrix( );
glPopMatrix();
glFlush( );
glutSwapBuffers( );
}