PDA

View Full Version : OpenGl Performance



Wei
03-06-2002, 06:59 AM
I have used OpenGl to draw 2D and 3D graph. 2D graph uses lots of Colors. If I open 2D window first, then switch to 3D graph window, then my 3D object rotation become really slow, there is at least several seconds delay between mouse move and object rotation. But if I go to 3D window first, then every thing works fine.Is this normal with OpenGL? did anyone have the same problem before? Can anyone please tell me what is the problem? Thanks alot...

chxfryer
03-06-2002, 07:59 AM
Are they both in the same window?
if so, when you do the 2d first, are you switching back to 3d from Ortho (2d)?

Wei
03-06-2002, 08:33 AM
Yes,They are in the same window. and it is switched from Ortho(2d) to Ortho3d.Here is how it works:

switch(GraphType)
{
case1: //2d
{
glViewport(); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(XMin,XMax,YMin,YMax);
glMatrixMode(GL_MODELVIEW);
DrawGraph();
break;
}
case2://3D
{
glViewport();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(XMin,XMax,YMin,YMax,ZMin, ZMax);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
DrawGraph3D();
break;
}
Please let me know if I did something wrong. Thank you very much!!