Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualstefthedrummer

Posted 30 June 2013 - 03:35 PM

Hey Guys,
 
I'm trying to bind a specific Level of an offscreen-render-texture to let's say texture target 0.
 
Now the default way of binding a texture doesn't allow that, so this is my workaround.
It's ugly, inconsistent and I don't like it.
 

public void bind(int textureId) {
    glActiveTexture(GL_TEXTURE0 + textureId);
    glBindTexture(GL_TEXTURE_2D, textureHandle);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, baseLevel);
} 

So I found this function "glBindImageTexture", which I still dont' understand.
 

public void bind(int textureId, int level) {
    glBindImageTexture(textureId, textureHandle, level, false, 0, GL_READ_ONLY, GL_RGBA32F);
}

 
 Is this what I want? Do I use it right? Also I can't use formats like GL_RGB32F - without the Alpha channel.
All I get is a grey Rect, when I render this texture with "glBindImageTexture".


#1stefthedrummer

Posted 30 June 2013 - 03:35 PM

Hay Guys,
 
I'm trying to bind a specific Level of an offscreen-render-texture to let's say texture target 0.
 
Now the default way of binding a texture doesn't allow that, so this is my workaround.
It's ugly, inconsistent and I don't like it.
 

public void bind(int textureId) {
    glActiveTexture(GL_TEXTURE0 + textureId);
    glBindTexture(GL_TEXTURE_2D, textureHandle);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, baseLevel);
} 

So I found this function "glBindImageTexture", which I still dont' understand.
 

public void bind(int textureId, int level) {
    glBindImageTexture(textureId, textureHandle, level, false, 0, GL_READ_ONLY, GL_RGBA32F);
}

 
 Is this what I want? Do I use it right? Also I can't use formats like GL_RGB32F - without the Alpha channel.
All I get is a grey Rect, when I render this texture with "glBindImageTexture".


PARTNERS