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

Refactor PShapeOpenGL #1623

Open
codeanticode opened this issue Feb 11, 2013 · 6 comments
Open

Refactor PShapeOpenGL #1623

codeanticode opened this issue Feb 11, 2013 · 6 comments

Comments

@codeanticode
Copy link
Member

So all the VBO code goes a into a Cache object, like Texture does for PImage.

@ghost ghost assigned codeanticode Feb 11, 2013
@codeanticode
Copy link
Member Author

@benfry I will start working on this after 2.1 final is out, feel free to add any notes/comments/suggestions you think are relevant.

@codeanticode
Copy link
Member Author

This refactoring could also be an opportunity to reduce the memory footprint of PShapeOpenGL:

http://forum.processing.org/two/discussion/1071/point-clouds-in-processing-2-1-with-opengl#Item_2

@kosowski
Copy link

I think it would be interesting to have some kind of basic PShape, something closer to GlGraphics GlModel, where the flexibility of PShape is traded for GlModel’s performance.

I would like to move some ongoing projects to Processing 2, but without lowering the number of vertices used. Dealing with the arrays in order to modify vertex properties is worth the performance difference for me.

@codeanticode
Copy link
Member Author

Something else to keep in mind, not necessarily for 3.x but maybe for a later time, is the support of generic vertex attributes. Right now the vertex attributes are hard-coded in the renderer to be position, color, normal, texture coordinates, ambient, specular and emissive colors, and shininess, as a legacy of the fixed-function pipeline in 1.x. In the programmable pipeline that now Processing uses, one can assign arbitrary parameters to each vertex, i.e. instead of position, or color, or any of the others we support, a shader can take its own variables, like, say, "fuzziness".

So eventually we'd implement this something like:

sh = createShape();
sh.beginShape();

sh.fill(203, 100, 44);
sh.attrib("fuzziness", 0.5);
sh.vertex(40, 30, 20);

sh.fill(200, 141, 100);
sh.attrib("fuzziness", 0.4);
sh.vertex(30, 20 30);

// .. and so on

sh.endShape(); 

Implemented in #2963

@codeanticode
Copy link
Member Author

As part of this, I will combine VertexBuffer with PGraphicsOpenGL.VertexAttribute.

@benfry
Copy link
Contributor

benfry commented Sep 4, 2015

FWIW, I think this is post-3.0, unless there's something serious that's being fixed here. It's not pretty at the moment, but it's not like people are raiding the castle demanding a cleaner internal design for PShapeOpenGL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants