mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Reverting JOGL changes to RC2 stage
This commit is contained in:
@@ -1809,8 +1809,7 @@ public class PApplet extends Applet
|
||||
}
|
||||
|
||||
// render a single frame
|
||||
//handleDraw();
|
||||
if (g != null) g.requestDraw();
|
||||
handleDraw();
|
||||
|
||||
if (frameCount == 1) {
|
||||
// Call the request focus event once the image is sure to be on
|
||||
@@ -2050,7 +2049,8 @@ public class PApplet extends Applet
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
public void addListeners() {
|
||||
addMouseListener(this);
|
||||
addMouseMotionListener(this);
|
||||
@@ -2073,6 +2073,7 @@ public class PApplet extends Applet
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
@@ -631,6 +631,7 @@ public class PGraphics extends PImage implements PConstants {
|
||||
reapplySettings();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Allocate memory for this renderer. Generally will need to be implemented
|
||||
* for all renderers.
|
||||
@@ -665,9 +666,8 @@ public class PGraphics extends PImage implements PConstants {
|
||||
/**
|
||||
* Try to draw, or put a draw request on the queue.
|
||||
*/
|
||||
public void requestDraw() { // ignore
|
||||
parent.handleDraw();
|
||||
}
|
||||
// public void requestDraw() { // ignore
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
# If you want to support more platforms, see the jogl.dev.java.net to get the
|
||||
# natives libraries for the platform in question (i.e. Solaris).
|
||||
|
||||
name = OpenGL
|
||||
|
||||
# In releases later than (but not including) 1.0.9, the applet JAR files
|
||||
# are downloaded directly from Sun, so that a single version is cached
|
||||
# on the user's computer, rather than increasing the download size with
|
||||
# the versions for each platform.
|
||||
applet = opengl.jar
|
||||
|
||||
application.macosx=opengl.jar,jogl.all.jar,gluegen-rt.jar,jogl-all-natives-macosx-universal.jar,gluegen-rt-natives-macosx-universal.jar
|
||||
application.windows32=opengl.jar,jogl.all.jar,gluegen-rt.jar,jogl-all-natives-windows-i586.jar,gluegen-rt-natives-windows-i586.jar
|
||||
application.windows64=opengl.jar,jogl.all.jar,gluegen-rt.jar,jogl-all-natives-windows-amd64.jar,gluegen-rt-natives-windows-amd64.jar
|
||||
application.linux32=opengl.jar,jogl.all.jar,gluegen-rt.jar,jogl-all-natives-linux-i586.jar,gluegen-rt-natives-linux-i586.jar
|
||||
application.linux64=opengl.jar,jogl.all.jar,gluegen-rt.jar,jogl-all-natives-linux-amd64.jar,gluegen-rt-natives-linux-amd64.jar
|
||||
@@ -23,13 +23,10 @@
|
||||
|
||||
package processing.opengl;
|
||||
|
||||
import java.awt.Insets;
|
||||
import java.nio.Buffer;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import javax.media.nativewindow.GraphicsConfigurationFactory;
|
||||
import javax.media.nativewindow.NativeWindow;
|
||||
@@ -39,20 +36,17 @@ import javax.media.nativewindow.awt.AWTGraphicsDevice;
|
||||
import javax.media.nativewindow.awt.AWTGraphicsScreen;
|
||||
import javax.media.opengl.GL;
|
||||
import javax.media.opengl.GL2;
|
||||
import javax.media.opengl.GLAutoDrawable;
|
||||
import javax.media.opengl.GLCapabilities;
|
||||
import javax.media.opengl.GLContext;
|
||||
import javax.media.opengl.GLDrawable;
|
||||
import javax.media.opengl.GLEventListener;
|
||||
import javax.media.opengl.GLDrawableFactory;
|
||||
import javax.media.opengl.GLProfile;
|
||||
import javax.media.opengl.awt.GLCanvas;
|
||||
import javax.media.opengl.glu.GLU;
|
||||
import javax.media.opengl.glu.GLUtessellator;
|
||||
import javax.media.opengl.glu.GLUtessellatorCallbackAdapter;
|
||||
|
||||
import com.jogamp.newt.awt.NewtCanvasAWT;
|
||||
import com.jogamp.newt.opengl.GLWindow;
|
||||
import com.jogamp.opengl.util.AnimatorBase;
|
||||
import processing.core.PApplet;
|
||||
import processing.core.PConstants;
|
||||
|
||||
/**
|
||||
* Processing-OpenGL abstraction layer.
|
||||
@@ -244,17 +238,7 @@ public class PGL {
|
||||
public GLDrawable drawable;
|
||||
|
||||
/** The rendering context (holds rendering state info) */
|
||||
public GLContext context;
|
||||
|
||||
public GLCanvas awtCanvas;
|
||||
public NewtCanvasAWT newtCanvas;
|
||||
public GLWindow window;
|
||||
protected PGLAnimator animator;
|
||||
|
||||
// Some testing parameters
|
||||
boolean useNewtCanvas = true;
|
||||
boolean addCanvasToFrame = true;
|
||||
boolean printThreadInfo = false;
|
||||
public GLContext context;
|
||||
|
||||
public PGraphicsOpenGL pg;
|
||||
|
||||
@@ -282,22 +266,22 @@ public class PGL {
|
||||
* if possible.
|
||||
*
|
||||
*/
|
||||
// static public void startup(boolean beforeUI) {
|
||||
// try {
|
||||
// GLProfile.initSingleton(beforeUI);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
|
||||
static public void shutdown() {
|
||||
// GLProfile.shutdown();
|
||||
static public void startup(boolean beforeUI) {
|
||||
try {
|
||||
GLProfile.initSingleton(beforeUI);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// public void updatePrimary() {
|
||||
// gl = context.getGL();
|
||||
// gl2 = gl.getGL2();
|
||||
// }
|
||||
static public void shutdown() {
|
||||
GLProfile.shutdown();
|
||||
}
|
||||
|
||||
public void updatePrimary() {
|
||||
gl = context.getGL();
|
||||
gl2 = gl.getGL2();
|
||||
}
|
||||
|
||||
public void updateOffscreen(PGL primary) {
|
||||
gl = primary.gl;
|
||||
@@ -306,7 +290,22 @@ public class PGL {
|
||||
|
||||
|
||||
public void initPrimarySurface(int antialias) {
|
||||
if (printThreadInfo) System.out.println("Current thread at PGL.initPrimarySurface(): " + Thread.currentThread());
|
||||
if (pg.parent.online) {
|
||||
// RCP Application (Applet's, Webstart, Netbeans, ..) using JOGL may not
|
||||
// be able to initialize JOGL before the first UI action, so initSingleton()
|
||||
// is called with its argument set to false.
|
||||
GLProfile.initSingleton(false);
|
||||
} else {
|
||||
if (PApplet.platform == PConstants.LINUX) {
|
||||
// Special case for Linux, since the multithreading issues described for
|
||||
// example here:
|
||||
// http://forum.jogamp.org/QtJambi-JOGL-Ubuntu-Lucid-td909554.html
|
||||
// have not been solved yet (at least for stable release b32 of JOGL2).
|
||||
GLProfile.initSingleton(false);
|
||||
} else {
|
||||
GLProfile.initSingleton(true);
|
||||
}
|
||||
}
|
||||
|
||||
// For the time being we use the fixed function profile
|
||||
// because GL3 is not supported in MacOSX Snow Leopard.
|
||||
@@ -324,70 +323,22 @@ public class PGL {
|
||||
} else {
|
||||
capabilities.setSampleBuffers(false);
|
||||
}
|
||||
|
||||
|
||||
// Getting the native window:
|
||||
// http://www.java-gaming.org/index.php/topic,21559.0.html
|
||||
AWTGraphicsScreen screen = (AWTGraphicsScreen)AWTGraphicsScreen.createDefault();
|
||||
AWTGraphicsConfiguration config = (AWTGraphicsConfiguration)GraphicsConfigurationFactory
|
||||
.getFactory(AWTGraphicsDevice.class).chooseGraphicsConfiguration(capabilities, capabilities, null, screen);
|
||||
NativeWindow natWin = NativeWindowFactory.getNativeWindow(pg.parent.frame, config);
|
||||
NativeWindow win = NativeWindowFactory.getNativeWindow(pg.parent, config);
|
||||
|
||||
if (useNewtCanvas) {
|
||||
// NEWT canvas
|
||||
|
||||
window = GLWindow.create(natWin, capabilities);
|
||||
newtCanvas = new NewtCanvasAWT(window);
|
||||
newtCanvas.setBounds(0, 0, pg.parent.width, pg.parent.height);
|
||||
Insets insets = pg.parent.frame.getInsets();
|
||||
newtCanvas.setLocation(insets.left, insets.top);
|
||||
|
||||
if (addCanvasToFrame) {
|
||||
pg.parent.frame.add(newtCanvas, pg.parent.frame.getComponentCount() - 1);
|
||||
pg.parent.frame.validate();
|
||||
} else {
|
||||
// Framerate doesn't work, invalid drawable error (same for AWT).
|
||||
pg.parent.add(newtCanvas, pg.parent.getComponentCount() - 1);
|
||||
pg.parent.validate();
|
||||
}
|
||||
|
||||
window.addGLEventListener(new PGLListener());
|
||||
animator = new PGLAnimator(window);
|
||||
animator.setThreadName("Processing-OpenGL");
|
||||
animator.start();
|
||||
|
||||
newtCanvas.addMouseListener(pg.parent);
|
||||
newtCanvas.addMouseMotionListener(pg.parent);
|
||||
newtCanvas.addKeyListener(pg.parent);
|
||||
newtCanvas.addFocusListener(pg.parent);
|
||||
} else {
|
||||
// AWT canvas
|
||||
|
||||
awtCanvas = new GLCanvas(capabilities);
|
||||
awtCanvas.setBounds(0, 0, pg.parent.width, pg.parent.height);
|
||||
Insets insets = pg.parent.frame.getInsets();
|
||||
awtCanvas.setLocation(insets.left, insets.top);
|
||||
|
||||
if (addCanvasToFrame) {
|
||||
pg.parent.frame.add(awtCanvas, pg.parent.frame.getComponentCount() - 1);
|
||||
pg.parent.frame.validate();
|
||||
} else{
|
||||
// Framerate doesn't work, invalid drawable error (same for NEWT).
|
||||
pg.parent.add(awtCanvas, pg.parent.getComponentCount() - 1);
|
||||
pg.parent.validate();
|
||||
}
|
||||
|
||||
awtCanvas.addGLEventListener(new PGLListener());
|
||||
animator = new PGLAnimator(awtCanvas);
|
||||
animator.setThreadName("Processing-OpenGL");
|
||||
animator.start();
|
||||
|
||||
awtCanvas.addMouseListener(pg.parent);
|
||||
awtCanvas.addMouseMotionListener(pg.parent);
|
||||
awtCanvas.addKeyListener(pg.parent);
|
||||
awtCanvas.addFocusListener(pg.parent);
|
||||
}
|
||||
// With the native window we get the drawable and context:
|
||||
GLDrawableFactory factory = GLDrawableFactory.getFactory(profile);
|
||||
drawable = factory.createGLDrawable(win);
|
||||
context = drawable.createContext(null);
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
|
||||
public void initOffscreenSurface(PGL primary) {
|
||||
context = primary.context;
|
||||
capabilities = primary.capabilities;
|
||||
@@ -404,33 +355,32 @@ public class PGL {
|
||||
/**
|
||||
* Make the OpenGL rendering context current for this thread.
|
||||
*/
|
||||
// protected void detainContext() {
|
||||
// try {
|
||||
// while (context.makeCurrent() == GLContext.CONTEXT_NOT_CURRENT) {
|
||||
// Thread.sleep(10);
|
||||
// }
|
||||
// } catch (InterruptedException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Release the context, otherwise the AWT lock on X11 will not be released
|
||||
// */
|
||||
// public void releaseContext() {
|
||||
// context.release();
|
||||
// }
|
||||
//
|
||||
// public void destroyContext() {
|
||||
// context.destroy();
|
||||
// context = null;
|
||||
// }
|
||||
protected void detainContext() {
|
||||
try {
|
||||
while (context.makeCurrent() == GLContext.CONTEXT_NOT_CURRENT) {
|
||||
Thread.sleep(10);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Release the context, otherwise the AWT lock on X11 will not be released
|
||||
*/
|
||||
public void releaseContext() {
|
||||
context.release();
|
||||
}
|
||||
|
||||
public void destroyContext() {
|
||||
context.destroy();
|
||||
context = null;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Frame rendering
|
||||
|
||||
/*
|
||||
public boolean initOnscreenDraw() {
|
||||
if (drawable != null) {
|
||||
// Call setRealized() after addNotify() has been called
|
||||
@@ -444,7 +394,6 @@ public class PGL {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
public void beginOnscreenDraw(boolean clear, int frame) {
|
||||
}
|
||||
@@ -465,18 +414,7 @@ public class PGL {
|
||||
return pg.parent.isDisplayable();
|
||||
}
|
||||
|
||||
public void requestDraw() {
|
||||
// if (canvas != null) {
|
||||
// canvas.display();
|
||||
// }
|
||||
// if (window != null) {
|
||||
// window.display();
|
||||
// }
|
||||
|
||||
if (animator != null) {
|
||||
animator.requestRender();
|
||||
}
|
||||
|
||||
public void requestDraw() {
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1015,155 +953,5 @@ public class PGL {
|
||||
byte[] infoBytes = new byte[length];
|
||||
infoLog.get(infoBytes);
|
||||
return new String(infoBytes);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Java specific stuff
|
||||
|
||||
class PGLListener implements GLEventListener {
|
||||
@Override
|
||||
public void display(GLAutoDrawable drawable) {
|
||||
if (printThreadInfo) System.out.println("Current thread at PGLListener.display(): " + Thread.currentThread());
|
||||
context = drawable.getContext();
|
||||
gl = context.getGL();
|
||||
gl2 = gl.getGL2();
|
||||
pg.parent.handleDraw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose(GLAutoDrawable drawable) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(GLAutoDrawable drawable) {
|
||||
context = drawable.getContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reshape(GLAutoDrawable drawable, int x, int y, int w, int h) {
|
||||
context = drawable.getContext();
|
||||
}
|
||||
}
|
||||
|
||||
/** An Animator subclass which renders one frame at the time
|
||||
* upon calls to the requestRender() method. */
|
||||
public class PGLAnimator extends AnimatorBase {
|
||||
private Timer timer = null;
|
||||
private TimerTask task = null;
|
||||
private String threadName = null;
|
||||
private volatile boolean shouldRun;
|
||||
|
||||
protected String getBaseName(String prefix) {
|
||||
return "Custom" + prefix + "Animator" ;
|
||||
}
|
||||
|
||||
/** Creates an CustomAnimator with an initial drawable to
|
||||
* animate. */
|
||||
public PGLAnimator(GLAutoDrawable drawable) {
|
||||
if (drawable != null) {
|
||||
add(drawable);
|
||||
}
|
||||
}
|
||||
|
||||
public void setThreadName(String name) {
|
||||
threadName = name;
|
||||
}
|
||||
|
||||
public synchronized void requestRender() {
|
||||
shouldRun = true;
|
||||
}
|
||||
|
||||
public final boolean isStarted() {
|
||||
stateSync.lock();
|
||||
try {
|
||||
return (timer != null);
|
||||
} finally {
|
||||
stateSync.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public final boolean isAnimating() {
|
||||
stateSync.lock();
|
||||
try {
|
||||
return (timer != null) && (task != null);
|
||||
} finally {
|
||||
stateSync.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
private void startTask() {
|
||||
if(null != task) {
|
||||
return;
|
||||
}
|
||||
|
||||
task = new TimerTask() {
|
||||
private boolean firstRun = true;
|
||||
public void run() {
|
||||
if (firstRun) {
|
||||
if (threadName != null) Thread.currentThread().setName(threadName);
|
||||
firstRun = false;
|
||||
}
|
||||
if(PGLAnimator.this.shouldRun) {
|
||||
PGLAnimator.this.animThread = Thread.currentThread();
|
||||
// display impl. uses synchronized block on the animator instance
|
||||
display();
|
||||
synchronized (this) {
|
||||
// done with current frame.
|
||||
shouldRun = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
fpsCounter.resetFPSCounter();
|
||||
shouldRun = false;
|
||||
|
||||
timer.schedule(task, 0, 1);
|
||||
}
|
||||
|
||||
public synchronized boolean start() {
|
||||
if (timer != null) {
|
||||
return false;
|
||||
}
|
||||
stateSync.lock();
|
||||
try {
|
||||
timer = new Timer();
|
||||
startTask();
|
||||
} finally {
|
||||
stateSync.unlock();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Stops this CustomAnimator. */
|
||||
public synchronized boolean stop() {
|
||||
if (timer == null) {
|
||||
return false;
|
||||
}
|
||||
stateSync.lock();
|
||||
try {
|
||||
shouldRun = false;
|
||||
if(null != task) {
|
||||
task.cancel();
|
||||
task = null;
|
||||
}
|
||||
if(null != timer) {
|
||||
timer.cancel();
|
||||
timer = null;
|
||||
}
|
||||
animThread = null;
|
||||
try {
|
||||
Thread.sleep(20); // ~ 1/60 hz wait, since we can't ctrl stopped threads
|
||||
} catch (InterruptedException e) { }
|
||||
} finally {
|
||||
stateSync.unlock();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public final boolean isPaused() { return false; }
|
||||
public synchronized boolean resume() { return false; }
|
||||
public synchronized boolean pause() { return false; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -472,10 +472,6 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
}
|
||||
|
||||
|
||||
public boolean handleListeners() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by resize(), this handles creating the actual GLCanvas the
|
||||
* first time around, or simply resizing it on subsequent calls.
|
||||
@@ -515,7 +511,6 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
// } else {
|
||||
// reapplySettings();
|
||||
// }
|
||||
//initPrimary();
|
||||
if (pgl.initialized) {
|
||||
reapplySettings();
|
||||
}
|
||||
@@ -539,10 +534,10 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
|
||||
public void dispose() { // PGraphics
|
||||
super.dispose();
|
||||
//pgl.detainContext();
|
||||
pgl.detainContext();
|
||||
deleteFinalizedGLResources();
|
||||
//pgl.releaseContext();
|
||||
//PGL.shutdown();
|
||||
pgl.releaseContext();
|
||||
PGL.shutdown();
|
||||
}
|
||||
|
||||
|
||||
@@ -1085,10 +1080,10 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
public void restartContext() {
|
||||
releaseResources();
|
||||
|
||||
//pgl.releaseContext();
|
||||
//pgl.destroyContext();
|
||||
pgl.releaseContext();
|
||||
pgl.destroyContext();
|
||||
restartSurface();
|
||||
//pgl.detainContext();
|
||||
pgl.detainContext();
|
||||
updatePGL();
|
||||
}
|
||||
|
||||
@@ -1323,13 +1318,8 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
}
|
||||
|
||||
|
||||
public void requestDraw() {
|
||||
if (primarySurface) {
|
||||
if (!pgl.initialized) {
|
||||
initPrimary();
|
||||
}
|
||||
pgl.requestDraw();
|
||||
}
|
||||
public void requestDraw() {
|
||||
pgl.requestDraw();
|
||||
}
|
||||
|
||||
|
||||
@@ -1340,9 +1330,15 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
}
|
||||
|
||||
if (primarySurface) {
|
||||
pgl.beginOnscreenDraw(clearColorBuffer, parent.frameCount);
|
||||
if (!pgl.initialized) {
|
||||
initPrimary();
|
||||
}
|
||||
|
||||
} else {
|
||||
if (!pgl.initOnscreenDraw()) {
|
||||
return;
|
||||
}
|
||||
pgl.detainContext();
|
||||
} else {
|
||||
if (!pgl.initialized) {
|
||||
initOffscreen();
|
||||
}
|
||||
@@ -1353,11 +1349,9 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
pgl.setDrawBuffer(0);
|
||||
} else {
|
||||
setFramebuffer(offscreenFramebuffer);
|
||||
}
|
||||
|
||||
pgl.beginOffscreenDraw(clearColorBuffer, parent.frameCount);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
updatePGL();
|
||||
|
||||
if (!glParamsRead) {
|
||||
@@ -1374,6 +1368,11 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
|
||||
if (!primarySurface) {
|
||||
pg.saveGLState();
|
||||
|
||||
// Disabling all lights, so the offscreen renderer can set completely
|
||||
// new light configuration (otherwise some light configuration from the
|
||||
// primary renderer might stay).
|
||||
//pg.disableLights();
|
||||
}
|
||||
|
||||
inGeo.reset();
|
||||
@@ -1467,14 +1466,16 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
pgl.glClearColor(0, 0, 0, 0);
|
||||
pgl.glClear(PGL.GL_DEPTH_BUFFER_BIT | PGL.GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
if (primarySurface) {
|
||||
pgl.beginOnscreenDraw(clearColorBuffer, parent.frameCount);
|
||||
} else {
|
||||
pgl.beginOffscreenDraw(clearColorBuffer, parent.frameCount);
|
||||
}
|
||||
|
||||
drawing = true;
|
||||
|
||||
// This copy of the clear color buffer variable is needed to take into account
|
||||
// the situation when clearColorBuffer = true with FBOs enabled at beginDraw()
|
||||
// and clearColorBuffer = false at endDraw(). In such situation, an offscreen
|
||||
// buffer might be bound, but should popped to the screen buffer for correct
|
||||
// continuation of onscreen rendering.
|
||||
clearColorBuffer0 = clearColorBuffer;
|
||||
clearColorBuffer = false;
|
||||
|
||||
report("bot beginDraw()");
|
||||
}
|
||||
@@ -1503,6 +1504,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
if (primarySurface) {
|
||||
pgl.glFlush();
|
||||
pgl.endOnscreenDraw(clearColorBuffer0);
|
||||
pgl.releaseContext();
|
||||
} else {
|
||||
if (offscreenMultisample) {
|
||||
offscreenFramebufferMultisample.copy(offscreenFramebuffer);
|
||||
@@ -1526,18 +1528,20 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
}
|
||||
|
||||
|
||||
public void endGL() {
|
||||
public void endPGL() {
|
||||
restoreGLState();
|
||||
}
|
||||
|
||||
|
||||
public void updatePGL() {
|
||||
if (primarySurface) {
|
||||
if (primarySurface) {
|
||||
pgl.updatePrimary();
|
||||
} else {
|
||||
pgl.updateOffscreen(pg.pgl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void saveGLState() {
|
||||
}
|
||||
|
||||
@@ -1577,14 +1581,14 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
// operation, such as grabbing the contents of the color
|
||||
// buffer.
|
||||
protected void beginGLOp() {
|
||||
//pgl.detainContext();
|
||||
pgl.detainContext();
|
||||
updatePGL();
|
||||
}
|
||||
|
||||
|
||||
// Pairs-up with beginGLOp().
|
||||
protected void endGLOp() {
|
||||
//pgl.releaseContext();
|
||||
pgl.releaseContext();
|
||||
}
|
||||
|
||||
protected void updateGLProjection() {
|
||||
@@ -1729,8 +1733,6 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
specular(125);
|
||||
emissive(0);
|
||||
shininess(1);
|
||||
|
||||
clearColorBuffer = false;
|
||||
}
|
||||
|
||||
// reapplySettings
|
||||
@@ -4286,11 +4288,7 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
|
||||
pgl.glClearColor(backgroundR, backgroundG, backgroundB, 1);
|
||||
pgl.glClear(PGL.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
if (0 < parent.frameCount) {
|
||||
// Only one call to background during the drawing loop is needed to set the clear mode to true.
|
||||
clearColorBuffer = true;
|
||||
}
|
||||
clearColorBuffer = true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
@@ -5446,12 +5444,12 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
// INITIALIZATION ROUTINES
|
||||
|
||||
static public void init() {
|
||||
//PGL.startup(true);
|
||||
PGL.startup(true);
|
||||
}
|
||||
|
||||
|
||||
static public void init(boolean beforeUI) {
|
||||
//PGL.startup(beforeUI);
|
||||
PGL.startup(beforeUI);
|
||||
}
|
||||
|
||||
protected void restartSurface() {
|
||||
|
||||
Reference in New Issue
Block a user