Search code examples
javaopengllwjgl

glOrtho equivalent to VBO's


I am trying to port a ClickTeam Fusion game to Java using LWJGL. I decided to simply use pixel measurements as everything in this game is done using PNG files, even animations (Yes, really). And I have heard of the function called glOrtho() which is supposed to let you set how things are drawn in OpenGL.

While I managed to get this working with functions like glVertexf(), those functions including glOrtho() are deprecated and if I am correct completely removed in OpenGL 3.1. So, I am using the modern way of doing it which is using VBO's, Indices, Shaders, etc. Is there any way to accomplish glOrtho()'s effect using a VBO?

If you need me to, I can upload the current code I have here as well; just leave a comment and I will update the post with the current code I have.


Solution

  • For OpenGL >= 3.1 you need to define your own matrices. There are some libs that defined them for you. GLM, to name a famous one.

    glOrtho matrix defintion can be found here: https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glOrtho.xml

    glOrtho is not an "effect", but a way to project things onto the screen. Ortho refers to "orthogonal", which means "no perspective".