2
votes

I'm trying to get the rotated texture "actually is the quad that is rotated". I'm able to get the Texture image with:

glGetTexImage(GL_TEXTURE_2D, 1, GL_RGBA, GL_UNSIGNED_BYTE , pxData);

I want to create an matrix with the data of where is an object to implement pixel perfect collision, this matrix will be an bit matrix using shift, but i will add rotation to my images, so i want to know if there is a way to get from the opengl the rotated texture matrix.

If i use the glGetTexImage(GL_TEXTURE_2D, 1, GL_RGBA, GL_UNSIGNED_BYTE , pxData); it returns to me the texture, but if i want to get how will be the texture on an quad with X degrees of rotation?

Is there a way to archive that?

1

1 Answers

3
votes

Rendering to a rotated quad does not rotate the actual source texture. What you probably want to do is render to a texture, see i.e. [1], and then read that texture.

[1] http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-14-render-to-texture/