OpenGL Ortho view question

Started by Schmidget, August 11, 2009, 22:22:38

Previous topic - Next topic

Schmidget

I've been working on my 2D generic game engine/framework wrapping lwjgl and FMOD, and last night, I had an idea of a possible way to implement a very simple camera of sorts by just calling glTranslatef() with some coordinates before anything gets rendered.  I just tried that out, and due to complete ignorance of the way OpenGL actually works, I now see that that doesn't exactly work.  I was wondering if, with a setting or two, this kind of thing might work.  For java2D, my method of moving a camera about a scene involved passing a camera object to every renderable game object, then altering the position of the object by some values the camera object contained.  It's kind of a pain to do that.


Here are a few screen shots showing what's going on. I'm moving the "camera" to the right.

To give you an idea of what is being drawn, I drew some curvy lines to an FBO.  This FBO then draws itself on itself (you get the idea) with a simple blur shader active.  The lines are then redrawn to the screen, then that blurry FBO is placed on top with a different blendmode to make them glow.  Upon moving the "camera", each drawing call seems to separate visually as if there is still an active depth going on.  Mind you, all drawing routines are taking place at 0f on the z axis. I was really hoping the drawing calls would simply be translated the by the same amount as dictated by the glTranslatef call.  Any ideas?  And remember, I don't know what I'm doing.  ;)

Fool Running

What you're trying to do should work. From the look of the screenshots, it looks like it does, indeed, work. I assume the problem you are asking about is what looks like a "double" image? If that's the case it looks like there is something wrong with the way you are using your FBO. Are you clearing the FBO each frame?
Also, you might try not drawing the FBO to itself (i.e. skip that step, and just draw the FBO to the screen) and see if it looks better.
Another thing to check is to make sure you aren't doing the translate between the drawing to the FBO and the drawing of the curvy lines.

Other then that I'm out of ideas. ;D
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D