View Full Version : same object, different size/ viewport
Hello, I'm a newbie to opengl and have come to a bit of a halt. Any help would be greatly appreciated http://www.opengl.org/discussion_boards/ubb/smile.gif
I'v drawn a spiral which works fine but wish to replicate it, only smaller but in the same world window.
Can I have different viewports for each spiral? So that one is smaller than the other??
03-12-2003, 12:51 AM
Not sure what you want to do, but if just want to draw another copy with different size then the first one it's simple.
Say that you have a function called draw() that does the actuale drawing of the spiral...
then you, before you call draw you can call glTranslate3f( x, y, z), glScale3f( x, y, z) and glRotatef( a, x, y, z) to change to position, scale and rotation of the object you are about to draw.
use glPushMatrix() to save the current transformation and glPopMatrix() to restore the matrix again.
Make sure that all this is done on the MODELVIEW matrix glMatrixMode( GL_MODELVIEW)
I hope that was what you wanted to know.
03-12-2003, 09:07 AM
A viewport is a kind of sub-window - it gives you the ability to have multiple views. You render a scene in each viewport. It could be the same scene or a different scene.
You could have a big viewport on one side and a small viewport on the other side. Draw both scenes exactly the same and the spiral in the big viewport will be big and the spiral in the small viewport will be small.
In a game, you might have the main display in a viewport covering the entire screen, a map view in a viewport in one corner, and a zoomed-in view in a viewport in another corner.
If you just want to draw spirals of different sizes, then do as mikael_aronsson suggests.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.