tane,
thanks for testing it out for me, now i know it works on macs =)
1. the error in the GLSL example. it seems weird to me. it fails in compiling the vertex shader for the error you showed to me. maybe you can try something.
in the "simplevertex.glsl" change the line
gl_Position = ftransform();
to:
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
ftransform will or is dead already, so that might fix it. if it does i still find it weird since it works here. anyway i can't be sure of anything when talking about macs.
2. as for your program, the way you create the opengl textures is wrong. you shouldn't create a new texture for every frame, you should be updating the texture instead.
i send you your example here now working. it uses JMyron instead since i don't have VDIG installed, but its easy for you to get back to processing Capture =)
www.pixelnerve.com/temp/test0.zipnow,
what did i do/change
in setup, first you need to create a new opengl texture:
Code:
tex = new VTexture();
tex.createGL( 320, 240 ); // dimensions
in mainloop get data from camera and update the texture:
Code:
m.update(); // get image from jmyron
int[] imgtmp = m.image(); // just saving an array
tex.update( imgtmp ); // update texture with new data
this is the new method i added to the Texture class. it already had an update() method which worked with an internal array. this just lets you pass the array you want.
Code:// Update a texture with give data. The dimensions of the pixels should be the same from the texture
void update( int[] pixels )
{
_gl.glBindTexture( GL.GL_TEXTURE_2D, _id );
_gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, 1 );
_gl.glTexSubImage2D( GL.GL_TEXTURE_2D, 0, 0, 0, _width, _height, GL.GL_BGRA, GL.GL_UNSIGNED_BYTE, IntBuffer.wrap(pixels) );
_gl.glBindTexture( GL.GL_TEXTURE_2D, 0 );
}
have fun.