Skip to content

Commit d027233

Browse files
committed
synced the latest changes in the java opengl renderer
1 parent 6beaa75 commit d027233

File tree

3 files changed

+24
-15
lines changed

3 files changed

+24
-15
lines changed

core/src/processing/opengl/PGL.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,7 @@ protected void endDraw(boolean clear0) {
590590
disable(BLEND);
591591
drawTexture(TEXTURE_2D, glColorTex.get(backTex),
592592
fboWidth, fboHeight, pg.width, pg.height,
593-
0, 0, pg.width, pg.height,
594-
0, 0, pg.width, pg.height);
593+
0, 0, pg.width, pg.height, 0, 0, pg.width, pg.height);
595594

596595
// Swapping front and back textures.
597596
int temp = frontTex;

core/src/processing/opengl/PGraphicsOpenGL.java

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2602,7 +2602,7 @@ void rawPolys() {
26022602
float[] vertices = tessGeo.polyVertices;
26032603
int[] color = tessGeo.polyColors;
26042604
float[] uv = tessGeo.polyTexCoords;
2605-
short[] indices = tessGeo.polyIndices;
2605+
//short[] indices = tessGeo.polyIndices; // unused [fry]
26062606

26072607

26082608
sortTriangles();
@@ -3392,8 +3392,8 @@ protected void shape(PShape shape, float x, float y, float z) {
33923392
pushMatrix();
33933393

33943394
if (shapeMode == CENTER) {
3395-
translate(x - shape.getWidth() / 2, y - shape.getHeight() / 2, z
3396-
- shape.getDepth() / 2);
3395+
translate(x - shape.getWidth() / 2, y - shape.getHeight() / 2,
3396+
z - shape.getDepth() / 2);
33973397

33983398
} else if ((shapeMode == CORNER) || (shapeMode == CORNERS)) {
33993399
translate(x, y, z);
@@ -3696,12 +3696,15 @@ protected void textCharShapeImpl(char ch, float x, float y) {
36963696
float lastX = 0;
36973697
float lastY = 0;
36983698

3699+
boolean open = false;
36993700
beginShape();
37003701
while (!outline.isDone()) {
37013702
int type = outline.currentSegment(textPoints);
3702-
if (type == PGL.SEG_MOVETO) { // 1 point (2 vars) in textPoints
3703-
} else if (type == PGL.SEG_LINETO) { // 1 point
3704-
if (type == PGL.SEG_MOVETO) beginContour();
3703+
if (!open) {
3704+
beginContour();
3705+
open = true;
3706+
}
3707+
if (type == PGL.SEG_MOVETO || type == PGL.SEG_LINETO) { // 1 point
37053708
vertex(x + textPoints[0], y + textPoints[1]);
37063709
lastX = textPoints[0];
37073710
lastY = textPoints[1];
@@ -3731,6 +3734,7 @@ protected void textCharShapeImpl(char ch, float x, float y) {
37313734
lastY = textPoints[5];
37323735
} else if (type == PGL.SEG_CLOSE) {
37333736
endContour();
3737+
open = false;
37343738
}
37353739
outline.next();
37363740
}
@@ -5890,21 +5894,27 @@ public void copy(PImage src,
58905894
scrX0 = dx;
58915895
scrX1 = dx + dw;
58925896
}
5897+
5898+
int texX0 = sx;
5899+
int texX1 = sx + sw;
5900+
int texY0, texY1;
58935901
if (invY) {
58945902
scrY0 = height - (dy + dh);
58955903
scrY1 = height - dy;
5904+
texY0 = tex.height - (sy + sh);
5905+
texY1 = tex.height - sy;
58965906
} else {
58975907
// Because drawTexture uses bottom-to-top orientation of Y axis.
58985908
scrY0 = height - dy;
58995909
scrY1 = height - (dy + dh);
5910+
texY0 = sy;
5911+
texY1 = sy + sh;
59005912
}
59015913

59025914
pgl.drawTexture(tex.glTarget, tex.glName,
59035915
tex.glWidth, tex.glHeight, width, height,
5904-
sx, tex.height - (sy + sh),
5905-
sx + sw, tex.height - sy,
5906-
scrX0, scrY0,
5907-
scrX1, scrY1);
5916+
texX0, texY0, texX1, texY1,
5917+
scrX0, scrY0, scrX1, scrY1);
59085918

59095919

59105920
if (needEndDraw) {

core/src/processing/opengl/Texture.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,22 +1252,22 @@ protected void copyTexture(Texture tex, int x, int y, int w, int h,
12521252
pg.setFramebuffer(tempFbo);
12531253
// Clear the color buffer to make sure that the alpha channel is set to
12541254
// full transparency
1255-
pgl.clearColor(0, 0, 0, 0);
1255+
pgl.clearColor(1, 1, 1, 1);
12561256
pgl.clear(PGL.COLOR_BUFFER_BIT);
12571257
if (scale) {
12581258
// Rendering tex into "this", and scaling the source rectangle
12591259
// to cover the entire destination region.
12601260
pgl.drawTexture(tex.glTarget, tex.glName,
12611261
tex.glWidth, tex.glHeight, tempFbo.width, tempFbo.height,
1262-
x, y, w, h, 0, 0, width, height);
1262+
x, y, x + w, y + h, 0, 0, width, height);
12631263

12641264
} else {
12651265
// Rendering tex into "this" but without scaling so the contents
12661266
// of the source texture fall in the corresponding texels of the
12671267
// destination.
12681268
pgl.drawTexture(tex.glTarget, tex.glName,
12691269
tex.glWidth, tex.glHeight, tempFbo.width, tempFbo.height,
1270-
x, y, w, h, x, y, w, h);
1270+
x, y, x + w, y + h, x, y, x + w, y + h);
12711271
}
12721272
pg.popFramebuffer();
12731273

0 commit comments

Comments
 (0)