mrfraggs

09-08-2013, 05:32 PM

Hey guys, new to the forums, also pretty new to OpenGL. How's everyone doing?

So, I've been learning some OpenGL on my own, and I feel like I've been making some progress. I'm using it for 2D graphics right now, so I set my perspective matrix to glm::ortho using the GLM math library. So, for arguments, ortho takes the starting point of the screen, and the width and height. While I was messing around with quads, I just had ortho set to -10 to 10 on both the x and y axis'. So now, I changed it to start at 0, 0, and have a width and height equal to the screen. Is that the proper way to set up and use the perspective matrix?

So, here's what it looks like so far. I'm just rendering blank quads right now. I set my ortho perspective to start at 0, 0, and have a size of 1280/720. Then, I create a quad that is of size 32x32. By that, I mean that I create 4 vertices, one at 0, 0, then I put the other vertices 32 units away. I use the term units instead of pixels because I believe that I am still working in OpenGLs NDC space (-1 to 1 ), just modified. My question is, is this the proper way to do this, or should I be calculating the screen coordinates (say, pixel location 300, 200) using an equation to put it in the -1 to 1 range that OpenGL uses?

Thanks for the help guys, I appreciate it! Just want to make sure what i'm doing is right so far :)

So, I've been learning some OpenGL on my own, and I feel like I've been making some progress. I'm using it for 2D graphics right now, so I set my perspective matrix to glm::ortho using the GLM math library. So, for arguments, ortho takes the starting point of the screen, and the width and height. While I was messing around with quads, I just had ortho set to -10 to 10 on both the x and y axis'. So now, I changed it to start at 0, 0, and have a width and height equal to the screen. Is that the proper way to set up and use the perspective matrix?

So, here's what it looks like so far. I'm just rendering blank quads right now. I set my ortho perspective to start at 0, 0, and have a size of 1280/720. Then, I create a quad that is of size 32x32. By that, I mean that I create 4 vertices, one at 0, 0, then I put the other vertices 32 units away. I use the term units instead of pixels because I believe that I am still working in OpenGLs NDC space (-1 to 1 ), just modified. My question is, is this the proper way to do this, or should I be calculating the screen coordinates (say, pixel location 300, 200) using an equation to put it in the -1 to 1 range that OpenGL uses?

Thanks for the help guys, I appreciate it! Just want to make sure what i'm doing is right so far :)