Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solve issue #1969: missing check in GLRenderer.clearVertexAttribs() #1970

Merged
merged 1 commit into from
Feb 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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