[GEM-dev] GemVertexBuffer + Shader

j-p jptrkz at gmail.com
Wed Sep 3 06:43:12 CEST 2014


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 at 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 at 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 at 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 at 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 at 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 at lists.iem.athttp://lists.puredata.info/listinfo/gem-dev
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> GEM-dev mailing list
>>>>> GEM-dev at lists.iem.at
>>>>> http://lists.puredata.info/listinfo/gem-dev
>>>>>
>>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/gem-dev/attachments/20140903/81f63230/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vbo_shaderII.zip
Type: application/zip
Size: 64435 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/gem-dev/attachments/20140903/81f63230/attachment-0001.zip>


More information about the GEM-dev mailing list