Skip to content

Specifying attribute layout for AttributeBuffer #13

@axel22

Description

@axel22

Currently the AttributeBuffer's render method takes an array of tuples to specify the layout of the attributes.

Maybe we should have a separate class for doing this, e.g. AttributeBuffer.Layout that takes a sequence of name and size tuples:

AttributeBuffer.Layout(
  "position" -> 3, // or even some datatype describing vec3, at some point
  "normal" -> 3,
  "textureCoord" -> 2
)

This layout should be the constructor parameter for the AttributeBuffer.

When the buffer is used with a particular shader, which attributes are used should be specified explictily:

// cached somewhere
val myShaderAttributes = List("position", "textureCoord")

// during rendering
buffer.render(mode, myShaderAttributes)

From the myShaderAttributes list and the Layout, the render call should set the appropriate attribute buffer pointers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions