propane 3.10.0-java → 3.11.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.mvn/wrapper/maven-wrapper.properties +1 -1
- data/CHANGELOG.md +2 -0
- data/README.md +7 -7
- data/lib/propane/app.rb +2 -5
- data/lib/propane/helper_methods.rb +6 -6
- data/lib/propane/version.rb +1 -1
- data/lib/{propane-3.10.0.jar → propane-3.11.0.jar} +0 -0
- data/pom.rb +6 -6
- data/pom.xml +6 -6
- data/propane.gemspec +3 -3
- data/src/main/java/monkstone/noise/OpenSimplex2F.java +838 -737
- data/src/main/java/monkstone/vecmath/vec2/Vec2.java +8 -13
- data/src/main/java/monkstone/vecmath/vec3/Vec3.java +14 -28
- data/src/main/java/processing/awt/PImageAWT.java +6 -4
- data/src/main/java/processing/core/PApplet.java +71 -59
- data/src/main/java/processing/core/PImage.java +14 -14
- data/src/main/java/processing/opengl/PGraphicsOpenGL.java +13 -13
- data/src/main/java/processing/opengl/PShader.java +1 -6
- data/src/main/java/processing/opengl/PSurfaceJOGL.java +6 -6
- data/{lib/java/processing/opengl → src/main/resources}/cursors/arrow.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/cross.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/hand.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/license.txt +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/move.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/text.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/cursors/wait.png +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/ColorFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/ColorVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/LightFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/LightVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/LineFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/LineVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/MaskFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/PointFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/PointVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/TexFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/TexLightFrag.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/TexLightVert.glsl +0 -0
- data/{lib/java/processing/opengl → src/main/resources}/shaders/TexVert.glsl +0 -0
- data/test/test_helper.rb +1 -0
- data/vendors/Rakefile +1 -1
- metadata +29 -155
- data/lib/java/japplemenubar/JAppleMenuBar.java +0 -88
- data/lib/java/japplemenubar/libjAppleMenuBar.jnilib +0 -0
- data/lib/java/monkstone/ColorUtil.java +0 -127
- data/lib/java/monkstone/MathToolModule.java +0 -287
- data/lib/java/monkstone/PropaneLibrary.java +0 -46
- data/lib/java/monkstone/core/LibraryProxy.java +0 -136
- data/lib/java/monkstone/fastmath/DegLutTables.java +0 -111
- data/lib/java/monkstone/fastmath/Deglut.java +0 -71
- data/lib/java/monkstone/fastmath/package-info.java +0 -6
- data/lib/java/monkstone/filechooser/Chooser.java +0 -39
- data/lib/java/monkstone/noise/FastTerrain.java +0 -874
- data/lib/java/monkstone/noise/Noise.java +0 -90
- data/lib/java/monkstone/noise/NoiseGenerator.java +0 -75
- data/lib/java/monkstone/noise/NoiseMode.java +0 -28
- data/lib/java/monkstone/noise/OpenSimplex2F.java +0 -881
- data/lib/java/monkstone/noise/OpenSimplex2S.java +0 -1106
- data/lib/java/monkstone/noise/SmoothTerrain.java +0 -1099
- data/lib/java/monkstone/slider/CustomHorizontalSlider.java +0 -164
- data/lib/java/monkstone/slider/CustomVerticalSlider.java +0 -178
- data/lib/java/monkstone/slider/SimpleHorizontalSlider.java +0 -145
- data/lib/java/monkstone/slider/SimpleSlider.java +0 -166
- data/lib/java/monkstone/slider/SimpleVerticalSlider.java +0 -157
- data/lib/java/monkstone/slider/Slider.java +0 -61
- data/lib/java/monkstone/slider/SliderBar.java +0 -245
- data/lib/java/monkstone/slider/SliderGroup.java +0 -56
- data/lib/java/monkstone/slider/WheelHandler.java +0 -35
- data/lib/java/monkstone/vecmath/GfxRender.java +0 -86
- data/lib/java/monkstone/vecmath/JRender.java +0 -56
- data/lib/java/monkstone/vecmath/ShapeRender.java +0 -87
- data/lib/java/monkstone/vecmath/package-info.java +0 -20
- data/lib/java/monkstone/vecmath/vec2/Vec2.java +0 -802
- data/lib/java/monkstone/vecmath/vec2/package-info.java +0 -6
- data/lib/java/monkstone/vecmath/vec3/Vec3.java +0 -727
- data/lib/java/monkstone/vecmath/vec3/package-info.java +0 -6
- data/lib/java/monkstone/videoevent/CaptureEvent.java +0 -27
- data/lib/java/monkstone/videoevent/MovieEvent.java +0 -32
- data/lib/java/monkstone/videoevent/package-info.java +0 -20
- data/lib/java/processing/awt/PGraphicsJava2D.java +0 -3040
- data/lib/java/processing/awt/PImageAWT.java +0 -377
- data/lib/java/processing/awt/PShapeJava2D.java +0 -387
- data/lib/java/processing/awt/PSurfaceAWT.java +0 -1581
- data/lib/java/processing/awt/ShimAWT.java +0 -581
- data/lib/java/processing/core/PApplet.java +0 -15156
- data/lib/java/processing/core/PConstants.java +0 -523
- data/lib/java/processing/core/PFont.java +0 -1126
- data/lib/java/processing/core/PGraphics.java +0 -8600
- data/lib/java/processing/core/PImage.java +0 -3377
- data/lib/java/processing/core/PMatrix.java +0 -208
- data/lib/java/processing/core/PMatrix2D.java +0 -562
- data/lib/java/processing/core/PMatrix3D.java +0 -890
- data/lib/java/processing/core/PShape.java +0 -3561
- data/lib/java/processing/core/PShapeOBJ.java +0 -483
- data/lib/java/processing/core/PShapeSVG.java +0 -2016
- data/lib/java/processing/core/PStyle.java +0 -63
- data/lib/java/processing/core/PSurface.java +0 -198
- data/lib/java/processing/core/PSurfaceNone.java +0 -431
- data/lib/java/processing/core/PVector.java +0 -1066
- data/lib/java/processing/core/ThinkDifferent.java +0 -115
- data/lib/java/processing/data/DoubleDict.java +0 -850
- data/lib/java/processing/data/DoubleList.java +0 -928
- data/lib/java/processing/data/FloatDict.java +0 -847
- data/lib/java/processing/data/FloatList.java +0 -936
- data/lib/java/processing/data/IntDict.java +0 -807
- data/lib/java/processing/data/IntList.java +0 -936
- data/lib/java/processing/data/JSONArray.java +0 -1260
- data/lib/java/processing/data/JSONObject.java +0 -2282
- data/lib/java/processing/data/JSONTokener.java +0 -435
- data/lib/java/processing/data/LongDict.java +0 -802
- data/lib/java/processing/data/LongList.java +0 -937
- data/lib/java/processing/data/Sort.java +0 -46
- data/lib/java/processing/data/StringDict.java +0 -613
- data/lib/java/processing/data/StringList.java +0 -800
- data/lib/java/processing/data/Table.java +0 -4936
- data/lib/java/processing/data/TableRow.java +0 -198
- data/lib/java/processing/data/XML.java +0 -1156
- data/lib/java/processing/dxf/RawDXF.java +0 -404
- data/lib/java/processing/event/Event.java +0 -125
- data/lib/java/processing/event/KeyEvent.java +0 -70
- data/lib/java/processing/event/MouseEvent.java +0 -114
- data/lib/java/processing/event/TouchEvent.java +0 -57
- data/lib/java/processing/javafx/PGraphicsFX2D.java +0 -32
- data/lib/java/processing/javafx/PSurfaceFX.java +0 -173
- data/lib/java/processing/net/Client.java +0 -744
- data/lib/java/processing/net/Server.java +0 -388
- data/lib/java/processing/opengl/FontTexture.java +0 -378
- data/lib/java/processing/opengl/FrameBuffer.java +0 -513
- data/lib/java/processing/opengl/LinePath.java +0 -627
- data/lib/java/processing/opengl/LineStroker.java +0 -681
- data/lib/java/processing/opengl/PGL.java +0 -3483
- data/lib/java/processing/opengl/PGraphics2D.java +0 -615
- data/lib/java/processing/opengl/PGraphics3D.java +0 -281
- data/lib/java/processing/opengl/PGraphicsOpenGL.java +0 -13753
- data/lib/java/processing/opengl/PJOGL.java +0 -2008
- data/lib/java/processing/opengl/PShader.java +0 -1484
- data/lib/java/processing/opengl/PShapeOpenGL.java +0 -5269
- data/lib/java/processing/opengl/PSurfaceJOGL.java +0 -1385
- data/lib/java/processing/opengl/Texture.java +0 -1696
- data/lib/java/processing/opengl/VertexBuffer.java +0 -88
- data/lib/java/processing/pdf/PGraphicsPDF.java +0 -581
- data/lib/java/processing/svg/PGraphicsSVG.java +0 -378
- data/src/main/java/processing/opengl/cursors/arrow.png +0 -0
- data/src/main/java/processing/opengl/cursors/cross.png +0 -0
- data/src/main/java/processing/opengl/cursors/hand.png +0 -0
- data/src/main/java/processing/opengl/cursors/license.txt +0 -27
- data/src/main/java/processing/opengl/cursors/move.png +0 -0
- data/src/main/java/processing/opengl/cursors/text.png +0 -0
- data/src/main/java/processing/opengl/cursors/wait.png +0 -0
- data/src/main/java/processing/opengl/shaders/ColorFrag.glsl +0 -32
- data/src/main/java/processing/opengl/shaders/ColorVert.glsl +0 -34
- data/src/main/java/processing/opengl/shaders/LightFrag.glsl +0 -33
- data/src/main/java/processing/opengl/shaders/LightVert.glsl +0 -151
- data/src/main/java/processing/opengl/shaders/LineFrag.glsl +0 -32
- data/src/main/java/processing/opengl/shaders/LineVert.glsl +0 -100
- data/src/main/java/processing/opengl/shaders/MaskFrag.glsl +0 -40
- data/src/main/java/processing/opengl/shaders/PointFrag.glsl +0 -32
- data/src/main/java/processing/opengl/shaders/PointVert.glsl +0 -56
- data/src/main/java/processing/opengl/shaders/TexFrag.glsl +0 -37
- data/src/main/java/processing/opengl/shaders/TexLightFrag.glsl +0 -37
- data/src/main/java/processing/opengl/shaders/TexLightVert.glsl +0 -157
- data/src/main/java/processing/opengl/shaders/TexVert.glsl +0 -38
@@ -1,513 +0,0 @@
|
|
1
|
-
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
/*
|
4
|
-
Part of the Processing project - http://processing.org
|
5
|
-
|
6
|
-
Copyright (c) 2012-15 The Processing Foundation
|
7
|
-
Copyright (c) 2004-12 Ben Fry and Casey Reas
|
8
|
-
Copyright (c) 2001-04 Massachusetts Institute of Technology
|
9
|
-
|
10
|
-
This library is free software; you can redistribute it and/or
|
11
|
-
modify it under the terms of the GNU Lesser General Public
|
12
|
-
License as published by the Free Software Foundation, version 2.1.
|
13
|
-
|
14
|
-
This library is distributed in the hope that it will be useful,
|
15
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
17
|
-
Lesser General Public License for more details.
|
18
|
-
|
19
|
-
You should have received a copy of the GNU Lesser General
|
20
|
-
Public License along with this library; if not, write to the
|
21
|
-
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
22
|
-
Boston, MA 02111-1307 USA
|
23
|
-
*/
|
24
|
-
|
25
|
-
package processing.opengl;
|
26
|
-
|
27
|
-
import processing.core.PApplet;
|
28
|
-
import processing.core.PConstants;
|
29
|
-
import processing.opengl.PGraphicsOpenGL.GLResourceFrameBuffer;
|
30
|
-
|
31
|
-
import java.nio.IntBuffer;
|
32
|
-
|
33
|
-
/**
|
34
|
-
* Encapsulates a Frame Buffer Object for offscreen rendering.
|
35
|
-
* When created with onscreen == true, it represents the normal
|
36
|
-
* framebuffer. Needed by the stack mechanism in OPENGL2 to return
|
37
|
-
* to onscreen rendering after a sequence of pushFramebuffer calls.
|
38
|
-
* It transparently handles the situations when the FBO extension is
|
39
|
-
* not available.
|
40
|
-
*
|
41
|
-
* By Andres Colubri.
|
42
|
-
*/
|
43
|
-
|
44
|
-
public class FrameBuffer implements PConstants {
|
45
|
-
protected PGraphicsOpenGL pg;
|
46
|
-
protected PGL pgl;
|
47
|
-
protected int context; // The context that created this framebuffer.
|
48
|
-
|
49
|
-
public int glFbo;
|
50
|
-
public int glDepth;
|
51
|
-
public int glStencil;
|
52
|
-
public int glDepthStencil;
|
53
|
-
public int glMultisample;
|
54
|
-
public int width;
|
55
|
-
public int height;
|
56
|
-
private GLResourceFrameBuffer glres;
|
57
|
-
|
58
|
-
protected int depthBits;
|
59
|
-
protected int stencilBits;
|
60
|
-
protected boolean packedDepthStencil;
|
61
|
-
|
62
|
-
protected boolean multisample;
|
63
|
-
protected int nsamples;
|
64
|
-
|
65
|
-
protected int numColorBuffers;
|
66
|
-
protected Texture[] colorBufferTex;
|
67
|
-
|
68
|
-
protected boolean screenFb;
|
69
|
-
protected boolean noDepth;
|
70
|
-
|
71
|
-
protected IntBuffer pixelBuffer;
|
72
|
-
|
73
|
-
|
74
|
-
FrameBuffer(PGraphicsOpenGL pg) {
|
75
|
-
this.pg = pg;
|
76
|
-
pgl = pg.pgl;
|
77
|
-
context = pgl.createEmptyContext();
|
78
|
-
}
|
79
|
-
|
80
|
-
|
81
|
-
FrameBuffer(PGraphicsOpenGL pg, int w, int h, int samples, int colorBuffers,
|
82
|
-
int depthBits, int stencilBits, boolean packedDepthStencil,
|
83
|
-
boolean screen) {
|
84
|
-
this(pg);
|
85
|
-
|
86
|
-
glFbo = 0;
|
87
|
-
glDepth = 0;
|
88
|
-
glStencil = 0;
|
89
|
-
glDepthStencil = 0;
|
90
|
-
glMultisample = 0;
|
91
|
-
|
92
|
-
if (screen) {
|
93
|
-
// If this framebuffer is used to represent a on-screen buffer,
|
94
|
-
// then it doesn't make it sense for it to have multisampling,
|
95
|
-
// color, depth or stencil buffers.
|
96
|
-
depthBits = stencilBits = samples = colorBuffers = 0;
|
97
|
-
}
|
98
|
-
|
99
|
-
width = w;
|
100
|
-
height = h;
|
101
|
-
|
102
|
-
if (1 < samples) {
|
103
|
-
multisample = true;
|
104
|
-
nsamples = samples;
|
105
|
-
} else {
|
106
|
-
multisample = false;
|
107
|
-
nsamples = 1;
|
108
|
-
}
|
109
|
-
|
110
|
-
numColorBuffers = colorBuffers;
|
111
|
-
colorBufferTex = new Texture[numColorBuffers];
|
112
|
-
for (int i = 0; i < numColorBuffers; i++) {
|
113
|
-
colorBufferTex[i] = null;
|
114
|
-
}
|
115
|
-
|
116
|
-
if (depthBits < 1 && stencilBits < 1) {
|
117
|
-
this.depthBits = 0;
|
118
|
-
this.stencilBits = 0;
|
119
|
-
this.packedDepthStencil = false;
|
120
|
-
} else {
|
121
|
-
if (packedDepthStencil) {
|
122
|
-
// When combined depth/stencil format is required, the depth and stencil
|
123
|
-
// bits are overriden and the 24/8 combination for a 32 bits surface is
|
124
|
-
// used.
|
125
|
-
this.depthBits = 24;
|
126
|
-
this.stencilBits = 8;
|
127
|
-
this.packedDepthStencil = true;
|
128
|
-
} else {
|
129
|
-
this.depthBits = depthBits;
|
130
|
-
this.stencilBits = stencilBits;
|
131
|
-
this.packedDepthStencil = false;
|
132
|
-
}
|
133
|
-
}
|
134
|
-
|
135
|
-
screenFb = screen;
|
136
|
-
|
137
|
-
allocate();
|
138
|
-
noDepth = false;
|
139
|
-
|
140
|
-
pixelBuffer = null;
|
141
|
-
}
|
142
|
-
|
143
|
-
|
144
|
-
FrameBuffer(PGraphicsOpenGL pg, int w, int h) {
|
145
|
-
this(pg, w, h, 1, 1, 0, 0, false, false);
|
146
|
-
}
|
147
|
-
|
148
|
-
|
149
|
-
FrameBuffer(PGraphicsOpenGL pg, int w, int h, boolean screen) {
|
150
|
-
this(pg, w, h, 1, 1, 0, 0, false, screen);
|
151
|
-
}
|
152
|
-
|
153
|
-
|
154
|
-
public void clear() {
|
155
|
-
pg.pushFramebuffer();
|
156
|
-
pg.setFramebuffer(this);
|
157
|
-
pgl.clearDepth(1);
|
158
|
-
pgl.clearStencil(0);
|
159
|
-
pgl.clearColor(0, 0, 0, 0);
|
160
|
-
pgl.clear(PGL.DEPTH_BUFFER_BIT |
|
161
|
-
PGL.STENCIL_BUFFER_BIT |
|
162
|
-
PGL.COLOR_BUFFER_BIT);
|
163
|
-
pg.popFramebuffer();
|
164
|
-
}
|
165
|
-
|
166
|
-
public void copyColor(FrameBuffer dest) {
|
167
|
-
copy(dest, PGL.COLOR_BUFFER_BIT);
|
168
|
-
}
|
169
|
-
|
170
|
-
public void copyDepth(FrameBuffer dest) {
|
171
|
-
copy(dest, PGL.DEPTH_BUFFER_BIT);
|
172
|
-
}
|
173
|
-
|
174
|
-
public void copyStencil(FrameBuffer dest) {
|
175
|
-
copy(dest, PGL.STENCIL_BUFFER_BIT);
|
176
|
-
}
|
177
|
-
|
178
|
-
public void copy(FrameBuffer dest, int mask) {
|
179
|
-
pgl.bindFramebufferImpl(PGL.READ_FRAMEBUFFER, this.glFbo);
|
180
|
-
pgl.bindFramebufferImpl(PGL.DRAW_FRAMEBUFFER, dest.glFbo);
|
181
|
-
pgl.blitFramebuffer(0, 0, this.width, this.height,
|
182
|
-
0, 0, dest.width, dest.height, mask, PGL.NEAREST);
|
183
|
-
pgl.bindFramebufferImpl(PGL.READ_FRAMEBUFFER, pg.getCurrentFB().glFbo);
|
184
|
-
pgl.bindFramebufferImpl(PGL.DRAW_FRAMEBUFFER, pg.getCurrentFB().glFbo);
|
185
|
-
}
|
186
|
-
|
187
|
-
public void bind() {
|
188
|
-
pgl.bindFramebufferImpl(PGL.FRAMEBUFFER, glFbo);
|
189
|
-
}
|
190
|
-
|
191
|
-
public void disableDepthTest() {
|
192
|
-
noDepth = true;
|
193
|
-
}
|
194
|
-
|
195
|
-
public void finish() {
|
196
|
-
if (noDepth) {
|
197
|
-
// No need to clear depth buffer because depth testing was disabled.
|
198
|
-
if (pg.getHint(ENABLE_DEPTH_TEST)) {
|
199
|
-
pgl.enable(PGL.DEPTH_TEST);
|
200
|
-
} else {
|
201
|
-
pgl.disable(PGL.DEPTH_TEST);
|
202
|
-
}
|
203
|
-
}
|
204
|
-
}
|
205
|
-
|
206
|
-
public void readPixels() {
|
207
|
-
if (pixelBuffer == null) createPixelBuffer();
|
208
|
-
pixelBuffer.rewind();
|
209
|
-
pgl.readPixels(0, 0, width, height, PGL.RGBA, PGL.UNSIGNED_BYTE,
|
210
|
-
pixelBuffer);
|
211
|
-
}
|
212
|
-
|
213
|
-
public void getPixels(int[] pixels) {
|
214
|
-
if (pixelBuffer != null) {
|
215
|
-
pixelBuffer.get(pixels, 0, pixels.length);
|
216
|
-
pixelBuffer.rewind();
|
217
|
-
}
|
218
|
-
}
|
219
|
-
|
220
|
-
public IntBuffer getPixelBuffer() {
|
221
|
-
return pixelBuffer;
|
222
|
-
}
|
223
|
-
|
224
|
-
public boolean hasDepthBuffer() {
|
225
|
-
return 0 < depthBits;
|
226
|
-
}
|
227
|
-
|
228
|
-
public boolean hasStencilBuffer() {
|
229
|
-
return 0 < stencilBits;
|
230
|
-
}
|
231
|
-
|
232
|
-
public void setFBO(int id) {
|
233
|
-
if (screenFb) {
|
234
|
-
glFbo = id;
|
235
|
-
}
|
236
|
-
}
|
237
|
-
|
238
|
-
///////////////////////////////////////////////////////////
|
239
|
-
|
240
|
-
// Color buffer setters.
|
241
|
-
|
242
|
-
|
243
|
-
public void setColorBuffer(Texture tex) {
|
244
|
-
setColorBuffers(new Texture[] { tex }, 1);
|
245
|
-
}
|
246
|
-
|
247
|
-
|
248
|
-
public void setColorBuffers(Texture[] textures) {
|
249
|
-
setColorBuffers(textures, textures.length);
|
250
|
-
}
|
251
|
-
|
252
|
-
|
253
|
-
public void setColorBuffers(Texture[] textures, int n) {
|
254
|
-
if (screenFb) return;
|
255
|
-
|
256
|
-
if (numColorBuffers != PApplet.min(n, textures.length)) {
|
257
|
-
throw new RuntimeException("Wrong number of textures to set the color " +
|
258
|
-
"buffers.");
|
259
|
-
}
|
260
|
-
|
261
|
-
System.arraycopy(textures, 0, colorBufferTex, 0, numColorBuffers);
|
262
|
-
|
263
|
-
pg.pushFramebuffer();
|
264
|
-
pg.setFramebuffer(this);
|
265
|
-
|
266
|
-
// Making sure nothing is attached.
|
267
|
-
for (int i = 0; i < numColorBuffers; i++) {
|
268
|
-
pgl.framebufferTexture2D(PGL.FRAMEBUFFER, PGL.COLOR_ATTACHMENT0 + i,
|
269
|
-
PGL.TEXTURE_2D, 0, 0);
|
270
|
-
}
|
271
|
-
|
272
|
-
for (int i = 0; i < numColorBuffers; i++) {
|
273
|
-
pgl.framebufferTexture2D(PGL.FRAMEBUFFER, PGL.COLOR_ATTACHMENT0 + i,
|
274
|
-
colorBufferTex[i].glTarget,
|
275
|
-
colorBufferTex[i].glName, 0);
|
276
|
-
}
|
277
|
-
|
278
|
-
pgl.validateFramebuffer();
|
279
|
-
|
280
|
-
pg.popFramebuffer();
|
281
|
-
}
|
282
|
-
|
283
|
-
|
284
|
-
public void swapColorBuffers() {
|
285
|
-
for (int i = 0; i < numColorBuffers - 1; i++) {
|
286
|
-
int i1 = (i + 1);
|
287
|
-
Texture tmp = colorBufferTex[i];
|
288
|
-
colorBufferTex[i] = colorBufferTex[i1];
|
289
|
-
colorBufferTex[i1] = tmp;
|
290
|
-
}
|
291
|
-
|
292
|
-
pg.pushFramebuffer();
|
293
|
-
pg.setFramebuffer(this);
|
294
|
-
for (int i = 0; i < numColorBuffers; i++) {
|
295
|
-
pgl.framebufferTexture2D(PGL.FRAMEBUFFER, PGL.COLOR_ATTACHMENT0 + i,
|
296
|
-
colorBufferTex[i].glTarget,
|
297
|
-
colorBufferTex[i].glName, 0);
|
298
|
-
}
|
299
|
-
pgl.validateFramebuffer();
|
300
|
-
|
301
|
-
pg.popFramebuffer();
|
302
|
-
}
|
303
|
-
|
304
|
-
|
305
|
-
public int getDefaultReadBuffer() {
|
306
|
-
if (screenFb) {
|
307
|
-
return pgl.getDefaultReadBuffer();
|
308
|
-
} else {
|
309
|
-
return PGL.COLOR_ATTACHMENT0;
|
310
|
-
}
|
311
|
-
}
|
312
|
-
|
313
|
-
|
314
|
-
public int getDefaultDrawBuffer() {
|
315
|
-
if (screenFb) {
|
316
|
-
return pgl.getDefaultDrawBuffer();
|
317
|
-
} else {
|
318
|
-
return PGL.COLOR_ATTACHMENT0;
|
319
|
-
}
|
320
|
-
}
|
321
|
-
|
322
|
-
|
323
|
-
///////////////////////////////////////////////////////////
|
324
|
-
|
325
|
-
// Allocate/release framebuffer.
|
326
|
-
|
327
|
-
|
328
|
-
protected final void allocate() {
|
329
|
-
dispose(); // Just in the case this object is being re-allocated.
|
330
|
-
|
331
|
-
context = pgl.getCurrentContext();
|
332
|
-
glres = new GLResourceFrameBuffer(this); // create the FBO resources...
|
333
|
-
|
334
|
-
if (screenFb) {
|
335
|
-
glFbo = 0;
|
336
|
-
} else {
|
337
|
-
if (multisample) {
|
338
|
-
initColorBufferMultisample();
|
339
|
-
}
|
340
|
-
|
341
|
-
if (packedDepthStencil) {
|
342
|
-
initPackedDepthStencilBuffer();
|
343
|
-
} else {
|
344
|
-
if (0 < depthBits) {
|
345
|
-
initDepthBuffer();
|
346
|
-
}
|
347
|
-
if (0 < stencilBits) {
|
348
|
-
initStencilBuffer();
|
349
|
-
}
|
350
|
-
}
|
351
|
-
}
|
352
|
-
}
|
353
|
-
|
354
|
-
|
355
|
-
protected void dispose() {
|
356
|
-
if (screenFb) return;
|
357
|
-
if (glres != null) {
|
358
|
-
glres.dispose();
|
359
|
-
glFbo = 0;
|
360
|
-
glDepth = 0;
|
361
|
-
glStencil = 0;
|
362
|
-
glMultisample = 0;
|
363
|
-
glDepthStencil = 0;
|
364
|
-
glres = null;
|
365
|
-
}
|
366
|
-
}
|
367
|
-
|
368
|
-
|
369
|
-
protected boolean contextIsOutdated() {
|
370
|
-
if (screenFb) return false;
|
371
|
-
|
372
|
-
boolean outdated = !pgl.contextIsCurrent(context);
|
373
|
-
if (outdated) {
|
374
|
-
dispose();
|
375
|
-
for (int i = 0; i < numColorBuffers; i++) {
|
376
|
-
colorBufferTex[i] = null;
|
377
|
-
}
|
378
|
-
}
|
379
|
-
return outdated;
|
380
|
-
}
|
381
|
-
|
382
|
-
|
383
|
-
protected void initColorBufferMultisample() {
|
384
|
-
if (screenFb) return;
|
385
|
-
|
386
|
-
pg.pushFramebuffer();
|
387
|
-
pg.setFramebuffer(this);
|
388
|
-
|
389
|
-
pgl.bindRenderbuffer(PGL.RENDERBUFFER, glMultisample);
|
390
|
-
pgl.renderbufferStorageMultisample(PGL.RENDERBUFFER, nsamples,
|
391
|
-
PGL.RGBA8, width, height);
|
392
|
-
pgl.framebufferRenderbuffer(PGL.FRAMEBUFFER, PGL.COLOR_ATTACHMENT0,
|
393
|
-
PGL.RENDERBUFFER, glMultisample);
|
394
|
-
|
395
|
-
pg.popFramebuffer();
|
396
|
-
}
|
397
|
-
|
398
|
-
|
399
|
-
protected void initPackedDepthStencilBuffer() {
|
400
|
-
if (screenFb) return;
|
401
|
-
|
402
|
-
if (width == 0 || height == 0) {
|
403
|
-
throw new RuntimeException("PFramebuffer: size undefined.");
|
404
|
-
}
|
405
|
-
|
406
|
-
pg.pushFramebuffer();
|
407
|
-
pg.setFramebuffer(this);
|
408
|
-
|
409
|
-
pgl.bindRenderbuffer(PGL.RENDERBUFFER, glDepthStencil);
|
410
|
-
|
411
|
-
if (multisample) {
|
412
|
-
pgl.renderbufferStorageMultisample(PGL.RENDERBUFFER, nsamples,
|
413
|
-
PGL.DEPTH24_STENCIL8, width, height);
|
414
|
-
} else {
|
415
|
-
pgl.renderbufferStorage(PGL.RENDERBUFFER, PGL.DEPTH24_STENCIL8,
|
416
|
-
width, height);
|
417
|
-
}
|
418
|
-
|
419
|
-
pgl.framebufferRenderbuffer(PGL.FRAMEBUFFER, PGL.DEPTH_ATTACHMENT,
|
420
|
-
PGL.RENDERBUFFER, glDepthStencil);
|
421
|
-
pgl.framebufferRenderbuffer(PGL.FRAMEBUFFER, PGL.STENCIL_ATTACHMENT,
|
422
|
-
PGL.RENDERBUFFER, glDepthStencil);
|
423
|
-
|
424
|
-
pg.popFramebuffer();
|
425
|
-
}
|
426
|
-
|
427
|
-
|
428
|
-
protected void initDepthBuffer() {
|
429
|
-
if (screenFb) return;
|
430
|
-
|
431
|
-
if (width == 0 || height == 0) {
|
432
|
-
throw new RuntimeException("PFramebuffer: size undefined.");
|
433
|
-
}
|
434
|
-
|
435
|
-
pg.pushFramebuffer();
|
436
|
-
pg.setFramebuffer(this);
|
437
|
-
|
438
|
-
pgl.bindRenderbuffer(PGL.RENDERBUFFER, glDepth);
|
439
|
-
|
440
|
-
int glConst = PGL.DEPTH_COMPONENT16;
|
441
|
-
switch (depthBits) {
|
442
|
-
case 16:
|
443
|
-
glConst = PGL.DEPTH_COMPONENT16;
|
444
|
-
break;
|
445
|
-
case 24:
|
446
|
-
glConst = PGL.DEPTH_COMPONENT24;
|
447
|
-
break;
|
448
|
-
case 32:
|
449
|
-
glConst = PGL.DEPTH_COMPONENT32;
|
450
|
-
break;
|
451
|
-
default:
|
452
|
-
break;
|
453
|
-
}
|
454
|
-
|
455
|
-
if (multisample) {
|
456
|
-
pgl.renderbufferStorageMultisample(PGL.RENDERBUFFER, nsamples, glConst,
|
457
|
-
width, height);
|
458
|
-
} else {
|
459
|
-
pgl.renderbufferStorage(PGL.RENDERBUFFER, glConst, width, height);
|
460
|
-
}
|
461
|
-
|
462
|
-
pgl.framebufferRenderbuffer(PGL.FRAMEBUFFER, PGL.DEPTH_ATTACHMENT,
|
463
|
-
PGL.RENDERBUFFER, glDepth);
|
464
|
-
|
465
|
-
pg.popFramebuffer();
|
466
|
-
}
|
467
|
-
|
468
|
-
|
469
|
-
protected void initStencilBuffer() {
|
470
|
-
if (screenFb) return;
|
471
|
-
|
472
|
-
if (width == 0 || height == 0) {
|
473
|
-
throw new RuntimeException("PFramebuffer: size undefined.");
|
474
|
-
}
|
475
|
-
|
476
|
-
pg.pushFramebuffer();
|
477
|
-
pg.setFramebuffer(this);
|
478
|
-
|
479
|
-
pgl.bindRenderbuffer(PGL.RENDERBUFFER, glStencil);
|
480
|
-
|
481
|
-
int glConst = PGL.STENCIL_INDEX1;
|
482
|
-
switch (stencilBits) {
|
483
|
-
case 1:
|
484
|
-
glConst = PGL.STENCIL_INDEX1;
|
485
|
-
break;
|
486
|
-
case 4:
|
487
|
-
glConst = PGL.STENCIL_INDEX4;
|
488
|
-
break;
|
489
|
-
case 8:
|
490
|
-
glConst = PGL.STENCIL_INDEX8;
|
491
|
-
break;
|
492
|
-
default:
|
493
|
-
break;
|
494
|
-
}
|
495
|
-
if (multisample) {
|
496
|
-
pgl.renderbufferStorageMultisample(PGL.RENDERBUFFER, nsamples, glConst,
|
497
|
-
width, height);
|
498
|
-
} else {
|
499
|
-
pgl.renderbufferStorage(PGL.RENDERBUFFER, glConst, width, height);
|
500
|
-
}
|
501
|
-
|
502
|
-
pgl.framebufferRenderbuffer(PGL.FRAMEBUFFER, PGL.STENCIL_ATTACHMENT,
|
503
|
-
PGL.RENDERBUFFER, glStencil);
|
504
|
-
|
505
|
-
pg.popFramebuffer();
|
506
|
-
}
|
507
|
-
|
508
|
-
|
509
|
-
protected void createPixelBuffer() {
|
510
|
-
pixelBuffer = IntBuffer.allocate(width * height);
|
511
|
-
pixelBuffer.rewind();
|
512
|
-
}
|
513
|
-
}
|