小编use*_*496的帖子

关于使用 gl_luminance 的 glteximage2d 的谜题

我遇到了一些关于使用 gl_luminance 定义 FBO 的问题。这是我使用的代码,

 generateRenderToTexture(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, _maskTexture, _imageWidth, _imageHeight, false);
Run Code Online (Sandbox Code Playgroud)

相关代码如下,

TextureBuffer _maskTexture;

class TextureBuffer {
public:
GLuint texture;
GLuint frameBuffer;
GLenum internalformat;
GLenum format;
GLenum type;
int    w,h;

TextureBuffer() : texture(0), frameBuffer(0) {}
void release() 
{
    if(texture)
    {
        glDeleteTextures(1, &texture);
        texture = 0;
    }
    if(frameBuffer)
    {
        glDeleteFramebuffers(1, &frameBuffer);
        frameBuffer = 0;
    }

}
};

void generateRenderToTexture(GLint internalformat, GLenum format, GLenum type,
                                     TextureBuffer &tb, int w, int h, bool linearInterp)
{
    glGenTextures(1, &tb.texture);
    glBindTexture(GL_TEXTURE_2D, tb.texture);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); …
Run Code Online (Sandbox Code Playgroud)

opengl-es glteximage2d opengl-es-2.0

2
推荐指数
1
解决办法
3357
查看次数

标签 统计

glteximage2d ×1

opengl-es ×1

opengl-es-2.0 ×1