Beispiel #1
0
/* function to reset our viewport after a window resize */
int Display_SetViewport( int width, int height ) {
    /* Height / width ration */
    GLfloat ratio;
 
    /* Protect against a divide by zero */
    if ( height == 0 ) {
        height = 1;
    }
 
    ratio = ( GLfloat )width / ( GLfloat )height;
 
    /* Setup our viewport. */
    glViewport( 0, 0, ( GLsizei )width, ( GLsizei )height );
 
    /* change to the projection matrix and set our viewing volume. */
    glMatrixMode( GL_PROJECTION );
    glLoadIdentity( );
 
    /* Set our perspective */
    perspectiveGL( 45.0f, ratio, 0.1f, 100.0f );
 
    /* Make sure we're chaning the model view and not the projection */
    glMatrixMode( GL_MODELVIEW );
 
    /* Reset The View */
    glLoadIdentity( );
 
    return 1;
}
void myWindow::resizeGL(int width, int height)
{
    if(height == 0)
        height = 1;
    glViewport(0, 0, width, height);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    perspectiveGL(90.0f, (GLfloat)width/(GLfloat)height, 0.1f, 800.0f);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
}
Beispiel #3
0
void reshape(int w, int h)
{
	glPushMatrix();
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	perspectiveGL(25.0,(GLfloat)w/(GLfloat)h,.1,10000.0);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glViewport(0,0,(GLsizei)w,(GLsizei)h);
	glPopMatrix();
}
Beispiel #4
0
/* function to reset our viewport after a window resize */
int Display_SetViewport( int width, int height )
{
    GLfloat ratio;
    if ( height == 0 )
        height = 1;
    ratio = ( GLfloat )width / ( GLfloat )height;
    glViewport( 0, 0, ( GLsizei )width, ( GLsizei )height );
    glMatrixMode( GL_PROJECTION );
    glLoadIdentity( );
    perspectiveGL( 45.0f, ratio, 0.1f, 100.0f );
    glMatrixMode( GL_MODELVIEW );
    glLoadIdentity( );
    return 1;
}
Beispiel #5
0
void mGraphics::initGL(){
	/* Height / width ration */
	GLfloat ratio;
 
 
	ratio = ( GLfloat )W / ( GLfloat )H;
 
	/* Setup our viewport. */
	glViewport( 0, 0, ( GLsizei )W, ( GLsizei )H );
 
	/* change to the projection matrix and set our viewing volume. */
	glMatrixMode( GL_PROJECTION );
	glLoadIdentity( );
 
	/* Set our perspective */
	perspectiveGL( 45.0f, ratio, 5.0f, 3000.0f );
 
	/* Make sure we're chaning the model view and not the projection */
	glMatrixMode( GL_MODELVIEW );
 
	/* Reset The View */
	glLoadIdentity( );
}