简体   繁体   English

有没有办法在OpenGL上获得旋转的纹理

[英]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); 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. 我想创建一个矩阵,其中的数据是要实现像素完美碰撞的对象,该矩阵将是使用shift的位矩阵,但是我将旋转添加到图像中,所以我想知道是否有一种方法可以从opengl获得旋转的纹理矩阵。

If i use the glGetTexImage(GL_TEXTURE_2D, 1, GL_RGBA, GL_UNSIGNED_BYTE , pxData); 如果我使用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? 它向我返回纹理,但是如果我想获得X旋转度的四边形上的纹理将如何?

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],然后读取该纹理。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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