Skip to content

Commit 19eb7c2

Browse files
committed
use WINDOW_BGCOLOR
1 parent 427a57e commit 19eb7c2

2 files changed

Lines changed: 21 additions & 5 deletions

File tree

core/src/processing/opengl/PGL.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636
import processing.core.PApplet;
3737
import processing.core.PGraphics;
38+
import processing.core.PSurface;
3839

3940

4041
/**
@@ -586,9 +587,20 @@ protected void endDraw(boolean clear0) {
586587
// Draw the contents of the back texture to the screen framebuffer.
587588
bindFramebufferImpl(FRAMEBUFFER, 0);
588589

589-
clearDepth(1);
590-
clearColor(0, 0, 0, 0);
591-
clear(COLOR_BUFFER_BIT | DEPTH_BUFFER_BIT);
590+
591+
if (presentMode) {
592+
float a = PSurface.WINDOW_BGCOLOR.getAlpha() / 255.0f;
593+
float r = PSurface.WINDOW_BGCOLOR.getRed() / 255.0f;
594+
float g = PSurface.WINDOW_BGCOLOR.getGreen() / 255.0f;
595+
float b = PSurface.WINDOW_BGCOLOR.getBlue() / 255.0f;
596+
clearDepth(1);
597+
clearColor(r, g, b, a);
598+
clear(COLOR_BUFFER_BIT | DEPTH_BUFFER_BIT);
599+
} else {
600+
clearDepth(1);
601+
clearColor(0, 0, 0, 0);
602+
clear(COLOR_BUFFER_BIT | DEPTH_BUFFER_BIT);
603+
}
592604

593605
// Render current back texture to screen, without blending.
594606
disable(BLEND);

java/libraries/lwjgl/src/processing/lwjgl/PSurfaceLWJGL.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,9 @@ public void placePresent(Color stopColor) {
334334
offsetX = pgl.offsetX = 0.5f * (screenRect.width - sketchWidth);
335335
offsetY = pgl.offsetY = 0.5f * (screenRect.height - sketchHeight);
336336
pgl.requestFBOLayer();
337+
338+
339+
337340
// try {
338341
//// Display.setFullscreen(true);
339342
// Display.setDisplayMode(new DisplayMode(screenRect.width, screenRect.height));
@@ -342,10 +345,11 @@ public void placePresent(Color stopColor) {
342345
// e1.printStackTrace();
343346
// }
344347

345-
/*
348+
/*
346349
presentFrame = new JFrame(displayDevice.getDefaultConfiguration());
347350
presentFrame.getContentPane().setBackground(WINDOW_BGCOLOR);
348351
352+
349353
// presentCanvas = new Canvas();
350354
// presentCanvas.setFocusable(true);
351355
// presentCanvas.requestFocus();
@@ -981,7 +985,7 @@ public void run() {
981985
modifiers |= Event.ALT;
982986
}
983987

984-
PApplet.println(Mouse.getX(), Mouse.getY(), offsetX, offsetY);
988+
// PApplet.println(Mouse.getX(), Mouse.getY(), offsetX, offsetY);
985989
int x = Mouse.getX() - (int)offsetX;
986990
int y = sketchHeight - (Mouse.getY() - (int)offsetY);
987991
int button = 0;

0 commit comments

Comments
 (0)