Commit 57340bc5 by andrewlewis Committed by tonihei

Fix gldemo

The GL program needs to be used before accessing its attributes.

#minor-release

PiperOrigin-RevId: 410768017
parent 0ba6e37f
...@@ -88,6 +88,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ...@@ -88,6 +88,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
} catch (IOException e) { } catch (IOException e) {
throw new IllegalStateException(e); throw new IllegalStateException(e);
} }
program.use();
GlUtil.Attribute[] attributes = program.getAttributes(); GlUtil.Attribute[] attributes = program.getAttributes();
for (GlUtil.Attribute attribute : attributes) { for (GlUtil.Attribute attribute : attributes) {
if (attribute.name.equals("a_position")) { if (attribute.name.equals("a_position")) {
...@@ -142,7 +143,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull; ...@@ -142,7 +143,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
// Run the shader program. // Run the shader program.
GlUtil.Uniform[] uniforms = checkNotNull(this.uniforms); GlUtil.Uniform[] uniforms = checkNotNull(this.uniforms);
GlUtil.Attribute[] attributes = checkNotNull(this.attributes); GlUtil.Attribute[] attributes = checkNotNull(this.attributes);
checkNotNull(program).use();
for (GlUtil.Uniform uniform : uniforms) { for (GlUtil.Uniform uniform : uniforms) {
switch (uniform.name) { switch (uniform.name) {
case "tex_sampler_0": case "tex_sampler_0":
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment