Background not working

hello, I am trying to make a simple program where the character simply moves around the screen with the arrow keys. However, whenever the ‘glutReshapeFunc(ChangeSize)’ thing is called it doesn’t clear the background. This is confusing because this function would clear the bg in a different program. Any suggestions?

Thanks,
Ben

//I am using the OpenGL SuperBible 3rd Ed

function in question:

void ChangeSize( int w, int h )
{
GLfloat nRange = 100.0f;

if( h == 0 )
h = 1;

glViewport( 0, 0, w, h );

glMatrixMode( GL_PROJECTION );
glLoadIdentity( );

if( w (less than or equal to) h ) /* the website wouldn’t let me post using the ‘left carrot’ symbol b/c it thinks I’m trying to do html*/
glOrtho( -nRange, nRange, -nRange * h/w, nRange * h/w, -nRange, nRange );
else
glOrtho( -nRange * w/h, nRange * w/h, -nRange, nRange, -nRange, nRange );

glMatrixMode( GL_MODELVIEW );
glLoadIdentity( );
}

if you want to clear the color buffer, call glClear(GL_COLOR_BUFFER_BIT)

this should probably be in the beginners’ forum, rather than the Mac-specific one :wink:

I see - thank you :rolleyes:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.