🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Need multiple viewport help here

Started by
-1 comments, last by carlsoncarlson 18 years, 3 months ago
I need to do multiple viewport, and i followed the tutorial available here to do that.. but I failed to get the results i want. Here's how i do.... At the reshape function there, I set the glViewport here and set the projection style here too. Then because of the camera position will be changed all the time(as user controling the camera) so i place the gluLookAt at the display function. Then after this gluLookAt, I set my 2nd viewport right after it with the projection style and the gluLookAt for the second viewport... The results: No model that I loaded in display in the display window...just.....BLACK.... Can someone please....please help me see where is the problem. Thanks very much. Here's my code. GLvoid ReSizeGLScene(GLsizei width, GLsizei height) // Resize And Initialize The GL Window { if (height==0) // Prevent A Divide By Zero By { height=1; // Making Height Equal One } winWidth = width; winHeight = height; glViewport(0,0,width,height); // Reset The Current Viewport glMatrixMode(GL_PROJECTION); // Select The Projection Matrix glLoadIdentity(); // Reset The Projection Matrix // Calculate The Aspect Ratio Of The Window gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,500.0f); glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glLoadIdentity(); // Reset The Modelview Matrix } int DrawGLScene(GLvoid) // Here's Where We Do All The Drawing { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer glLoadIdentity(); // Reset The Current Modelview Matrix //NEW//////////////////NEW//////////////////NEW//////////////////NEW//////////////// //gluLookAt(0,4.0f,150.0f, 0,3,0.0f, 0,1,0); gluLookAt(objCamera.mPos.x, objCamera.mPos.y, objCamera.mPos.z, objCamera.mView.x, objCamera.mView.y, objCamera.mView.z, objCamera.mUp.x, objCamera.mUp.y, objCamera.mUp.z); // At here, set the second viewport at the right upper part glMatrixMode(GL_PROJECTION); glLoadIdentity(); glViewport(winWidth/2, winHeight/2, winWidth/2, winHeight/2); glOrtho(0, winWidth, 0, winHeight, -3, 3);; glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(0.0, 50.0, 50.0, 0.0, 2.5, 50.0, 0.0, 1.0, 0.0); ........ ........ ......}

This topic is closed to new replies.

Advertisement