PDA

View Full Version : Bugging Split View



SurGL
04-17-2001, 03:29 AM
This problem is really bugging me.
My requirement is simple. I have to display a split screen.
left and right.

I am posting the Function code, I use for setting up the viewport and clipping volume.

void CMapView::ReDraw(int w,int h , int w1, int h1)
{

GLdouble aspect;
GLfloat nRange;

CMapDoc* pDoc = GetDocument();
nRange = pDoc->MaxX;/* value is 100*/
int Ht= h1 - h;
int Wid = w1 - w;

if( Ht ==0 )
aspect = (GLdouble)Wid;
else aspect = (GLdouble)Wid / (GLdouble)Ht;
glViewport((GLsizei)w, (GLsizei)h, (GLsizei)w1, (GLsizei)h1);
glScissor ((GLsizei)w, (GLsizei)h, (GLsizei)w1, (GLsizei)h1);
glMatrixMode(GL_PROJECTION); glLoadIdentity();
if( Wid<=Ht)
glOrtho(-nRange,nRange, -nRange/aspect, nRange/aspect, -nRange, nRange);
else
glOrtho(-nRange*aspect, nRange*aspect,
-nRange, nRange, -nRange, nRange);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glDrawBuffer(GL_BACK);
}

I have set nRange as 100. So cliping range is -100 to 100.

Now the problem. This doesnot work for some window sizes, if Width > Height .

I am not able to see the primitives drawn on say (60,60 ) etc.

HELP !! HELP !!