Jump to content
  • Advertisement
Sign in to follow this  
TheSteve

OpenGL Camera Class Woes and Questions

This topic is 4783 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm not sure if this post belongs here or in the OpenGL section, but here it goes anyhow. I'm currently trying to design a Camera Class from the ground up that would be able to look around the scene a-la a Quake-esk style view. From what I've read, I believe that I'm going to have to use Quaternations and don't really find the math to be especially challenging. That said, I do have some fundamental hang-ups when it comes to getting necessary view positions and vectors. Consider this article: http://www.gamedev.net/reference/programming/features/quatcam/ The concept is heavily reliant upon getting a view vector. Unfortunately, I don't really understand how you can "get" a view vector. If I'm not mistaken, it's the current position of your perspective matrix? Is that right? Moreover, it's also reliant upon using glulookat, which I don't believe is the hard core way to do it. Could someone fundamentally explain/verify: 1) What method you'd use to look around like you would in quake/doom 3/fear/etc? 2) How you establish "where" you are looking from? 3) How to actually get OpenGL to render from that location (glulookat?) 4) Where I can find some good resources on the method? I'm sure there are more questions that I left out, but I'm sure they'll come to me as the thread gets going. If I can get your help in this I'd like to make a very good tutorial on the whole subject.

Share this post


Link to post
Share on other sites
Advertisement
I hate to sound repetitive but, IMHO, quaternions are widely misunderstood. And then there are those who misunderstand the ways in which they are misunderstood! (But I won't get into that here :) Basically, you don't need quaternions for a simple FPS camera, and you might even be better off without them.

I'm going to repeat myself again, because it'll be much easier (and perhaps more effective) than writing a lengthy explanation of the concepts you asked about. A while ago I wrote a tutorial class that you can find in this thread. The class implements FPS character, FPS spectator, and 6DOF motion for both cameras and objects in OpenGL. (And not a quaternion in sight!) The only thing you need to supply is a vector class with basic functionality. The only gotcha is that the FPS modes assume a particular up axis (Y, IIRC), so you might have to make some adjustments for, say, Z up (which is common in FPSs). Anyway, maybe it'll be helpful to you, and I'll be happy to answer any questions you might have about the code.

Share this post


Link to post
Share on other sites
Jyk, you continually amaze me with how much butt you kick. Thanks man! I'll look over the code thoroughly before asking a question about it. But, you may hear from me soon!

Share this post


Link to post
Share on other sites
Quote:
Jyk, you continually amaze me with how much butt you kick. Thanks man!
Heh, well I don't know about the first part, but in any case you're welcome! :) I do think that particular class is useful, though. I use it all the time in my demo code for both cameras and objects and have never had a problem with it. Anyway, I hope it helps, and let me know if you have any questions.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!