简体   繁体   中英

Is there a way to get the rotated texture on OpenGL

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?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM