Hi, I'm trying to find a way to get each vertex in a VBO to send individual uniform values to a connected shader. I was thinking it might be possible to send these through an unused table... or maybe a 5th table could be created (length given with msg) to be referenced by the shaders?
I have no idea is this is practical or possible within GEM setup, but if it is - any interest in adding this function?
Le 24/08/2014 21:55, j-p a écrit :
Hi, I'm trying to find a way to get each vertex in a VBO to send individual uniform values to a connected shader. I was thinking it might be possible to send these through an unused table... or maybe a 5th table could be created (length given with msg) to be referenced by the shaders?
I have no idea is this is practical or possible within GEM setup, but if it is - any interest in adding this function?
GEM-dev mailing list GEM-dev@lists.iem.at http://lists.puredata.info/listinfo/gem-dev
Hello,
You can't pass individual uniform values to each vertex. I guess you try to pass individual values to each vertex. For this purpose, you can use attribute variables. You are limited with the VBO object of Gem to use "build-in" vertex attributes : position, color, texture, normal. If you want to pass individual values to vertex, use one of this "build-in" vertex attribute that you don't use and get the attribute in your vertex shader. ++
Jack
Right - attribute not uniform. The texture table is a good candidate for non-texture VBOs - 8 parameters from the UV coordinates. Otherwise probably the color table? (4) - as color is usually determined in the shader or from the texture itself?
On Sun, Aug 24, 2014 at 4:22 PM, Jack jack@rybn.org wrote:
Le 24/08/2014 21:55, j-p a écrit :
Hi, I'm trying to find a way to get each vertex in a VBO to send individual uniform values to a connected shader. I was thinking it might be possible to send these through an unused table... or maybe a 5th table could be created (length given with msg) to be referenced by the shaders?
I have no idea is this is practical or possible within GEM setup, but if it is - any interest in adding this function?
GEM-dev mailing listGEM-dev@lists.iem.athttp://lists.puredata.info/listinfo/gem-dev
Hello,
You can't pass individual uniform values to each vertex. I guess you try to pass individual values to each vertex. For this purpose, you can use attribute variables. You are limited with the VBO object of Gem to use "build-in" vertex attributes : position, color, texture, normal. If you want to pass individual values to vertex, use one of this "build-in" vertex attribute that you don't use and get the attribute in your vertex shader. ++
Jack
GEM-dev mailing list GEM-dev@lists.iem.at http://lists.puredata.info/listinfo/gem-dev
Le 24/08/2014 22:52, j-p a écrit :
Right - attribute not uniform. The texture table is a good candidate for non-texture VBOs - 8 parameters from the UV coordinates. Otherwise probably the color table? (4) - as color is usually determined in the shader or from the texture itself?
If you want to use texcoord from table, according to the help file about [gemvertexbuffer], you can send only 2 values : textureU and textureV. With color from table you can send 4 values (R G B A). Color can be determined in the shader, and you can get it with gl_Color (vec4 for R G B A). But maybe i don't understand your last question correctly ? ++
Jack
On Sun, Aug 24, 2014 at 4:22 PM, Jack <jack@rybn.org mailto:jack@rybn.org> wrote:
Le 24/08/2014 21:55, j-p a écrit :
Hi, I'm trying to find a way to get each vertex in a VBO to send individual uniform values to a connected shader. I was thinking it might be possible to send these through an unused table... or maybe a 5th table could be created (length given with msg) to be referenced by the shaders? I have no idea is this is practical or possible within GEM setup, but if it is - any interest in adding this function? _______________________________________________ GEM-dev mailing list GEM-dev@lists.iem.at <mailto:GEM-dev@lists.iem.at> http://lists.puredata.info/listinfo/gem-dev
Hello, You can't pass individual uniform values to each vertex. I guess you try to pass individual values to each vertex. For this purpose, you can use attribute variables. You are limited with the VBO object of Gem to use "build-in" vertex attributes : position, color, texture, normal. If you want to pass individual values to vertex, use one of this "build-in" vertex attribute that you don't use and get the attribute in your vertex shader. ++ Jack _______________________________________________ GEM-dev mailing list GEM-dev@lists.iem.at <mailto:GEM-dev@lists.iem.at> http://lists.puredata.info/listinfo/gem-dev
GEM-dev mailing list GEM-dev@lists.iem.at http://lists.puredata.info/listinfo/gem-dev
Yah it's really only 2 values for UV. In error I was referring to my project - 8 is the total for the 4 sets composing a quad. Looks like it will be constricting either way... and then in other cases pos/tex/color/normal will all be needed. 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.
On Mon, Aug 25, 2014 at 5:56 AM, Jack jack@rybn.org wrote:
Le 24/08/2014 22:52, j-p a écrit :
Right - attribute not uniform. The texture table is a good candidate for non-texture VBOs - 8 parameters from the UV coordinates. Otherwise probably the color table? (4) - as color is usually determined in the shader or from the texture itself?
If you want to use texcoord from table, according to the help file about [gemvertexbuffer], you can send only 2 values : textureU and textureV. With color from table you can send 4 values (R G B A). Color can be determined in the shader, and you can get it with gl_Color (vec4 for R G B A). But maybe i don't understand your last question correctly ? ++
Jack
On Sun, Aug 24, 2014 at 4:22 PM, Jack jack@rybn.org wrote:
Le 24/08/2014 21:55, j-p a écrit :
Hi, I'm trying to find a way to get each vertex in a VBO to send individual uniform values to a connected shader. I was thinking it might be possible to send these through an unused table... or maybe a 5th table could be created (length given with msg) to be referenced by the shaders?
I have no idea is this is practical or possible within GEM setup, but if it is - any interest in adding this function?
GEM-dev mailing listGEM-dev@lists.iem.athttp://lists.puredata.info/listinfo/gem-dev
Hello,
You can't pass individual uniform values to each vertex. I guess you try to pass individual values to each vertex. For this purpose, you can use attribute variables. You are limited with the VBO object of Gem to use "build-in" vertex attributes : position, color, texture, normal. If you want to pass individual values to vertex, use one of this "build-in" vertex attribute that you don't use and get the attribute in your vertex shader. ++
Jack
GEM-dev mailing list GEM-dev@lists.iem.at http://lists.puredata.info/listinfo/gem-dev
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
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 list GEM-dev@lists.iem.at http://lists.puredata.info/listinfo/gem-dev
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
(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
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
Here is a working example. If it succeeds, you should see four quads with unique shader qualities.
I'm happy with the design but it needs further changes - for example - I was unable to build a class object array without errors at the constructor stage. Right now there are 5 fixed vbos added for attributes - enough for the demo.
Also I think "uniform" types should be added.
On Thu, Aug 28, 2014 at 1:57 PM, j-p jptrkz@gmail.com wrote:
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
Ok - going to finish up with this last update.
Up to 16 attributes can be used now. All types are supported (float, vec2-4, mat2-4). All bugs/weird errors removed. Help file changes included.
Still no uniforms.. so as default, all variables for the frag shader need to be converted to "varying" in vert shader.
If anyone has any ideas to expand on this feel free to email. Thank you.
On Sat, Aug 30, 2014 at 11:27 PM, j-p jptrkz@gmail.com wrote:
Here is a working example. If it succeeds, you should see four quads with unique shader qualities.
I'm happy with the design but it needs further changes - for example - I was unable to build a class object array without errors at the constructor stage. Right now there are 5 fixed vbos added for attributes - enough for the demo.
Also I think "uniform" types should be added.
On Thu, Aug 28, 2014 at 1:57 PM, j-p jptrkz@gmail.com wrote:
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
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
On 2014-09-03 06:43, j-p wrote:
Ok - going to finish up with this last update.
Up to 16 attributes can be used now. All types are supported (float, vec2-4, mat2-4). All bugs/weird errors removed. Help file changes included.
thanks. would it be very complicated for you, to create a github pull request?
Still no uniforms.. so as default, all variables for the frag shader need to be converted to "varying" in vert shader.
why can't you just use a "uniform" in the fragment shader?
fgmad IOhannes
Uniforms can still be entered with messages to glsl program of course. I was trying to get them to send once-per-primitive from an array in gemvertexbuffer (which sends everything on each vertex). I believe there are objects in GL3.0 that can do this - but I'm using 2.0.
I'll look into making a pull request.
On Wed, Sep 3, 2014 at 6:24 AM, IOhannes m zmoelnig zmoelnig@iem.at wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
On 2014-09-03 06:43, j-p wrote:
Ok - going to finish up with this last update.
Up to 16 attributes can be used now. All types are supported (float, vec2-4, mat2-4). All bugs/weird errors removed. Help file changes included.
thanks. would it be very complicated for you, to create a github pull request?
Still no uniforms.. so as default, all variables for the frag shader need to be converted to "varying" in vert shader.
why can't you just use a "uniform" in the fragment shader?
fgmad IOhannes -----BEGIN PGP SIGNATURE----- Version: GnuPG v1
iQIcBAEBCAAGBQJUBuxdAAoJELZQGcR/ejb4lxcP/1rTOBFdlYzMDdmeESFuiGWq oVhpwP+n3kaN1Y06DFdhrTiVxcN9480YJ5gwD2Ey8RfSIvPtXyaHW81aSyF9WNqc sv8+nByYsiFTob40e1XerepP1nleRSRLpeFoBEhCJ0fU30qw511/MjJ99aVEZpHv gVqtkkyFufMiJio0zcaJ0Gk8Ph+uuqq6ufie0CTCBHqKvkyQ19uI31r8cEQaxvjT a9e5g+wnvXuclbbko7fGuigjxXrU863jxAMOSOdJIR0HMY9r6sIm4iDSPHtW3UZY vffszdofT8dHlucaPVw6Be4OMyosVk2t5BmVTamzou8rz6hbqMCLISteiR4eruQJ HoK1/SU6pxOFAO8qKlAPZ9eAK4P8SL5IXQYmpwdEfMw9QNS/ggXRTjB8DetXyIBH qYdIJGZVcjPJQA3X5xfNjd5miugdxWd/zgDmqJfEWFnwjnIswOsa1AAciQv9dd6g gGK1LfGd4g51pT38VNLtSblRRlYIh0OoOERFiihg65gkkCivbj8p9hDzsK2RUnr0 naz88mYCxyFjimHm6uHznTTeKcCuKpWVpOJ5FSL+MiD3CS8DElRdS1JAl1eJZ7mF V89gIZQFrgv38tA/9Wfl7nbu/1q4Wt1+6L03toPtjF11rISYpklipRX7NHpTaIdP Ximw485he7Z6XyrdbJMZ =wzSs -----END PGP SIGNATURE-----
GEM-dev mailing list GEM-dev@lists.iem.at http://lists.puredata.info/listinfo/gem-dev