PDA

View Full Version : Maintaing object size



Succinct
02-07-2001, 04:56 PM
how would i render a scene, clipping the edges instead of scaling the image?

all of the ways i've tried end up also losing the "squareness" of the objects...

mango
02-07-2001, 05:58 PM
If I understand it right do you want to use glOrtho in some way. (?)

Succinct
02-08-2001, 09:43 AM
oh, i'm sorry, friend, i guess i didn't explain correctly.

no, this is for a 3d scene using perspective projection.

what i mean is that when you render a scene to a window, then shrink the window by half, the image is scaled by 1 half...

well, i want to keep the image the same size, just clip it instead...

well, i figured, glScalef() the images to divide out the size of the window, then mutiply by the width of the screen... no dice. everything now is shaped relative to the shape of the window (long tall window == long tall image)

so i tried including aspect ratios (the screen's and the window's): in gluPerspective, incorporating it into the glScalef(), using both aspects, dividing one into another... still, no dice, nothing works right.

has anyone else solved it? i'm sure i can, but i just wanted to see if someone else already had...

thank you for your bandwidth

-Succinct

idiot
02-08-2001, 10:03 AM
Originally posted by Succinct:

what i mean is that when you render a scene to a window, then shrink the window by half, the image is scaled by 1 half...

well, i want to keep the image the same size, just clip it instead...
-Succinct

why not create a new frustrum that matches the viewport? so when the viewport is resisized, resize the view frustrum accordingly. this would save all the glScale* calculations...

Rizo
02-08-2001, 11:59 AM
glViewPort() is the way to go...

if you're using GLUT, then follow this:

create a function
void myViewPort(GLint x, GLint y)
{
*calculate new view port*
glModelViewMatrix(GL_PROJECTION);
glLoadIdentity();
glViewPort(*new viewport*)
set the persective (if needed)
}


in your main()
after you create a window call
glutReshapeWindow(myViewPort);

Hope this helps,
Rizo