OpenGL Get Rotated X and Y of quad
- by matejkramny
I am developing a game in 2D using LWJGL library.
So far I have a rotating box. I have done basic Rectangle collision, but it doesn't work for rotated rectangles.
Does OpenGL have a function that returns the vertices of rotated rectangle? Or is there another way of doing this using trigonometry?
I had researched how to do this and everything I found was using some matrix that I don't understand so I am asking if there is another way of doing this.
For clarification, I am trying to find out the true (rotated) X,Y of each point of the rectangle. Let's say, the first point of a rectangle (top,left) has x=10 y=10.. Width and height is 100 pixels. When I rotate the rectangle using glRotatef() the x and y stay the same. The rotation is happening inside OpenGL. I need to extract the x,y of the rectangle so I can detect collisions properly.