OpenGL Get Rotated X and Y of quad

Posted by matejkramny on Game Development See other posts from Game Development or by matejkramny
Published on 2012-10-04T22:22:28Z Indexed on 2012/10/05 3:52 UTC
Read the original article Hit count: 249

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.

© Game Development or respective owner

Related posts about opengl

Related posts about java