01-04-2001, 07:38 AM
hey there...
i'm using the latest version of agl (from apple dev site) on a g3 9.0.4....
the code i'm using was lifted from some stuff i did on windows....
it works fine on that os.....
however i use agl on the mac...and i have my own event loop....i don't use any of the opengl callback stuff.....
i cannot seem to get projection going...
i just keep getting a blank screen...
it's only when i keep my cube translations near the origin that i see anything but it appears more orthogonal than anything else...
can anyone see anything wrong with my perspective set up + drawing code?????
any help would be greatly appreciated......
thanks
C_grexOpenGLTestMacApp::Reshape(int i_w, int i_h)
{
//set up viewport
glViewport(0, 0, i_w, i_h);
glEnable(GL_DEPTH_TEST);
//////////////////////////////////////////////////
// Setup projection matrix.
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
float lf_ar = (float) i_w / (float) i_h;
gluPerspective(45.0, lf_ar, 1.0, 425.0);
//////////////////////////////////////////////////
// Setup model matrix.
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
bool
C_grexOpenGLTestMacApp::Render(void)
{
//mptr_ctx is a member of this class and has been inited fine
if(aglSetCurrentContext(mptr_ctx) == GL_FALSE)
return false;
//clear buffers
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
//draw
glColor3f(1.0, 1.0, 1.0);
glTranslatef(0.0, 0.0, -300.0);
//draw a wire cube
auxWireCube(10.0);
auxSolidSphere(6.0f);
glPopMatrix();
glFlush();
//swap buffers
aglSwapBuffers(mptr_ctx);
return true;
}
i'm using the latest version of agl (from apple dev site) on a g3 9.0.4....
the code i'm using was lifted from some stuff i did on windows....
it works fine on that os.....
however i use agl on the mac...and i have my own event loop....i don't use any of the opengl callback stuff.....
i cannot seem to get projection going...
i just keep getting a blank screen...
it's only when i keep my cube translations near the origin that i see anything but it appears more orthogonal than anything else...
can anyone see anything wrong with my perspective set up + drawing code?????
any help would be greatly appreciated......
thanks
C_grexOpenGLTestMacApp::Reshape(int i_w, int i_h)
{
//set up viewport
glViewport(0, 0, i_w, i_h);
glEnable(GL_DEPTH_TEST);
//////////////////////////////////////////////////
// Setup projection matrix.
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
float lf_ar = (float) i_w / (float) i_h;
gluPerspective(45.0, lf_ar, 1.0, 425.0);
//////////////////////////////////////////////////
// Setup model matrix.
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
bool
C_grexOpenGLTestMacApp::Render(void)
{
//mptr_ctx is a member of this class and has been inited fine
if(aglSetCurrentContext(mptr_ctx) == GL_FALSE)
return false;
//clear buffers
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
//draw
glColor3f(1.0, 1.0, 1.0);
glTranslatef(0.0, 0.0, -300.0);
//draw a wire cube
auxWireCube(10.0);
auxSolidSphere(6.0f);
glPopMatrix();
glFlush();
//swap buffers
aglSwapBuffers(mptr_ctx);
return true;
}