Example #1
0
void gl_CreateScreen() {
int	vsize = (screen_height/MaxLines)*MaxLines;
int	vpos, hoffset, maxheight;
int	maxstretch = (screen_width * 3) / 40;

	if (vsize+Tall*4 > screen_height)	maxheight = screen_height;
	else					maxheight = vsize+Tall*4;
		
	if (Narrow > maxstretch)		hoffset = maxstretch*4;
	else					hoffset = Narrow*4;

	vpos = (screen_height - maxheight)/2;
	
	_glEnable( GL_TEXTURE_2D );
	_glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );

	_glViewport( -hoffset, vpos, screen_width+hoffset*2, maxheight );

	_glMatrixMode( GL_PROJECTION );
	_glLoadIdentity();
	_glOrtho( 0, screen_width, screen_height, 0, -1, 1 );
	_glMatrixMode( GL_MODELVIEW );
	_glLoadIdentity();
}
Example #2
0
GLAPI void GLAPIENTRY glViewport( GLint x, GLint y, GLsizei width, GLsizei height )
{
    OGL_CHECK_FUNC(_glViewport, "glViewport");
    printf("glViewport()\n");
    _glViewport( x, y, width, height );
}