We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › GLSL vertex attribute array usage in Processing
Page Index Toggle Pages: 1
GLSL vertex attribute array usage in Processing (Read 611 times)
GLSL vertex attribute array usage in Processing
May 12th, 2008, 9:35pm
 
I've started writing my own glsl shaders to use in processing and haven't really had any problems until now.  I'm tryng to use a vertex attribute array, which is pretty easy in c++.  You just create an array and have a pointer point to it using:

glVertexAttribPointer()

The problem is that this method accepts a pointer to an array as one of it's arguments… Java/processing don't use pointers.  So how do I pass an array into my shader?
Re: GLSL vertex attribute array usage in Processin
Reply #1 - May 15th, 2008, 5:14am
 
wow 44 views no replies... no worries answered my own question the problem was i was using GL.GL_FALSE as a boolean argument instead of false, it had nothing to do with pointers.  I doubt anyone will need this but you never know, it would have saved me a couple of days of screwing around:

float [] test = new float[]{0,4,204,21};
fbtest = ByteBuffer.allocateDirect(4*test.length).order(ByteOrder.nativeOrder()).asFloatB
uffer();
fbtest.put(test);
fbtest.rewind();
gl.glVertexAttribPointer(1,fbtest.capacity(),GL.GL_FLOAT,false,0,fbtest);
Page Index Toggle Pages: 1