mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Merge branch 'pull-resize-fixes' of https://github.com/OffenesFELD/processing
This commit is contained in:
@@ -10234,6 +10234,7 @@ public class PApplet extends Applet
|
||||
if (!newBounds.equals(oldBounds)) {
|
||||
// the ComponentListener in PApplet will handle calling size()
|
||||
setBounds(newBounds);
|
||||
revalidate(); // let the layout manager do its work
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,6 +328,9 @@ public abstract class PGL {
|
||||
protected abstract void initSurface(int antialias);
|
||||
|
||||
|
||||
protected abstract void reinitSurface();
|
||||
|
||||
|
||||
protected abstract void registerListeners();
|
||||
|
||||
|
||||
@@ -2215,6 +2218,7 @@ public abstract class PGL {
|
||||
public static int SRC_ALPHA_SATURATE;
|
||||
|
||||
public static int SCISSOR_TEST;
|
||||
public static int STENCIL_TEST;
|
||||
public static int DEPTH_TEST;
|
||||
public static int DEPTH_WRITEMASK;
|
||||
public static int ALPHA_TEST;
|
||||
|
||||
@@ -596,22 +596,6 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
width = iwidth;
|
||||
height = iheight;
|
||||
|
||||
allocate();
|
||||
reapplySettings();
|
||||
|
||||
// init perspective projection based on new dimensions
|
||||
cameraFOV = 60 * DEG_TO_RAD; // at least for now
|
||||
cameraX = width / 2.0f;
|
||||
cameraY = height / 2.0f;
|
||||
cameraZ = cameraY / ((float) Math.tan(cameraFOV / 2.0f));
|
||||
cameraNear = cameraZ / 10.0f;
|
||||
cameraFar = cameraZ * 10.0f;
|
||||
cameraAspect = (float) width / (float) height;
|
||||
|
||||
// Forces a restart of OpenGL so the canvas has the right size.
|
||||
restartPGL();
|
||||
|
||||
// set this flag so that beginDraw() will do an update to the camera.
|
||||
sized = true;
|
||||
}
|
||||
|
||||
@@ -1621,6 +1605,8 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
public void requestDraw() {
|
||||
if (primarySurface) {
|
||||
if (initialized) {
|
||||
if (sized) reinitPrimary();
|
||||
|
||||
pgl.requestDraw();
|
||||
} else {
|
||||
initPrimary();
|
||||
@@ -6002,6 +5988,27 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
}
|
||||
|
||||
|
||||
protected void reinitPrimary() {
|
||||
allocate();
|
||||
|
||||
// init perspective projection based on new dimensions
|
||||
cameraFOV = 60 * DEG_TO_RAD; // at least for now
|
||||
cameraX = width / 2.0f;
|
||||
cameraY = height / 2.0f;
|
||||
cameraZ = cameraY / ((float) Math.tan(cameraFOV / 2.0f));
|
||||
cameraNear = cameraZ / 10.0f;
|
||||
cameraFar = cameraZ * 10.0f;
|
||||
cameraAspect = (float) width / (float) height;
|
||||
|
||||
// Forces a restart of OpenGL so the canvas has the right size.
|
||||
// restartPGL();
|
||||
|
||||
// System.out.println("hasbeenSized");
|
||||
|
||||
pgl.reinitSurface();
|
||||
}
|
||||
|
||||
|
||||
protected void beginOnscreenDraw() {
|
||||
pgl.beginDraw(clearColorBuffer);
|
||||
|
||||
@@ -6177,6 +6184,8 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
pgl.disable(PGL.POLYGON_SMOOTH);
|
||||
|
||||
if (sized) {
|
||||
//reapplySettings();
|
||||
|
||||
// To avoid having garbage in the screen after a resize,
|
||||
// in the case background is not called in draw().
|
||||
background(backgroundColor);
|
||||
|
||||
@@ -313,6 +313,15 @@ public class PJOGL extends PGL {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void reinitSurface() {
|
||||
sinkFBO = backFBO = frontFBO = null;
|
||||
fboLayerCreated = false;
|
||||
fboLayerInUse = false;
|
||||
firstFrame = true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void registerListeners() {
|
||||
if (WINDOW_TOOLKIT == AWT) {
|
||||
@@ -777,7 +786,7 @@ public class PJOGL extends PGL {
|
||||
|
||||
@Override
|
||||
public void reshape(GLAutoDrawable glDrawable, int x, int y, int w, int h) {
|
||||
getGL(glDrawable);
|
||||
//getGL(glDrawable);
|
||||
}
|
||||
|
||||
private void getGL(GLAutoDrawable glDrawable) {
|
||||
@@ -1343,6 +1352,7 @@ public class PJOGL extends PGL {
|
||||
SRC_ALPHA_SATURATE = GL.GL_SRC_ALPHA_SATURATE;
|
||||
|
||||
SCISSOR_TEST = GL.GL_SCISSOR_TEST;
|
||||
STENCIL_TEST = GL.GL_STENCIL_TEST;
|
||||
DEPTH_TEST = GL.GL_DEPTH_TEST;
|
||||
DEPTH_WRITEMASK = GL.GL_DEPTH_WRITEMASK;
|
||||
ALPHA_TEST = GL2ES1.GL_ALPHA_TEST;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
bin
|
||||
Reference in New Issue
Block a user