demos: fix aspect ratio in Reshape()
This commit is contained in:
@@ -150,10 +150,11 @@ Redisplay(void)
|
|||||||
static void
|
static void
|
||||||
Reshape(int width, int height)
|
Reshape(int width, int height)
|
||||||
{
|
{
|
||||||
|
float ar = (float) width / (float) height;
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glFrustum(-1.0, 1.0, -1.0, 1.0, 5.0, 25.0);
|
glFrustum(-ar, ar, -1.0, 1.0, 5.0, 25.0);
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glTranslatef(0.0f, 0.0f, -15.0f);
|
glTranslatef(0.0f, 0.0f, -15.0f);
|
||||||
|
Reference in New Issue
Block a user