 |
 |
OpenGL pisses me off
|
 |
|
 |
|
Mac Elite
Join Date: Oct 2001
Location: Colorado Springs
Status:
Offline
|
|
what's the better method for moing around a 3D scene? (I'm new to OpenGL)
1. fly the camera around the scene, using glulookAt()?
or
2. Leave the camera stationary and glRotate()/glTranslate() all the objects around it (creating the illusion of movement)?
|
RhythmScore
iMac 27" Quad i5 | PMG4 2x867 (RhythmScore test server) | iPhone4
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Jan 2001
Status:
Offline
|
|
*Anything* you do creates the "illusion" of movement. If it looks the same, what's the difference? And FYI, gluLookAt() really just boils down to a bunch of concatenated rotate and translate commands.
Play around with it more, one day, you will be enlightened as to the purpose and structure of the modelview matrix.
Regarding this silly concept of a camera in OpenGL, think of it like this:
There is no camera.
|
|
|
| |
|
|
|
 |
|
 |
|
Registered User
Join Date: Oct 2003
Status:
Offline
|
|
1. fly the camera around the scene, using glulookAt()?
Yes. That's the one you want. You can instead do it with 2 or 3 calls to glTranslate and glRotate() if you like, but gluLookAt() is there to make your life easier.
0x29 wrote:
There is no camera.
Once you realize that, you'll then see that it's not your vertices that get transformed, but only yourself. <snicker>
Either that, or maybe what's meant is, in the end, your viewing volume gets all swung around and centered on (0,0,0), scaled to some unit cube, flattened down to the x-y plane, and rasterized.
I personally like thinking in terms of a camera- (or eye-) position.
|
|
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Aug 2002
Location: Northeastern NV, USA
Status:
Offline
|
|
Originally posted by johnMG:
I personally like thinking in terms of a camera- (or eye-) position.
I agree. I tend to relate it to the "real" world. When you hike a mountain trail, YOU move, the mountain doesn't.
Originally posted by jcadam:
what's the better method for moing around a 3D scene?
Actually, I'd put a cow on the screen and invoke sound samples for all of the "mooooo-ing"... Sorry, couldn't resist... Lord knows I've made more than my fair share of typos too!
But seriously, go pick up a copy of " OpenGL Game Programming" from Premier Press. This will teach you the basics of creating a 3D world and moving a player around in it. It's a great book for someone starting from scratch with OpenGL, regardless if you're wanting to program games or find other uses for displaying objects in OpenGL.
Better yet, save some case and look for it on EBay. Just search on the term OpenGL or Open GL. If you don't find it listed right now I'm sure you will see it sooner or later, or at least find something similar.
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Apr 2001
Location: Long Beach, CA
Status:
Offline
|
|
Originally posted by yeslekmc:
I agree. I tend to relate it to the "real" world. When you hike a mountain trail, YOU move, the mountain doesn't.
How do you know? What if the entire universe is just some computer program running inside a little yellow cube sitting on someone's desk, somewhere outside of our universe?
Then, there would be no reason to distinguish between whether you move or the mountain moves. The math is exactly the same to create the illusion of motion within your imaginary mind.
Translation: the math that the computer does to "move the camera" really is just translating and rotating all of your objects. Mathematically, the camera is always at <0,0,0>. The translation to 2D is easier that way.
|

ACSA 10.4/10.3, ACTC 10.3, ACHDS 10.3
|
| |
|
|
|
 |
|
 |
|
Junior Member
Join Date: Aug 2002
Location: Northeastern NV, USA
Status:
Offline
|
|
Originally posted by Detrius:
How do you know? What if the entire universe is just some computer program running inside a little yellow cube sitting on someone's desk, somewhere outside of our universe?
Then, there would be no reason to distinguish between whether you move or the mountain moves. The math is exactly the same to create the illusion of motion within your imaginary mind.
Translation: the math that the computer does to "move the camera" really is just translating and rotating all of your objects. Mathematically, the camera is always at <0,0,0>. The translation to 2D is easier that way.
You know, you are correct. You can program OpenGL to either move the camera, or move the world around the camera. It is much more powerful to move (translate, rotate, and scale) the world, but for a beginner to experiment with I think it is easier to create the world and then move the camera to any position and orientation that you wish.
What it all boils down to though is the fact that you really need to purchase a couple of good books on OpenGL programming and spend some quality time experimenting and writing programs.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Oct 2001
Location: Colorado Springs
Status:
Offline
|
|
Thanks, I've got the OpenGL Redbook already, and I've been reading NeHe's tutorials on his website. I think I may choose the rotate the world around a stationary camera method.
It would seem easier that way, considering there are some things I want to stay put in front of the camera and NOT move around with the rest of the scene: stats/info, text, HUD type stuff, etc..
Unless, is it possible to overlay a transparent 2D viewport (to draw these text and objects onto) over my main, 3D viewport. I haven't been able to find info anywhere that says wether transparent and/or overlapping viewports is possible.
Yea, I'm kind of working on a project (hobby-type freeware network game thingy) using SDL & OpenGL. My goal is to learn as much about network and OpenGL programming as I can. I'd also like to see if I can get my little project to the point that I can throw it up on source-forge and be one of those cool open-source developer-type guys that chicks fawn over.
|
RhythmScore
iMac 27" Quad i5 | PMG4 2x867 (RhythmScore test server) | iPhone4
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Jan 2001
Status:
Offline
|
|
No need for viewports. To draw 3D + 2D + whatever else you want, you really only need a handful of functions. Research these:
glMatrixMode
glLoadIdentity
glPushMatrix / glPopMatrix
glOrtho / gluPerspective
P.S. Text in OpenGL is harder than you think (to do it right). Took me a while figure it out.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Oct 2001
Location: Colorado Springs
Status:
Offline
|
|
Originally posted by 00101001:
No need for viewports. To draw 3D + 2D + whatever else you want, you really only need a handful of functions. Research these:
glMatrixMode
glLoadIdentity
glPushMatrix / glPopMatrix
glOrtho / gluPerspective
P.S. Text in OpenGL is harder than you think (to do it right). Took me a while figure it out.
Right, the glPushMatrix and Pop basically allow you to different things to different matrices on the 'stack.' Yea, i'm starting to get a basic idea how I can do this now. Before long I'll be an OpenGL stud.
I'm using freetype + FTGL for the text, makes it not so hard. I've been able to make a decent main menu/title screen so far, using glOrtho to generate a 2D display, creating a large plane the size of the screen and mapping my background pic on it, then displaying the Title and menu options using FTGL.
SDL handles the mouse and keyboard input to select the options. I'm going to get into the SDL_net extension library (claims to support TCP and UDP, I'm thinking I'm going to need both to do what I want) to do the network stuff.
|
RhythmScore
iMac 27" Quad i5 | PMG4 2x867 (RhythmScore test server) | iPhone4
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Jan 2001
Status:
Offline
|
|
pfft... open source is cheating
One day, when you decide to grow some glPubicHair, get the bezier path from the NSGlyph yourself and use a home-brewed delaunay triangulation algorithm written in machine-code for tesselation.
Then, and only then will you be hardcore, and I'll send some of my Cocoa groupies over to your place to play.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|