View Full Version : 3D Space Environment

10-27-2002, 09:40 AM
I am trying to create a navigatable universe consisting of stars and planets, but moving through the universe, and placing the planets/stars in perspective using gluPerspective(60, w/h, 1, 400);
but I can't get it to plot where I want, and I can't figure out how to move inward, and bacwards through the world, how can I go about doing this?

10-27-2002, 11:27 AM
Read a f*cking book. Then post questions in the beginners forum.

10-27-2002, 12:06 PM
don't be an arschloch, I have plenty of C/opengl experience, I am just having trouble in the perpective part.

10-27-2002, 11:10 PM
How can you not understand perspective if you have "plenty of opengl experience" ?

Your question doesn't seem very precise.. what is your problem exactly ?

Have a look at nehe.gamedev.net, there's a few good basic tutorials. You need to understand how to use the modelview matrix to simulate a "camera".


10-28-2002, 02:24 PM
I am obviously not making myself clear. I am use to using glOrhto, and glFrustum, when I am programming, but I am trying to use gluPerspective, inorder to generate a more 3D experiene than glFrustum, but my book doesn't explain it well enough that I can figure out how to plot on both the w, and h, as well as work with near, and far.

10-28-2002, 02:50 PM
gluPerspective and glFrustum basically both do the same. They both define a perspective projection matrix, just with different parameters. In fact, gluPerspective is usually implemented using glFrustum

From Mesa:

gluPerspective(GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar)
GLdouble xmin, xmax, ymin, ymax;

ymax = zNear * tan(fovy * M_PI / 360.0);
ymin = -ymax;
xmin = ymin * aspect;
xmax = ymax * aspect;

/* don't call glFrustum() because of error semantics (covglu) */
frustum(xmin, xmax, ymin, ymax, zNear, zFar);

That's the relationship between gluPerspective and glFrustum.

10-28-2002, 05:20 PM
true, glFrustum/gluPerspective do the same thing: specify the view frustum http://www.opengl.org/discussion_boards/ubb/smile.gif frustum is that "capped pyramid" shape: the "small end"/near rectangle is your screen surface, the big/far one (pyramid base) is the end of the view "pyramid"... the relationship between rectangles defines your field/depth of view, their positions and orientations define the near/far clipping planes. feel free to mess around with it, there are some cool things you can do (for example, "zoom" in quake1/2/3 is litterally just field-of-view change). tip: start with a horizontal fov of about 60 degrees for minimal perspective distortion (assuming your monitor is at an average distance from you). hope this helps http://www.opengl.org/discussion_boards/ubb/smile.gif

btw, don't others think that the guy got some fairly harsh (and ultimately useless) replies? after all, non-3d coding experience is still experience... for all you know, he might've done 37 sprite-based games http://www.opengl.org/discussion_boards/ubb/wink.gif

[This message has been edited by mattc (edited 10-28-2002).]

10-29-2002, 02:57 PM
Thanx those to those of you willing to post useful messages. I think I have an idea as to how to do it now.