PDA

View Full Version : glscale and glOrtho



Vlasko
08-27-2001, 07:51 AM
my question: what does the glScale an glOrtho do - some better explanation than in MSDN Library

ravi2030
08-27-2001, 08:09 AM
hi,

this site will help U:
http://www.eecs.tulane.edu/www/graphics/doc/OpenGL-Man-Pages/opengl_index_alpha.html

--Ravi

08-27-2001, 09:30 AM
Ortho specifies the coordinates of your drawing area. They can be whatever you specify, and they will be stretched or shrunk to fit your viewport.

glScale actually multiplies whatever coordinates you draw by the appropriate x,y or z value. So, if you drew to coord (10,10) after a glscale call of (0.5,2), your point would get drawn at (5,20)

Vlasko
08-27-2001, 10:00 AM
the page did not help very much (it is the same as MSDN) but thanks anyway.
about LoadIdentity - is that mean that i get the original matrix(1,1,1) or that with glOrtho ?
and when I use glTranslate am I moving the zero point(0,0,0)(matrix (?)) to new location or just the drawing point ?

DaViper
08-27-2001, 11:29 PM
might find your answers here: http://shiva.missouri.edu:88/SGI_Developer/OpenGL_PG/5331?DWEB_SEARCH=glortho#1
http://shiva.missouri.edu:88/SGI_Developer/OpenGL_PG/4177?DWEB_SEARCH=glScale#1

Oynx
08-29-2001, 04:58 AM
It actually makes more sense if I answer your questions in reverse order...

glTranslate moves the coordinate system. Say you start your scene with -

glTranslate3f(0.0f, 0.0f, -0.2f);

This would move the coordinate system slightly away from you. (You actually need to do this before drawing anything or you will not be able to see it!) What I mean by moving the coordinate system is that the origin (0, 0, 0) is moved. In this case it is moved away from you slightly down the Z axis. Anything drawn from now on uses this new origin.

glLoadIdentity() actually resets the coordinate system back to its original location. Pretty simple really. Do this before translating the scene away from you or you might get unexpected results!

I think this explanation is correct. I am only a beginner myself but opengl seems to have clicked with me. If I explained anything wrong here then please could someone let me know because that means I do not understand even the fundamentals http://www.opengl.org/discussion_boards/ubb/smile.gif

Vlasko
08-29-2001, 11:04 PM
thanks ,now I get some thinks that I didn't before.
My last 2 question (for now :-)): PushMatrix - what does this do ? it preserves the coordinatinon system in its current location or ... ?

gluSphere (or glutWire(Solid)Sphere ) : how to shrink or enlarge the sphere and in what measurement units is radius counted ?

thanks

Bob
08-30-2001, 10:29 PM
glPushMatrix saves the current matrix so you can go back to it in a later stage. You use glPopMatrix to get it back.

The argument you pass to glu(Solid|Wire)Sphere is measured in units. Actuallt, OpengL doesn't deal with units (units as in meter, yard, inch) at all. One unit can be whatever you like. If you want to draw a smaller/bigger sphere, just decrease/increase it's raduis.

Vlasko
09-01-2001, 01:00 AM
Thanks - that with radius was my wrong translation :-(