Removed PGL.Context subclass

This commit is contained in:
codeanticode
2013-01-16 16:02:18 +00:00
parent 7089582826
commit ac8a2a98a3
7 changed files with 161 additions and 195 deletions

View File

@@ -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 {