Hey All, I’m fairly new to the openGL scene, and I’m having trouble getting a “camera” to work, and I’m hoping someone can help me out with this. The basic theory doesn’t seem too complicated after you think about it for a bit, but I’m obviously missing something.
Right now, I’m trying to write my own code based off 2 examples I have. First off, this helps me understand it better, second neither tutorial has the exact camera I want (RTS camera… should be easy for most of you :D).
I think I’m doing everything right, calculating the matrices out (modifying on keypress - haven’t even got to the mouse yet!). Passing them to the vertex shader to do the transformations, and… well, I get a screen that looks like glClear is the only thing that has been called. Now, it has to be in the world to camera matrix (honestly, I’m a bit lost with all that math!), because if I just use object to world matrix, it works great (except… I obviously can’t see much of the world). I know the code isn’t great (could use more objects, could take advantage of the matrix stack etc., but I’m trying to keep it simple for learning purposes. Anyway, here’s the code:
I’d really appreciate any help and advice anyone could provide.
One other thing… the example most of this is based on says not to provide the vertex shader with a model to world matrix, but use a model to camera matrix (due to problems with division on really far clip values… too close to 0 I think). Unfortunately, this wasn’t expanded on much, and leaves me confused. How are you supposed to position objects correctly relative to each other without the model to world matrix?