Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Pure OpenGL 2D texture binding in processing 2.0

$
0
0
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():
  1. size( 1280, 768, OPENGL);
  2. // then opengl stuff...
  3. resource = loadImage( "/.../texture.png" );
  4. resource.loadPixels(); << this seems to be important for the magic trick

Then, in draw():
  1. gl.glEnable( gl.GL_TEXTURE_2D );
  2. 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.

Viewing all articles
Browse latest Browse all 1768

Trending Articles