projection problems using agl

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;

}

Originally posted by jim mac lunch:
[b]hey there…
<snip>

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);

}
[/b]

try this in your reshape method …

int iv_rect = {0, 0, i_w, i_h);
aglIntegerv(AGL_SWAP_RECT, iv_rect);

adios dariusz

thanks for the reply…
i put the following code at the end of my reshape method

aglEnable(mptr_ctx, AGL_SWAP_RECT);
GLint iv_rect[4] = {0, 0, i_w, i_h};
aglSetInteger(mptr_ctx, AGL_SWAP_RECT, iv_rect);

//just being paranoid
aglUpdateContext(mptr_ctx);

this unfortunately has no effect on the result…
i’m passing the following params to set up a pixel format for that context…

GLint lia_attr[5] = {
AGL_RGBA, //RGBA pixel format
AGL_DOUBLEBUFFER, //double buffered pixel formats are considered
AGL_DEPTH_SIZE, //depth buffer of size 16
16,
AGL_NONE //attributes must be terminated by this value
};

this is really annoying…
and i can’t see what it is i’m doing wrong here…
thanks…

forgive me…
i’m an idiot…
i forgot to set the context before i called my reshape method at initilisation…
problems are always in the most obvious place and the most obvious place is the last place you look…
thanks darius for your help…