The Camera classes are designed to try and hide all of the maths behind calculating the projection of vertices in space. They're pretty much there for the Layman to use. I personally find it easier to use the Camera classes even though I understand the maths behind 3D projection transformation, simply because they do all the necessary calculations for you.

I'm not sure what you mean. The Camera class holds a view and a projection matrix. The view matrix is the combined translation, rotation and scale transformation whereas the projection matrix is set to the orthographic projection matrix.

So I have been experimenting with the Ortho-something-Camera and I cant get the behavior I want.

For example, when I render a sprite at position 0,0, it should be rendered at the top left corner. But thats not the case here.Furthermore, when I increase the y-variable, the entity moves up. It should move down.

I'm not sure what you mean. The Camera class holds a view and a projection matrix. The view matrix is the combined translation, rotation and scale transformation whereas the projection matrix is set to the orthographic projection matrix.

Pojhan claimed that you could make a moving 2D camera with just the translate and rotate functions. This is enough for the view matrix but the perspective matrix can not be done this way. That is all I meant.

"You have to want it more than you want to breath, then you will be successful"

So I have been experimenting with the Ortho-something-Camera and I cant get the behavior I want.

For example, when I render a sprite at position 0,0, it should be rendered at the top left corner. But thats not the case here.Furthermore, when I increase the y-variable, the entity moves up. It should move down.

The coordinate system is specified by the projection matrix.In the case of 2D Orthographic projection this means, it tells:

Where is the origin located on the screen? (middle, topleft, or topright?)In which direction do x (and especially) y values increase? (Y up / Y down, X up / X down?)What is the ration between OpenGL coords and pixel values? (1:1? (standard: 800, 600 is top right edge on a 800, 600 window), Box2D: 1 : 32 pixel? (32 pixel are 1 Box2D Meter))

Especially zooming and similar are abstracted away by the OrthographicCamera, too (with that I mean zooming with the center being the pivot point).

If you want to set the coordinate system to Y-down then you can simply call setToOrtho(true) when you create the camera, or you can change the up vector to (0, -1, 0) and the direction vector to (0, 0, 1), which is pretty much what that method does (note that you have to call update to recalculate the matrices).

If you want to set the coordinate system to Y-down then you can simply call setToOrtho(true) when you create the camera, or you can change the up vector to (0, -1, 0) and the direction vector to (0, 0, 1), which is pretty much what that method does (note that you have to call update to recalculate the matrices).

Well, that did not work. The X position is correct now but the Y is still way of. Plus, the image is up side down now :O

I'm not sure what you mean. The Camera class holds a view and a projection matrix. The view matrix is the combined translation, rotation and scale transformation whereas the projection matrix is set to the orthographic projection matrix.

I'm not sure what you mean. The Camera class holds a view and a projection matrix. The view matrix is the combined translation, rotation and scale transformation whereas the projection matrix is set to the orthographic projection matrix.

Just to note here that View matrix is inverse of camera transformation.

And to explain why, it's because when you're transforming the camera, you're actually transforming the vertices of all the meshes in the "world" (in space). The camera does not exist, it's simply an object that calculates and holds the matrices which describe the transformation of vertices. Matrices are used since they simplify the calculations that are needed to describe a transformation. When you want to translate "the camera" on the X axis +100px, you're actually wanting to transform all the vertices that are drawn in the world -100px.

Camera is real object in same sense than anything else. You can use all the same code for calculating its transform than for rest of objects. But then you just calculate view matrix by taking the inverse of its transform matrix.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org