How to define a new VertexAttribute ?

Hello !

To create an effect, I need some extra values associated to each vertex, then I would like to define an extra vertexAttributes with my values stored inside.

I saw the LowLevelShader example. It works but if I follow that exemple, it needs to define every vertexAttributes by myself and that's not what I want... I would like to add a custom vertex attribute to the "vertexAttribute-list" not to create all the list...

How can I do that ?

If there is no solution, it's possible to "hack" Processing structure and use "tint" or "normal" to send some values to the shader, but it's really not my favorite solution :)

Thanks !


  • edited April 2015

    Processing has a class called PGL, which focuses more in-depth on OpenGL than PGraphics does (what you would normally use). You use it like so, following the PGL javadoc:

    PGL pgl; //Processing-OpenGL abstraction class
    void setup() {
      size(300, 300, P3D);
      PGraphicsOpenGL pg = (PGraphicsOpenGL) g;
      pgl = pg.beginPGL();
    void draw() {
      //Your PGL commands below
      pgl.clear(pgl.COLOR_BUFFER_BIT | pgl.DEPTH_BUFFER_BIT);

    From here, you can do anything (within OpenGL limits) shown in the doc. You don't seem to have to do anything else, though I could be wrong.

    To prove things work, try adding/removing pgl.COLOR_BUFFER_BIT | from pgl.clear(). Everything else can be deduced from the PGL doc.

  • Thank you for your message, but I don't want to clear the processing buffers, I want to create an additional buffers to the existing ones

  • I gave you a link to the Javadoc. In case it isn't noticeable, here it is again:

    Like I said, this contains everything you should need, but I can't help you beyond this.

  • edited April 2015

    "I think I should just stop before I cause too much damage."

    The more I read your question, the more I realize how true that statement is. Ignore everything I've said in my past 2 comments. I truly can't help you, and I'm not sure why I thought I could. Sorry. :-/

  • no problem, thanks for your interest :)

Sign In or Register to comment.