Hi.
I'm new to OpenGL and I have problems I didnt had when i tried it in GLUT (i think i tried gluPerspective).
now, in my own engine, i have problems.
1) When I use gluPerspective or gluLookAt I can't see my triangle. what can cause it? the resizing function is (for gluPerspective):
void Device::resize()
{
int width=win->getWidth();
int height=win->getHeight();
if (device==LN_OPENGL)
{
glViewport(0,0,width,height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,.1f,100.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
}
I re-init (without releasing) opengl in the resize function for now instead of this function.
This step make my window flash when i return from window mode to fullscreen mode to window mode (with opengl only. im sure this is the reason, i hope).
Oh, and here is the rest opengl code:
Device d;
// Where to put cam.update() ? (calls gluLookAt)
// And with what pos & vector to use so i'll see this triangle?
d.clear();
// I used to put cam.update() here in the GLUT project
d.start();
d.rotate(rotate,V(rotate,rotate,rotate));
d.color(RGB(0,0,50));
d.vertex(V(0.0,1.0,0.0));
d.color(RGB(0,50,0));
d.vertex(V(0.87,-0.5,0.0));
d.color(RGB(50,0,0));
d.vertex(V(-0.87,-0.5,0.0));
d.finish();
d.swap();
rotate+=1.0;
thanks,
pex.
[Edited by - pex22 on April 1, 2005 8:52:17 AM]