Pure OpenGL 2D texture binding in processing 2.0
in
Core Library Questions
•
2 months ago
Hello,
I found a strange trick while trying to bind texture:
I'm loading an image ( and ONLY one, this will be important for the following ) in setup():
Then, in draw():
Surprise! The image can be used as texture!
I searched web and javadoc for hours, i didn't found any possibility to get the TextureID of the PImage!
@developpers: would it be possible to add a "getTextureID()" to PImage?
All the best.
I found a strange trick while trying to bind texture:
I'm loading an image ( and ONLY one, this will be important for the following ) in setup():
- size( 1280, 768, OPENGL);
- // then opengl stuff...
- resource = loadImage( "/.../texture.png" );
- resource.loadPixels(); << this seems to be important for the magic trick
Then, in draw():
- gl.glEnable( gl.GL_TEXTURE_2D );
- gl.glBindTexture( gl.GL_TEXTURE_2D, >> 1 << );
Surprise! The image can be used as texture!
I searched web and javadoc for hours, i didn't found any possibility to get the TextureID of the PImage!
@developpers: would it be possible to add a "getTextureID()" to PImage?
All the best.
1