mirror of
https://github.com/processing/processing4.git
synced 2026-02-14 19:05:34 +01:00
Removed PGL.Context subclass
This commit is contained in:
@@ -516,6 +516,10 @@ public class PGL {
|
||||
// Initialization, finalization
|
||||
|
||||
|
||||
public PGL() {
|
||||
}
|
||||
|
||||
|
||||
public PGL(PGraphicsOpenGL pg) {
|
||||
this.pg = pg;
|
||||
if (glu == null) {
|
||||
@@ -1935,48 +1939,13 @@ public class PGL {
|
||||
// Context interface
|
||||
|
||||
|
||||
protected Context createEmptyContext() {
|
||||
return new Context();
|
||||
protected int createEmptyContext() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
protected Context getCurrentContext() {
|
||||
return new Context(context);
|
||||
}
|
||||
|
||||
|
||||
protected class Context {
|
||||
protected int id;
|
||||
|
||||
Context() {
|
||||
id = -1;
|
||||
}
|
||||
|
||||
Context(GLContext context) {
|
||||
if (context != null) {
|
||||
id = context.hashCode();
|
||||
} else {
|
||||
id = -1;
|
||||
}
|
||||
}
|
||||
|
||||
boolean current() {
|
||||
return equal(context);
|
||||
}
|
||||
|
||||
boolean equal(GLContext context) {
|
||||
if (id == -1 || context == null) {
|
||||
// A null context means a still non-created resource,
|
||||
// so it is considered equal to the argument.
|
||||
return true;
|
||||
} else {
|
||||
return id == context.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
int id() {
|
||||
return id;
|
||||
}
|
||||
protected int getCurrentContext() {
|
||||
return context.hashCode();
|
||||
}
|
||||
|
||||
|
||||
@@ -2079,8 +2048,8 @@ public class PGL {
|
||||
// Utility functions
|
||||
|
||||
|
||||
protected boolean contextIsCurrent(Context other) {
|
||||
return other == null || other.current();
|
||||
protected boolean contextIsCurrent(int other) {
|
||||
return other == -1 || other == context.hashCode();
|
||||
}
|
||||
|
||||
|
||||
@@ -3412,6 +3381,7 @@ public class PGL {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean isStarted() {
|
||||
stateSync.lock();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user