I am trying to make a 2D game and I need to know how to find/calculate/define the edges of my screen. Aka: I want to know how big to make my triangles so the textures aren’t warped and that a pixel on the texture is it’s own single pixel on the screen.
I dont care how to determine this, other than brute forcing it (such as creating a triangle, and if it’s too small, increase the length/width by .001 to see if it made a difference). So, if there’s a function I could use to declare that i want the left edge of the screen to be -10, the right edge to be 10, the top edge to be 4 and the bottom edge to be -4, i’d be happy.
Things to note: I am planning on using an orthographic perspective, if that helps at all.
First of all, let me mention that I do not understand what glViewport does. I’m new to OpenGL and the descriptions I am recieving is only confusing me because it’s using terms that I do not understand.
I want to know where the edges of the screen are in terms of x,y, and z. Let’s just say that the camera is facing 0,0,0 at 0,0,-1. Now, in an orthographic projection (if I used the right word, it should mean that objects that are further away do not decrease in size) the edges of the screen should have the same x and y coordinates no matter what z value they have. How do I find what these values are without creating a square and expand it and expand it and expand it until I think it starts displaying off the screen?
Is there a way for me to declare that I want those edges to be at -10 to 10 width wise and -8 to 8 height wise? If not, how could I calculate what the coordinates of the screen edges are?
EDIT:
AHH!! I see now! It glOrtho() does it! Thank you for helping me!
At this point, screen coordinate (0,0) is the lower left corner and coordinate (screenwidth_inpixels, screenheight_inpixels) is the upper right corner.