Ok figured it out - have a working link between shader and gemvertexbuffer. Will send a full 1st draft cpp/h sometime in next two weeks hopefully.
On Wed, Aug 27, 2014 at 2:19 PM, j-p jptrkz@gmail.com wrote:
(follow up)
Below is the test setup for a user-defined attribute in gemvertexbuffer.cpp: (m_shader is the 5th vbo for test, attribute index is set to 0) (just for this test I have set the program parameter in "glBindAttribLocation" to "1" because of this output when a glsl_program is linked with vert/frag shaders for the first time: "[glsl_program]: linked shaders 4 2: 1")
code:
if(m_shader.render()) { glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, 0); // index, size, etc etc glEnableVertexAttribArray(0); // index glBindAttribLocation(1, 0, "gemAttrib1"); // program, index, attribute }
I use "gemAttrib1" to set the fragColor but it's not working.
vert file:
attribute vec4 gemAttrib1; varying vec4 color1;
void main() { color1 = gemAttrib1; gl_Position = ftransform(); }
frag file:
varying vec4 color1; void main() { gl_FragColor = color1; }
On Tue, Aug 26, 2014 at 11:48 PM, j-p jptrkz@gmail.com wrote:
Had a dummy vec4 using glVertexAttribPointer ready to test before realizing there's no way to send the values over to the shader without the "program" parameter. Could the right outlet of glsl_program (the one that sends out the ID number) work for this?
On Mon, Aug 25, 2014 at 11:23 AM, Jack jack@rybn.org wrote:
Would be very nice ! ++
Jack
Le 25/08/2014 17:10, IOhannes m zmölnig a écrit :
On 08/25/2014 03:49 PM, j-p wrote:
I think at some point I'll attempt a mod for gemvertexbuffer to add user-defined attributes that can be passed to the vertex-shader.
yes, that would be great.
gfmadsr IOhannes
GEM-dev mailing listGEM-dev@lists.iem.athttp://lists.puredata.info/listinfo/gem-dev
GEM-dev mailing list GEM-dev@lists.iem.at http://lists.puredata.info/listinfo/gem-dev