Skip to content

Commit

Permalink
solve issue #1969: missing check in GLRenderer.clearVertexAttribs() (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold authored Feb 26, 2023
1 parent 5e859d5 commit 7854851
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions jme3-core/src/main/java/com/jme3/renderer/opengl/GLRenderer.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2021 jMonkeyEngine
* Copyright (c) 2009-2023 jMonkeyEngine
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -2922,13 +2922,16 @@ public void clearVertexAttribs() {
for (int i = 0; i < attribList.oldLen; i++) {
int idx = attribList.oldList[i];
gl.glDisableVertexAttribArray(idx);
VertexBuffer buffer = context.boundAttribs[idx].get();
if (buffer != null && buffer.isInstanced()) {
glext.glVertexAttribDivisorARB(idx, 0);
WeakReference<VertexBuffer> ref = context.boundAttribs[idx];
if (ref != null) {
VertexBuffer buffer = ref.get();
if (buffer != null && buffer.isInstanced()) {
glext.glVertexAttribDivisorARB(idx, 0);
}
context.boundAttribs[idx] = null;
}
context.boundAttribs[idx] = null;
}
context.attribIndexList.copyNewToOld();
attribList.copyNewToOld();
}

public void setVertexAttrib(VertexBuffer vb, VertexBuffer idb) {
Expand Down

0 comments on commit 7854851

Please sign in to comment.