Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gemvertexbuffer_shader #54

Closed
wants to merge 3 commits into from
Closed

gemvertexbuffer_shader #54

wants to merge 3 commits into from

Conversation

jptrkz
Copy link
Contributor

@jptrkz jptrkz commented Sep 8, 2014

One big change since the gem-dev discussion - the switch from object array of size16 to std::vector dynamic array. Commit 21bbaba has a further description. Msgs to gemvertexbuffer are:

program (float)
reset_attributes
clear_attributes
attribute_enable (bool)
attribute (name, array)

Adds a dynamic std::vector object array for GLSL attribute variables.

NOTE - an error with a "reset_attributes" msg.  The console gives "GL: invalid enumerant".  I am unable to find where this occurs.

The vector array changes in size as new variables are added.  If a variable already exists as a VBO, the pd-msg updates the attribute with the pd-table provided.  If the vert/frag file is changed (the type of an attribute for example) the attribute array in gemvertexbuffer can be reset with a pd-msg and refilled.

Note that the end of the attribute() function resizes and re-copies the array of all attributes  Otherwise, the changes are not visible until the msgs are sent a 2nd time.

The aim in creating these extra VBOs is to give *each* geo-primitive in gemvertexbuffer the full potential of all permutations of the shader's parameters.  Up until now, the variables changed with pd-msgs affected *all* geo-primitives in the gemvertexbuffer the same.  This removes the need for multiple instances of glsl_program and gemvertexbuffer for small changes of a shader.
This method is almost perfect.  The only drawback is that the "uniform" parameter does not have it's equivalent to glVertexAttribPointer and cannot be set-up like the built-in and generic attributes (uniforms are once per primitive).  If a user wants to have each uniform variable different for each primitive, these uniform variables must changed to attributes in the vert/frag files.  This is a bit awkward since all variables intended to be used only for the frag file must be defined and then converted to "varying" in the vert file.  

The glsl_program still takes uniform pd-msgs, but this will affect *all* primitives.
@jptrkz jptrkz closed this Sep 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant