PDA

View Full Version : projection problem



01-09-2005, 11:48 PM
i want to know how can i adjust my clipping box dynamically when an event is triggered.

any help is much be appreciated.

dvm
01-10-2005, 03:46 AM
Pretty much exactly how you would when calling a resize window function:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// since you want it to be interactive I'd suggest having some variables to hold the clipping coordinates
glFrustum(left, right, bottom, top, znear, zfar);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();Again since it has to be interactive the calls in the resize function and the event processing function have to be the same so you won't have any "reset" effects. Take a look at Nate Robbins' demos. There is one on which you can change the view volume dynamically. Nate\'s page (http://www.xmission.org/~nate)

01-10-2005, 08:03 AM
it's not working!

01-10-2005, 02:05 PM
Post your code so that we can see what you're trying to do.

Is it resizing?

Then look at a standard window opening example for your operating system. Nehe's lesson 1 and 2 open a window for Window's Operating system in fullscreen as well as windowed(resizable) mode.

hope that helps.

dvm
01-11-2005, 02:25 AM
What API are you using to create the window? Win32, glut, or something else? Again I will point you to Nate Robins' tutorials, (with a more specific link this time :) ). Here (http://www.xmission.com/~nate/tutors/tutors.zip)
The "projection" project has exactly what you want, as I've understood.

01-11-2005, 06:03 AM
thanks a lot, guys!

from the site as suggested, i have got what i want!