Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Warning about gl_InstanceID and uniform block (buffer?) object fields #136

Open
@ibsusu

Description

Hello,

I've been doing some research about uniform block objects and instancing with OGL. Right now Geometry raises a warning for anything that's contained inside of a uniform block object. It also raises a warning for gl_InstanceID.

attribute vec3 position;
attribute vec3 offset;
uniform Group {
 uniform vec3 groupPos[10];
 uniform vec3 groupRotation[10];
};
void main() {
 vec3 pos = position;
 pos += groupPosition[gl_InstanceID]+ offset + groupRotation[gl_InstanceID];
 gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);
}

Secondly, on this line right here:

if (attr.needsUpdate) this.updateAttribute(attr);

It chokes on gl_InstanceID. I just did a check to see if it's that name and bail out if it is.

If I make a PR that provided better support for instancing and Uniform Block Objects would that be ok? The reason I'm interested in doing it this way is because I can get really good performance and modify groups of instances of different geometries with a single change. BTW this code won't work on Firefox atm. Firefox doesn't support vectors in uniform block objects for some reason. uniform vec3 groupPos[10];. Safari and Chrome are fine though.

If there's another way to do this let me know please.

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

        AltStyle によって変換されたページ (->オリジナル) /