glOrtho problem

I have a
void __fastcall TPVPLForm::GLP2DResize(TObject Sender)
{
width=(GLsizei)GLP2D->Width;
height=(GLsizei)GLP2D->Height;
glViewport(0,0,width,height);
maxx=maxy
(width/height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(minx,maxx,miny,maxy,-1.0,1.0);
glPushMatrix();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}

But whenever I change minx,maxx,miny,maxy
nothing happens the drawing does not zoom
when I call Repaint but retains the values
that were first given when the program
started. Wht could be causing this?
Regards Digby Millikan.

hm, you have an TObject* Sender as parameter, you dont use it, is that ok?

second: width and height are integers? so maxx=maxy*(width/height);
has an integerdivision, as known as unprecisious… use the floatones…

third, you dont reset maxy, so you set maxx perhaps always to the same value ( as long as width/heigth in integer results in the same value

Dave,
None of these, but I set maxy externally to
the Resize.:confused:

ok, possible, too

Is the OpenGL context current during the resize function?

Originally posted by Digby:
I have a
void __fastcall TPVPLForm::GLP2DResize(TObject *Sender)
{

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(minx,maxx,miny,maxy,-1.0,1.0);
glPushMatrix();
glMatrixMode(GL_MODELVIEW);

}
.

Hi
maybe glPushMatrix on each window resizing causes projection matrix stack overflow.

[This message has been edited by Michail Bespalov (edited 03-21-2001).]