@@ -76,6 +76,8 @@ public class PGraphicsOpenGL extends PGraphics {
76
76
"for the rest of the sketch's execution" ;
77
77
static final String UNSUPPORTED_SHAPE_FORMAT_ERROR =
78
78
"Unsupported shape format" ;
79
+ static final String MISSING_UV_TEXCOORDS_ERROR =
80
+ "No uv texture coordinates supplied with vertex() call" ;
79
81
static final String INVALID_FILTER_SHADER_ERROR =
80
82
"Your shader needs to be of TEXTURE type to be used as a filter" ;
81
83
static final String INCONSISTENT_SHADER_TYPES =
@@ -2114,6 +2116,7 @@ public void endContour() {
2114
2116
@ Override
2115
2117
public void vertex (float x , float y ) {
2116
2118
vertexImpl (x , y , 0 , 0 , 0 );
2119
+ if (textureImage != null ) PGraphics .showWarning (MISSING_UV_TEXCOORDS_ERROR );
2117
2120
}
2118
2121
2119
2122
@@ -2126,6 +2129,7 @@ public void vertex(float x, float y, float u, float v) {
2126
2129
@ Override
2127
2130
public void vertex (float x , float y , float z ) {
2128
2131
vertexImpl (x , y , z , 0 , 0 );
2132
+ if (textureImage != null ) PGraphics .showWarning (MISSING_UV_TEXCOORDS_ERROR );
2129
2133
}
2130
2134
2131
2135
@@ -5036,6 +5040,11 @@ protected void backgroundImpl(PImage image) {
5036
5040
if (0 < parent .frameCount ) {
5037
5041
clearColorBuffer = true ;
5038
5042
}
5043
+ // Setting the background as opaque. If this an offscreen surface, the
5044
+ // alpha channel will be set to 1 in endOffscreenDraw(), even if
5045
+ // blending operations during draw create translucent areas in the
5046
+ // color buffer.
5047
+ backgroundA = 1 ;
5039
5048
}
5040
5049
5041
5050
@@ -5324,17 +5333,17 @@ protected void setImpl(PImage sourceImage,
5324
5333
setgetPixels = true ;
5325
5334
super .setImpl (sourceImage , sourceX , sourceY , sourceWidth , sourceHeight ,
5326
5335
targetX , targetY );
5327
- // do we need this?
5328
- // see https://github.com/processing/processing/issues/2125
5329
- // if (sourceImage.format == RGB) {
5330
- // int targetOffset = targetY * width + targetX;
5331
- // for (int y = sourceY; y < sourceY + sourceHeight; y++) {
5332
- // for (int x = targetOffset; x < targetOffset + sourceWidth; x++) {
5333
- // pixels[x] |= 0xff000000;
5334
- // }
5335
- // targetOffset += width;
5336
- // }
5337
- // }
5336
+ // do we need this?
5337
+ // see https://github.com/processing/processing/issues/2125
5338
+ // if (sourceImage.format == RGB) {
5339
+ // int targetOffset = targetY * width + targetX;
5340
+ // for (int y = sourceY; y < sourceY + sourceHeight; y++) {
5341
+ // for (int x = targetOffset; x < targetOffset + sourceWidth; x++) {
5342
+ // pixels[x] |= 0xff000000;
5343
+ // }
5344
+ // targetOffset += width;
5345
+ // }
5346
+ // }
5338
5347
}
5339
5348
5340
5349
@@ -6097,6 +6106,15 @@ protected void beginOffscreenDraw() {
6097
6106
6098
6107
6099
6108
protected void endOffscreenDraw () {
6109
+ // Set alpha channel to opaque in order to match behavior of JAVA2D:
6110
+ // https://github.com/processing/processing/issues/1844
6111
+ // but still not working as expected. Some strange artifacts with multismapled
6112
+ // surfaces (see second code example in the issue above).
6113
+ // pgl.colorMask(false, false, false, true);
6114
+ // pgl.clearColor(0, 0, 0, 1);
6115
+ // pgl.clear(PGL.COLOR_BUFFER_BIT);
6116
+ // pgl.colorMask(true, true, true, true);
6117
+
6100
6118
if (offscreenMultisample ) {
6101
6119
multisampleFramebuffer .copy (offscreenFramebuffer , currentFramebuffer );
6102
6120
}
0 commit comments