| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -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 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -245,12 +245,18 @@ protected void initSurface(int antialias) { | |||
| 245 | 245 | } catch (GLException ex) { | |
| 246 | 246 | profile = GLProfile.getMaxProgrammable(true); | |
| 247 | 247 | } | |
| 248 | + if (!profile.isGL3()) { | ||
| 249 | + PGraphics.showWarning("Requested profile GL3 but is not available, got: " + profile); | ||
| 250 | + } | ||
| 248 | 251 | } else if (PROFILE == 4) { | |
| 249 | 252 | try { | |
| 250 | 253 | profile = GLProfile.getGL4ES3(); | |
| 251 | 254 | } catch (GLException ex) { | |
| 252 | 255 | profile = GLProfile.getMaxProgrammable(true); | |
| 253 | 256 | } | |
| 257 | + if (!profile.isGL4()) { | ||
| 258 | + PGraphics.showWarning("Requested profile GL4 but is not available, got: " + profile); | ||
| 259 | + } | ||
| 254 | 260 | } else throw new RuntimeException(UNSUPPORTED_GLPROF_ERROR); | |
| 255 | 261 | ||
| 256 | 262 | if (2 < PROFILE) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1003,6 +1003,8 @@ protected void endContourImpl() { | |||
| 1003 | 1003 | @Override | |
| 1004 | 1004 | public void vertex(float x, float y) { | |
| 1005 | 1005 | vertexImpl(x, y, 0, 0, 0); | |
| 1006 | + if (image != null) | ||
| 1007 | + PGraphics.showWarning(PGraphicsOpenGL.MISSING_UV_TEXCOORDS_ERROR); | ||
| 1006 | 1008 | } | |
| 1007 | 1009 | ||
| 1008 | 1010 | ||
@@ -1015,6 +1017,8 @@ public void vertex(float x, float y, float u, float v) { | |||
| 1015 | 1017 | @Override | |
| 1016 | 1018 | public void vertex(float x, float y, float z) { | |
| 1017 | 1019 | vertexImpl(x, y, z, 0, 0); | |
| 1020 | + if (image != null) | ||
| 1021 | + PGraphics.showWarning(PGraphicsOpenGL.MISSING_UV_TEXCOORDS_ERROR); | ||
| 1018 | 1022 | } | |
| 1019 | 1023 | ||
| 1020 | 1024 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -967,6 +967,9 @@ public void next() { | |||
| 967 | 967 | RGBA4 = GL11.GL_RGBA4; | |
| 968 | 968 | RGB5_A1 = GL11.GL_RGB5_A1; | |
| 969 | 969 | RGB565 = ARBES2Compatibility.GL_RGB565; | |
| 970 | + RGB8 = GL11.GL_RGB8; | ||
| 971 | + RGBA8 = GL11.GL_RGBA8; | ||
| 972 | + ALPHA8 = GL11.GL_ALPHA8; | ||
| 970 | 973 | ||
| 971 | 974 | READ_ONLY = GL15.GL_READ_ONLY; | |
| 972 | 975 | WRITE_ONLY = GL15.GL_WRITE_ONLY; | |
@@ -1181,7 +1184,6 @@ public void next() { | |||
| 1181 | 1184 | READ_FRAMEBUFFER = GL30.GL_READ_FRAMEBUFFER; | |
| 1182 | 1185 | DRAW_FRAMEBUFFER = GL30.GL_DRAW_FRAMEBUFFER; | |
| 1183 | 1186 | ||
| 1184 | - RGBA8 = GL11.GL_RGBA8; | ||
| 1185 | 1187 | DEPTH24_STENCIL8 = GL30.GL_DEPTH24_STENCIL8; | |
| 1186 | 1188 | ||
| 1187 | 1189 | DEPTH_COMPONENT = GL11.GL_DEPTH_COMPONENT; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -270,6 +270,10 @@ public void dispose() { | |||
| 270 | 270 | ||
| 271 | 271 | pipeline.dispose(); | |
| 272 | 272 | pipeline = null; | |
| 273 | + | ||
| 274 | + parent.g.removeCache(this); | ||
| 275 | + parent.unregisterMethod("dispose", this); | ||
| 276 | + parent.unregisterMethod("post", this); | ||
| 273 | 277 | } | |
| 274 | 278 | } | |
| 275 | 279 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -135,6 +135,10 @@ public void dispose() { | |||
| 135 | 135 | ||
| 136 | 136 | playbin.dispose(); | |
| 137 | 137 | playbin = null; | |
| 138 | + | ||
| 139 | + parent.g.removeCache(this); | ||
| 140 | + parent.unregisterMethod("dispose", this); | ||
| 141 | + parent.unregisterMethod("post", this); | ||
| 138 | 142 | } | |
| 139 | 143 | } | |
| 140 | 144 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments