Basic OpenGL reshape function question...
Code:
void reshape1(int width, int height)
{
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
[b]gluPerspective(); or glFrustrum(); or glOrtho();[/b]
glGetDoublev(GL_PROJECTION_MATRIX, projection);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(lookat[0].value, lookat[1].value, lookat[2].value,
lookat[3].value, lookat[4].value, lookat[5].value,
lookat[6].value, lookat[7].value, lookat[8].value);
glGetDoublev(GL_MODELVIEW_MATRIX, modelview);
glClearColor(0.0, 0.0, 0.0, 0.0);
}
void reshape2(int width, int height)
{
same as above: glViewport(), glMatrixMode, glLoadIdentity
[b]gluPerspective(60.0, (GLfloat)width/height, 1.0, 256.0);[/b]
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -5.0);
glRotatef(-45.0, 0.0, 1.0, 0.0);
glClearColor(0.0, 0.0, 0.0, 0.0);
}This is Nate Robin's code from his projection tutorial and I'm wondering why the reshape1 function has the glGetDoublev(GL_PROJECTION_MATRIX, projection); statement whereas reshape2 does not? And I'm correct in saying that the reshape2 function doesn't have a gluLookAt() function because it uses all default values?
Thanks in advance.
Presumably he gets the projection matrix because he wants it later. You shouldn't call glGet. He has to because he's writing an odd tutorial app
(Mar 24, 2011 03:03 PM)WhatMeWorry Wrote: And I'm correct in saying that the reshape2 function doesn't have a gluLookAt() function because it uses all default values?You can always replace gluLookAt with translations and rotations. gluLookAt simply packages the information in terms of camera position and direction.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Basic OpenGL questions | Mercy | 5 | 4,130 |
Dec 23, 2008 10:25 AM Last Post: AnotherJake |
|
| Texture Basic Question(s)... | WhatMeWorry | 2 | 2,913 |
Feb 27, 2007 10:06 AM Last Post: arekkusu |
|
| Depth Buffer / Testing basic question... | WhatMeWorry | 5 | 5,911 |
Nov 18, 2005 12:50 AM Last Post: arekkusu |
|
| basic matrix question | hyperzoanoid | 3 | 2,970 |
Sep 27, 2003 03:06 PM Last Post: DoG |
|

