propane 3.6.0-java → 3.10.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/extensions.xml +1 -1
  3. data/.travis.yml +1 -1
  4. data/CHANGELOG.md +5 -1
  5. data/README.md +6 -13
  6. data/Rakefile +7 -6
  7. data/lib/java/japplemenubar/JAppleMenuBar.java +88 -0
  8. data/lib/java/japplemenubar/libjAppleMenuBar.jnilib +0 -0
  9. data/lib/java/monkstone/ColorUtil.java +127 -0
  10. data/lib/java/monkstone/MathToolModule.java +287 -0
  11. data/lib/java/monkstone/PropaneLibrary.java +46 -0
  12. data/lib/java/monkstone/core/LibraryProxy.java +136 -0
  13. data/lib/java/monkstone/fastmath/DegLutTables.java +111 -0
  14. data/lib/java/monkstone/fastmath/Deglut.java +71 -0
  15. data/lib/java/monkstone/fastmath/package-info.java +6 -0
  16. data/lib/java/monkstone/filechooser/Chooser.java +39 -0
  17. data/lib/java/monkstone/noise/FastTerrain.java +874 -0
  18. data/lib/java/monkstone/noise/Noise.java +90 -0
  19. data/lib/java/monkstone/noise/NoiseGenerator.java +75 -0
  20. data/lib/java/monkstone/noise/NoiseMode.java +28 -0
  21. data/lib/java/monkstone/noise/OpenSimplex2F.java +881 -0
  22. data/lib/java/monkstone/noise/OpenSimplex2S.java +1106 -0
  23. data/lib/java/monkstone/noise/SmoothTerrain.java +1099 -0
  24. data/lib/java/monkstone/slider/CustomHorizontalSlider.java +164 -0
  25. data/lib/java/monkstone/slider/CustomVerticalSlider.java +178 -0
  26. data/lib/java/monkstone/slider/SimpleHorizontalSlider.java +145 -0
  27. data/lib/java/monkstone/slider/SimpleSlider.java +166 -0
  28. data/lib/java/monkstone/slider/SimpleVerticalSlider.java +157 -0
  29. data/lib/java/monkstone/slider/Slider.java +61 -0
  30. data/lib/java/monkstone/slider/SliderBar.java +245 -0
  31. data/lib/java/monkstone/slider/SliderGroup.java +56 -0
  32. data/lib/java/monkstone/slider/WheelHandler.java +35 -0
  33. data/lib/java/monkstone/vecmath/GfxRender.java +86 -0
  34. data/lib/java/monkstone/vecmath/JRender.java +56 -0
  35. data/lib/java/monkstone/vecmath/ShapeRender.java +87 -0
  36. data/lib/java/monkstone/vecmath/package-info.java +20 -0
  37. data/lib/java/monkstone/vecmath/vec2/Vec2.java +802 -0
  38. data/lib/java/monkstone/vecmath/vec2/package-info.java +6 -0
  39. data/lib/java/monkstone/vecmath/vec3/Vec3.java +727 -0
  40. data/lib/java/monkstone/vecmath/vec3/package-info.java +6 -0
  41. data/lib/java/monkstone/videoevent/CaptureEvent.java +27 -0
  42. data/lib/java/monkstone/videoevent/MovieEvent.java +32 -0
  43. data/lib/java/monkstone/videoevent/package-info.java +20 -0
  44. data/lib/java/processing/awt/PGraphicsJava2D.java +3040 -0
  45. data/lib/java/processing/awt/PImageAWT.java +377 -0
  46. data/lib/java/processing/awt/PShapeJava2D.java +387 -0
  47. data/lib/java/processing/awt/PSurfaceAWT.java +1581 -0
  48. data/lib/java/processing/awt/ShimAWT.java +581 -0
  49. data/lib/java/processing/core/PApplet.java +15156 -0
  50. data/lib/java/processing/core/PConstants.java +523 -0
  51. data/lib/java/processing/core/PFont.java +1126 -0
  52. data/lib/java/processing/core/PGraphics.java +8600 -0
  53. data/lib/java/processing/core/PImage.java +3377 -0
  54. data/lib/java/processing/core/PMatrix.java +208 -0
  55. data/lib/java/processing/core/PMatrix2D.java +562 -0
  56. data/lib/java/processing/core/PMatrix3D.java +890 -0
  57. data/lib/java/processing/core/PShape.java +3561 -0
  58. data/lib/java/processing/core/PShapeOBJ.java +483 -0
  59. data/lib/java/processing/core/PShapeSVG.java +2016 -0
  60. data/lib/java/processing/core/PStyle.java +63 -0
  61. data/lib/java/processing/core/PSurface.java +198 -0
  62. data/lib/java/processing/core/PSurfaceNone.java +431 -0
  63. data/lib/java/processing/core/PVector.java +1066 -0
  64. data/lib/java/processing/core/ThinkDifferent.java +115 -0
  65. data/lib/java/processing/data/DoubleDict.java +850 -0
  66. data/lib/java/processing/data/DoubleList.java +928 -0
  67. data/lib/java/processing/data/FloatDict.java +847 -0
  68. data/lib/java/processing/data/FloatList.java +936 -0
  69. data/lib/java/processing/data/IntDict.java +807 -0
  70. data/lib/java/processing/data/IntList.java +936 -0
  71. data/lib/java/processing/data/JSONArray.java +1260 -0
  72. data/lib/java/processing/data/JSONObject.java +2282 -0
  73. data/lib/java/processing/data/JSONTokener.java +435 -0
  74. data/lib/java/processing/data/LongDict.java +802 -0
  75. data/lib/java/processing/data/LongList.java +937 -0
  76. data/lib/java/processing/data/Sort.java +46 -0
  77. data/lib/java/processing/data/StringDict.java +613 -0
  78. data/lib/java/processing/data/StringList.java +800 -0
  79. data/lib/java/processing/data/Table.java +4936 -0
  80. data/lib/java/processing/data/TableRow.java +198 -0
  81. data/lib/java/processing/data/XML.java +1156 -0
  82. data/lib/java/processing/dxf/RawDXF.java +404 -0
  83. data/lib/java/processing/event/Event.java +125 -0
  84. data/lib/java/processing/event/KeyEvent.java +70 -0
  85. data/lib/java/processing/event/MouseEvent.java +114 -0
  86. data/lib/java/processing/event/TouchEvent.java +57 -0
  87. data/lib/java/processing/javafx/PGraphicsFX2D.java +32 -0
  88. data/lib/java/processing/javafx/PSurfaceFX.java +173 -0
  89. data/lib/java/processing/net/Client.java +744 -0
  90. data/lib/java/processing/net/Server.java +388 -0
  91. data/lib/java/processing/opengl/FontTexture.java +378 -0
  92. data/lib/java/processing/opengl/FrameBuffer.java +513 -0
  93. data/lib/java/processing/opengl/LinePath.java +627 -0
  94. data/lib/java/processing/opengl/LineStroker.java +681 -0
  95. data/lib/java/processing/opengl/PGL.java +3483 -0
  96. data/lib/java/processing/opengl/PGraphics2D.java +615 -0
  97. data/lib/java/processing/opengl/PGraphics3D.java +281 -0
  98. data/lib/java/processing/opengl/PGraphicsOpenGL.java +13753 -0
  99. data/lib/java/processing/opengl/PJOGL.java +2008 -0
  100. data/lib/java/processing/opengl/PShader.java +1484 -0
  101. data/lib/java/processing/opengl/PShapeOpenGL.java +5269 -0
  102. data/lib/java/processing/opengl/PSurfaceJOGL.java +1385 -0
  103. data/lib/java/processing/opengl/Texture.java +1696 -0
  104. data/lib/java/processing/opengl/VertexBuffer.java +88 -0
  105. data/lib/java/processing/opengl/cursors/arrow.png +0 -0
  106. data/lib/java/processing/opengl/cursors/cross.png +0 -0
  107. data/lib/java/processing/opengl/cursors/hand.png +0 -0
  108. data/lib/java/processing/opengl/cursors/license.txt +27 -0
  109. data/lib/java/processing/opengl/cursors/move.png +0 -0
  110. data/lib/java/processing/opengl/cursors/text.png +0 -0
  111. data/lib/java/processing/opengl/cursors/wait.png +0 -0
  112. data/lib/java/processing/opengl/shaders/ColorFrag.glsl +32 -0
  113. data/lib/java/processing/opengl/shaders/ColorVert.glsl +34 -0
  114. data/lib/java/processing/opengl/shaders/LightFrag.glsl +33 -0
  115. data/lib/java/processing/opengl/shaders/LightVert.glsl +151 -0
  116. data/lib/java/processing/opengl/shaders/LineFrag.glsl +32 -0
  117. data/lib/java/processing/opengl/shaders/LineVert.glsl +100 -0
  118. data/lib/java/processing/opengl/shaders/MaskFrag.glsl +40 -0
  119. data/lib/java/processing/opengl/shaders/PointFrag.glsl +32 -0
  120. data/lib/java/processing/opengl/shaders/PointVert.glsl +56 -0
  121. data/lib/java/processing/opengl/shaders/TexFrag.glsl +37 -0
  122. data/lib/java/processing/opengl/shaders/TexLightFrag.glsl +37 -0
  123. data/lib/java/processing/opengl/shaders/TexLightVert.glsl +157 -0
  124. data/lib/java/processing/opengl/shaders/TexVert.glsl +38 -0
  125. data/lib/java/processing/pdf/PGraphicsPDF.java +581 -0
  126. data/lib/java/processing/svg/PGraphicsSVG.java +378 -0
  127. data/lib/propane/app.rb +9 -10
  128. data/lib/propane/runner.rb +10 -12
  129. data/lib/propane/version.rb +1 -1
  130. data/library/pdf/pdf.rb +7 -0
  131. data/library/svg/svg.rb +7 -0
  132. data/mvnw +3 -3
  133. data/mvnw.cmd +2 -2
  134. data/pom.rb +30 -3
  135. data/pom.xml +54 -3
  136. data/propane.gemspec +7 -3
  137. data/src/main/java/monkstone/FastNoiseModuleJava.java +127 -0
  138. data/src/main/java/monkstone/MathToolModule.java +30 -30
  139. data/src/main/java/monkstone/PropaneLibrary.java +2 -0
  140. data/src/main/java/monkstone/SmoothNoiseModuleJava.java +127 -0
  141. data/src/main/java/monkstone/fastmath/DegLutTables.java +111 -0
  142. data/src/main/java/monkstone/fastmath/Deglut.java +6 -56
  143. data/src/main/java/monkstone/filechooser/Chooser.java +1 -1
  144. data/src/main/java/monkstone/noise/OpenSimplex2F.java +813 -0
  145. data/src/main/java/monkstone/noise/OpenSimplex2S.java +1138 -0
  146. data/src/main/java/monkstone/slider/WheelHandler.java +1 -1
  147. data/src/main/java/monkstone/vecmath/JRender.java +6 -6
  148. data/src/main/java/monkstone/vecmath/vec2/Vec2.java +20 -19
  149. data/src/main/java/monkstone/vecmath/vec3/Vec3.java +12 -12
  150. data/src/main/java/processing/awt/PGraphicsJava2D.java +11 -3
  151. data/src/main/java/processing/core/PApplet.java +13242 -13374
  152. data/src/main/java/processing/core/PConstants.java +155 -163
  153. data/src/main/java/processing/core/PGraphics.java +118 -111
  154. data/src/main/java/processing/opengl/PJOGL.java +6 -5
  155. data/src/main/java/processing/pdf/PGraphicsPDF.java +581 -0
  156. data/src/main/java/processing/svg/PGraphicsSVG.java +378 -0
  157. data/test/deglut_spec_test.rb +2 -2
  158. data/vendors/Rakefile +1 -1
  159. metadata +146 -17
  160. data/library/simplex_noise/simplex_noise.rb +0 -5
  161. data/src/main/java/monkstone/noise/SimplexNoise.java +0 -436
@@ -0,0 +1,2008 @@
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 java.awt.Font;
28
+ import java.awt.FontMetrics;
29
+ import java.awt.Shape;
30
+ import java.awt.Toolkit;
31
+ import java.awt.font.FontRenderContext;
32
+ import java.awt.font.GlyphVector;
33
+ import java.awt.geom.PathIterator;
34
+ import java.io.IOException;
35
+ import java.net.URL;
36
+ import java.nio.Buffer;
37
+ import java.nio.ByteBuffer;
38
+ import java.nio.FloatBuffer;
39
+ import java.nio.IntBuffer;
40
+
41
+ import com.jogamp.common.util.VersionNumber;
42
+ import com.jogamp.opengl.GL;
43
+ import com.jogamp.opengl.GL2;
44
+ import com.jogamp.opengl.GL2ES2;
45
+ import com.jogamp.opengl.GL2ES3;
46
+ import com.jogamp.opengl.GL2GL3;
47
+ import com.jogamp.opengl.GL3ES3;
48
+ import com.jogamp.opengl.GLAutoDrawable;
49
+ import com.jogamp.opengl.GLCapabilities;
50
+ import com.jogamp.opengl.GLCapabilitiesImmutable;
51
+ import com.jogamp.opengl.GLContext;
52
+ import com.jogamp.opengl.GLDrawable;
53
+ import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
54
+ import com.jogamp.opengl.glu.GLU;
55
+ import com.jogamp.opengl.glu.GLUtessellator;
56
+ import com.jogamp.opengl.glu.GLUtessellatorCallbackAdapter;
57
+ import com.jogamp.opengl.util.awt.AWTGLReadBufferUtil;
58
+
59
+ import processing.awt.PImageAWT;
60
+ import processing.core.PApplet;
61
+ import processing.core.PGraphics;
62
+ import processing.core.PImage;
63
+ import processing.core.PMatrix3D;
64
+ import processing.core.PSurface;
65
+
66
+
67
+ public class PJOGL extends PGL {
68
+ // OpenGL profile to use (2, 3 or 4)
69
+ public static int profile = 2;
70
+
71
+ // User-provided icons to override defaults
72
+ protected static String[] icons = null;
73
+
74
+ // The two windowing toolkits available to use in JOGL:
75
+ public static final int AWT = 0; // http://jogamp.org/wiki/index.php/Using_JOGL_in_AWT_SWT_and_Swing
76
+ public static final int NEWT = 1; // http://jogamp.org/jogl/doc/NEWT-Overview.html
77
+
78
+ // ........................................................
79
+
80
+ // Public members to access the underlying GL objects and context
81
+
82
+ /** Basic GL functionality, common to all profiles */
83
+ public GL gl;
84
+
85
+ /** GLU interface **/
86
+ public GLU glu;
87
+
88
+ /** The rendering context (holds rendering state info) */
89
+ public GLContext context;
90
+
91
+ // ........................................................
92
+
93
+ // Additional parameters
94
+
95
+ /** Time that the Processing's animation thread will wait for JOGL's rendering
96
+ * thread to be done with a single frame.
97
+ */
98
+ protected static int DRAW_TIMEOUT_MILLIS = 500;
99
+
100
+ // ........................................................
101
+
102
+ // Protected JOGL-specific objects needed to access the GL profiles
103
+
104
+ /** The capabilities of the OpenGL rendering surface */
105
+ protected GLCapabilitiesImmutable capabilities;
106
+
107
+ /** The rendering surface */
108
+ protected GLDrawable drawable;
109
+
110
+ /** GLES2 functionality (shaders, etc) */
111
+ protected GL2ES2 gl2;
112
+
113
+ /** GL3 interface */
114
+ protected GL2GL3 gl3;
115
+
116
+ /** GL2 desktop functionality (blit framebuffer, map buffer range,
117
+ * multisampled renderbuffers) */
118
+ protected GL2 gl2x;
119
+
120
+ /** GL3ES3 interface */
121
+ protected GL3ES3 gl3es3;
122
+
123
+ /** Stores exceptions that ocurred during drawing */
124
+ protected Exception drawException;
125
+
126
+ // ........................................................
127
+
128
+ // Utility arrays to copy projection/modelview matrices to GL
129
+
130
+ protected float[] projMatrix;
131
+ protected float[] mvMatrix;
132
+
133
+ // ........................................................
134
+
135
+ // Static initialization for some parameters that need to be different for
136
+ // JOGL
137
+
138
+ static {
139
+ MIN_DIRECT_BUFFER_SIZE = 2;
140
+ INDEX_TYPE = GL.GL_UNSIGNED_SHORT;
141
+ }
142
+
143
+
144
+ ///////////////////////////////////////////////////////////////
145
+
146
+ // Initialization, finalization
147
+
148
+
149
+ public PJOGL(PGraphicsOpenGL pg) {
150
+ super(pg);
151
+ glu = new GLU();
152
+ }
153
+
154
+ public PJOGL(PGraphicsOpenGL pg, PGL.RenderCallback callback) {
155
+ super(pg, callback);
156
+ glu = new GLU();
157
+ }
158
+
159
+
160
+ @Override
161
+ public Object getNative() {
162
+ return sketch.getSurface().getNative();
163
+ }
164
+
165
+
166
+ @Override
167
+ protected void setFrameRate(float fps) {}
168
+
169
+
170
+ @Override
171
+ protected void initSurface(int antialias) {}
172
+
173
+
174
+ @Override
175
+ protected void reinitSurface() {}
176
+
177
+
178
+ @Override
179
+ protected void registerListeners() {}
180
+
181
+
182
+ @Override
183
+ protected PImage screenshot() {
184
+ AWTGLReadBufferUtil util = new AWTGLReadBufferUtil(capabilities.getGLProfile(), false);
185
+ return new PImageAWT(util.readPixelsToBufferedImage(gl, true));
186
+ }
187
+
188
+
189
+ static public void setIcon(String... icons) {
190
+ PJOGL.icons = new String[icons.length];
191
+ PApplet.arrayCopy(icons, PJOGL.icons);
192
+ }
193
+
194
+
195
+ ///////////////////////////////////////////////////////////////
196
+
197
+ // Public methods to get/set renderer's properties
198
+
199
+
200
+ public void setCaps(GLCapabilities caps) {
201
+ reqNumSamples = caps.getNumSamples();
202
+ capabilities = caps;
203
+ }
204
+
205
+
206
+ public GLCapabilitiesImmutable getCaps() {
207
+ return capabilities;
208
+ }
209
+
210
+
211
+ public void setFps(float fps) {
212
+ if (!setFps || targetFps != fps) {
213
+ if (60 < fps) {
214
+ // Disables v-sync
215
+ gl.setSwapInterval(0);
216
+ } else if (30 < fps) {
217
+ gl.setSwapInterval(1);
218
+ } else {
219
+ gl.setSwapInterval(2);
220
+ }
221
+ targetFps = currentFps = fps;
222
+ setFps = true;
223
+ }
224
+ }
225
+
226
+
227
+ @Override
228
+ protected int getDepthBits() {
229
+ return capabilities.getDepthBits();
230
+ }
231
+
232
+
233
+ @Override
234
+ protected int getStencilBits() {
235
+ return capabilities.getStencilBits();
236
+ }
237
+
238
+
239
+ @Override
240
+ protected float getPixelScale() {
241
+ PSurface surf = sketch.getSurface();
242
+ if (surf == null) {
243
+ return graphics.pixelDensity;
244
+ } else if (surf instanceof PSurfaceJOGL) {
245
+ return ((PSurfaceJOGL)surf).getPixelScale();
246
+ } else {
247
+ throw new RuntimeException("Renderer cannot find a JOGL surface");
248
+ }
249
+ }
250
+
251
+
252
+ @Override
253
+ protected void getGL(PGL pgl) {
254
+ PJOGL pjogl = (PJOGL)pgl;
255
+
256
+ this.drawable = pjogl.drawable;
257
+ this.context = pjogl.context;
258
+ this.glContext = pjogl.glContext;
259
+ setThread(pjogl.glThread);
260
+
261
+ this.gl = pjogl.gl;
262
+ this.gl2 = pjogl.gl2;
263
+ this.gl2x = pjogl.gl2x;
264
+ this.gl3 = pjogl.gl3;
265
+ this.gl3es3 = pjogl.gl3es3;
266
+ }
267
+
268
+
269
+ public void getGL(GLAutoDrawable glDrawable) {
270
+ context = glDrawable.getContext();
271
+ glContext = context.hashCode();
272
+ setThread(Thread.currentThread());
273
+
274
+ gl = context.getGL();
275
+ gl2 = gl.getGL2ES2();
276
+ try {
277
+ gl2x = gl.getGL2();
278
+ } catch (com.jogamp.opengl.GLException e) {
279
+ gl2x = null;
280
+ }
281
+ try {
282
+ gl3 = gl.getGL2GL3();
283
+ } catch (com.jogamp.opengl.GLException e) {
284
+ gl3 = null;
285
+ }
286
+ try {
287
+ gl3es3 = gl.getGL3ES3();
288
+ } catch (com.jogamp.opengl.GLException e) {
289
+ gl3es3 = null;
290
+ }
291
+ }
292
+
293
+
294
+ @Override
295
+ protected boolean canDraw() { return true; }
296
+
297
+
298
+ @Override
299
+ protected void requestFocus() {}
300
+
301
+
302
+ @Override
303
+ protected void requestDraw() {}
304
+
305
+
306
+ @Override
307
+ protected void swapBuffers() {
308
+ PSurfaceJOGL surf = (PSurfaceJOGL)sketch.getSurface();
309
+ surf.window.swapBuffers();
310
+ }
311
+
312
+
313
+ @Override
314
+ protected void initFBOLayer() {
315
+ if (0 < sketch.frameCount) {
316
+ if (isES()) initFBOLayerES();
317
+ else initFBOLayerGL();
318
+ }
319
+ }
320
+
321
+
322
+ private void initFBOLayerES() {
323
+ IntBuffer buf = allocateDirectIntBuffer(fboWidth * fboHeight);
324
+
325
+ if (hasReadBuffer()) readBuffer(BACK);
326
+ readPixelsImpl(0, 0, fboWidth, fboHeight, RGBA, UNSIGNED_BYTE, buf);
327
+ bindTexture(TEXTURE_2D, glColorTex.get(frontTex));
328
+ texSubImage2D(TEXTURE_2D, 0, 0, 0, fboWidth, fboHeight, RGBA, UNSIGNED_BYTE, buf);
329
+
330
+ bindTexture(TEXTURE_2D, glColorTex.get(backTex));
331
+ texSubImage2D(TEXTURE_2D, 0, 0, 0, fboWidth, fboHeight, RGBA, UNSIGNED_BYTE, buf);
332
+
333
+ bindTexture(TEXTURE_2D, 0);
334
+ bindFramebufferImpl(FRAMEBUFFER, 0);
335
+ }
336
+
337
+
338
+ private void initFBOLayerGL() {
339
+ // Copy the contents of the front and back screen buffers to the textures
340
+ // of the FBO, so they are properly initialized. Note that the front buffer
341
+ // of the default framebuffer (the screen) contains the previous frame:
342
+ // https://www.opengl.org/wiki/Default_Framebuffer
343
+ // so it is copied to the front texture of the FBO layer:
344
+ if (pclearColor || 0 < pgeomCount || !sketch.isLooping()) {
345
+ if (hasReadBuffer()) readBuffer(FRONT);
346
+ } else {
347
+ // ...except when the previous frame has not been cleared and nothing was
348
+ // rendered while looping. In this case the back buffer, which holds the
349
+ // initial state of the previous frame, still contains the most up-to-date
350
+ // screen state.
351
+ readBuffer(BACK);
352
+ }
353
+ bindFramebufferImpl(DRAW_FRAMEBUFFER, glColorFbo.get(0));
354
+ framebufferTexture2D(FRAMEBUFFER, COLOR_ATTACHMENT0,
355
+ TEXTURE_2D, glColorTex.get(frontTex), 0);
356
+ if (hasDrawBuffer()) drawBuffer(COLOR_ATTACHMENT0);
357
+ blitFramebuffer(0, 0, fboWidth, fboHeight,
358
+ 0, 0, fboWidth, fboHeight,
359
+ COLOR_BUFFER_BIT, NEAREST);
360
+
361
+ readBuffer(BACK);
362
+ bindFramebufferImpl(DRAW_FRAMEBUFFER, glColorFbo.get(0));
363
+ framebufferTexture2D(FRAMEBUFFER, COLOR_ATTACHMENT0,
364
+ TEXTURE_2D, glColorTex.get(backTex), 0);
365
+ drawBuffer(COLOR_ATTACHMENT0);
366
+ blitFramebuffer(0, 0, fboWidth, fboHeight,
367
+ 0, 0, fboWidth, fboHeight,
368
+ COLOR_BUFFER_BIT, NEAREST);
369
+
370
+ bindFramebufferImpl(FRAMEBUFFER, 0);
371
+ }
372
+
373
+
374
+ @Override
375
+ protected void beginGL() {
376
+ PMatrix3D proj = graphics.projection;
377
+ PMatrix3D mdl = graphics.modelview;
378
+ if (gl2x != null) {
379
+ if (projMatrix == null) {
380
+ projMatrix = new float[16];
381
+ }
382
+ gl2x.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
383
+ projMatrix[ 0] = proj.m00;
384
+ projMatrix[ 1] = proj.m10;
385
+ projMatrix[ 2] = proj.m20;
386
+ projMatrix[ 3] = proj.m30;
387
+ projMatrix[ 4] = proj.m01;
388
+ projMatrix[ 5] = proj.m11;
389
+ projMatrix[ 6] = proj.m21;
390
+ projMatrix[ 7] = proj.m31;
391
+ projMatrix[ 8] = proj.m02;
392
+ projMatrix[ 9] = proj.m12;
393
+ projMatrix[10] = proj.m22;
394
+ projMatrix[11] = proj.m32;
395
+ projMatrix[12] = proj.m03;
396
+ projMatrix[13] = proj.m13;
397
+ projMatrix[14] = proj.m23;
398
+ projMatrix[15] = proj.m33;
399
+ gl2x.glLoadMatrixf(projMatrix, 0);
400
+
401
+ if (mvMatrix == null) {
402
+ mvMatrix = new float[16];
403
+ }
404
+ gl2x.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
405
+ mvMatrix[ 0] = mdl.m00;
406
+ mvMatrix[ 1] = mdl.m10;
407
+ mvMatrix[ 2] = mdl.m20;
408
+ mvMatrix[ 3] = mdl.m30;
409
+ mvMatrix[ 4] = mdl.m01;
410
+ mvMatrix[ 5] = mdl.m11;
411
+ mvMatrix[ 6] = mdl.m21;
412
+ mvMatrix[ 7] = mdl.m31;
413
+ mvMatrix[ 8] = mdl.m02;
414
+ mvMatrix[ 9] = mdl.m12;
415
+ mvMatrix[10] = mdl.m22;
416
+ mvMatrix[11] = mdl.m32;
417
+ mvMatrix[12] = mdl.m03;
418
+ mvMatrix[13] = mdl.m13;
419
+ mvMatrix[14] = mdl.m23;
420
+ mvMatrix[15] = mdl.m33;
421
+ gl2x.glLoadMatrixf(mvMatrix, 0);
422
+ }
423
+ }
424
+
425
+
426
+ @Override
427
+ protected boolean hasFBOs() {
428
+ if (context.hasBasicFBOSupport()) return true;
429
+ else return super.hasFBOs();
430
+ }
431
+
432
+
433
+ @Override
434
+ protected boolean hasShaders() {
435
+ if (context.hasGLSL()) return true;
436
+ else return super.hasShaders();
437
+ }
438
+
439
+
440
+ public void init(GLAutoDrawable glDrawable) {
441
+ capabilities = glDrawable.getChosenGLCapabilities();
442
+ if (!hasFBOs()) {
443
+ throw new RuntimeException(MISSING_FBO_ERROR);
444
+ }
445
+ if (!hasShaders()) {
446
+ throw new RuntimeException(MISSING_GLSL_ERROR);
447
+ }
448
+ }
449
+
450
+
451
+ ///////////////////////////////////////////////////////////
452
+
453
+ // Utility functions
454
+
455
+
456
+ @Override
457
+ protected void enableTexturing(int target) {
458
+ if (target == TEXTURE_2D) {
459
+ texturingTargets[0] = true;
460
+ } else if (target == TEXTURE_RECTANGLE) {
461
+ texturingTargets[1] = true;
462
+ }
463
+ }
464
+
465
+
466
+ @Override
467
+ protected void disableTexturing(int target) {
468
+ if (target == TEXTURE_2D) {
469
+ texturingTargets[0] = false;
470
+ } else if (target == TEXTURE_RECTANGLE) {
471
+ texturingTargets[1] = false;
472
+ }
473
+ }
474
+
475
+
476
+ /**
477
+ * Convenience method to get a legit FontMetrics object. Where possible,
478
+ * override this any renderer subclass so that you're not using what's
479
+ * returned by getDefaultToolkit() to get your metrics.
480
+ */
481
+ @SuppressWarnings("deprecation")
482
+ private FontMetrics getFontMetrics(Font font) { // ignore
483
+ return Toolkit.getDefaultToolkit().getFontMetrics(font);
484
+ }
485
+
486
+
487
+ /**
488
+ * Convenience method to jump through some Java2D hoops and get an FRC.
489
+ */
490
+ private FontRenderContext getFontRenderContext(Font font) { // ignore
491
+ return getFontMetrics(font).getFontRenderContext();
492
+ }
493
+
494
+
495
+ @Override
496
+ protected int getFontAscent(Object font) {
497
+ return getFontMetrics((Font) font).getAscent();
498
+ }
499
+
500
+
501
+ @Override
502
+ protected int getFontDescent(Object font) {
503
+ return getFontMetrics((Font) font).getDescent();
504
+ }
505
+
506
+
507
+ @Override
508
+ protected int getTextWidth(Object font, char[] buffer, int start, int stop) {
509
+ // maybe should use one of the newer/fancier functions for this?
510
+ int length = stop - start;
511
+ FontMetrics metrics = getFontMetrics((Font) font);
512
+ return metrics.charsWidth(buffer, start, length);
513
+ }
514
+
515
+
516
+ @Override
517
+ protected Object getDerivedFont(Object font, float size) {
518
+ return ((Font) font).deriveFont(size);
519
+ }
520
+
521
+
522
+ @Override
523
+ protected int getGLSLVersion() {
524
+ VersionNumber vn = context.getGLSLVersionNumber();
525
+ return vn.getMajor() * 100 + vn.getMinor();
526
+ }
527
+
528
+
529
+ @Override
530
+ protected String getGLSLVersionSuffix() {
531
+ VersionNumber vn = context.getGLSLVersionNumber();
532
+ if (context.isGLESProfile() && 1 < vn.getMajor()) {
533
+ return " es";
534
+ } else {
535
+ return "";
536
+ }
537
+ }
538
+
539
+
540
+ @Override
541
+ protected String[] loadVertexShader(String filename) {
542
+ return loadVertexShader(filename, getGLSLVersion(), getGLSLVersionSuffix());
543
+ }
544
+
545
+
546
+ @Override
547
+ protected String[] loadFragmentShader(String filename) {
548
+ return loadFragmentShader(filename, getGLSLVersion(), getGLSLVersionSuffix());
549
+ }
550
+
551
+
552
+ @Override
553
+ protected String[] loadVertexShader(URL url) {
554
+ return loadVertexShader(url, getGLSLVersion(), getGLSLVersionSuffix());
555
+ }
556
+
557
+
558
+ @Override
559
+ protected String[] loadFragmentShader(URL url) {
560
+ return loadFragmentShader(url, getGLSLVersion(), getGLSLVersionSuffix());
561
+ }
562
+
563
+
564
+ @Override
565
+ protected String[] loadFragmentShader(String filename, int version, String versionSuffix) {
566
+ String[] fragSrc0 = sketch.loadStrings(filename);
567
+ return preprocessFragmentSource(fragSrc0, version, versionSuffix);
568
+ }
569
+
570
+
571
+ @Override
572
+ protected String[] loadVertexShader(String filename, int version, String versionSuffix) {
573
+ String[] vertSrc0 = sketch.loadStrings(filename);
574
+ return preprocessVertexSource(vertSrc0, version, versionSuffix);
575
+ }
576
+
577
+
578
+ @Override
579
+ protected String[] loadFragmentShader(URL url, int version, String versionSuffix) {
580
+ try {
581
+ String[] fragSrc0 = PApplet.loadStrings(url.openStream());
582
+ return preprocessFragmentSource(fragSrc0, version, versionSuffix);
583
+ } catch (IOException e) {
584
+ PGraphics.showException("Cannot load fragment shader " + url.getFile());
585
+ }
586
+ return null;
587
+ }
588
+
589
+
590
+ @Override
591
+ protected String[] loadVertexShader(URL url, int version, String versionSuffix) {
592
+ try {
593
+ String[] vertSrc0 = PApplet.loadStrings(url.openStream());
594
+ return preprocessVertexSource(vertSrc0, version, versionSuffix);
595
+ } catch (IOException e) {
596
+ PGraphics.showException("Cannot load vertex shader " + url.getFile());
597
+ }
598
+ return null;
599
+ }
600
+
601
+
602
+ ///////////////////////////////////////////////////////////
603
+
604
+ // Tessellator
605
+
606
+
607
+ @Override
608
+ protected Tessellator createTessellator(TessellatorCallback callback) {
609
+ return new Tessellator(callback);
610
+ }
611
+
612
+
613
+ protected static class Tessellator implements PGL.Tessellator {
614
+ protected GLUtessellator tess;
615
+ protected TessellatorCallback callback;
616
+ protected GLUCallback gluCallback;
617
+
618
+ public Tessellator(TessellatorCallback callback) {
619
+ this.callback = callback;
620
+ tess = GLU.gluNewTess();
621
+ gluCallback = new GLUCallback();
622
+
623
+ GLU.gluTessCallback(tess, GLU.GLU_TESS_BEGIN, gluCallback);
624
+ GLU.gluTessCallback(tess, GLU.GLU_TESS_END, gluCallback);
625
+ GLU.gluTessCallback(tess, GLU.GLU_TESS_VERTEX, gluCallback);
626
+ GLU.gluTessCallback(tess, GLU.GLU_TESS_COMBINE, gluCallback);
627
+ GLU.gluTessCallback(tess, GLU.GLU_TESS_ERROR, gluCallback);
628
+ }
629
+
630
+ @Override
631
+ public void setCallback(int flag) {
632
+ GLU.gluTessCallback(tess, flag, gluCallback);
633
+ }
634
+
635
+ @Override
636
+ public void setWindingRule(int rule) {
637
+ setProperty(GLU.GLU_TESS_WINDING_RULE, rule);
638
+ }
639
+
640
+ public void setProperty(int property, int value) {
641
+ GLU.gluTessProperty(tess, property, value);
642
+ }
643
+
644
+ @Override
645
+ public void beginPolygon() {
646
+ beginPolygon(null);
647
+ }
648
+
649
+ @Override
650
+ public void beginPolygon(Object data) {
651
+ GLU.gluTessBeginPolygon(tess, data);
652
+ }
653
+
654
+ @Override
655
+ public void endPolygon() {
656
+ GLU.gluTessEndPolygon(tess);
657
+ }
658
+
659
+ @Override
660
+ public void beginContour() {
661
+ GLU.gluTessBeginContour(tess);
662
+ }
663
+
664
+ @Override
665
+ public void endContour() {
666
+ GLU.gluTessEndContour(tess);
667
+ }
668
+
669
+ @Override
670
+ public void addVertex(double[] v) {
671
+ addVertex(v, 0, v);
672
+ }
673
+
674
+ @Override
675
+ public void addVertex(double[] v, int n, Object data) {
676
+ GLU.gluTessVertex(tess, v, n, data);
677
+ }
678
+
679
+ protected class GLUCallback extends GLUtessellatorCallbackAdapter {
680
+ @Override
681
+ public void begin(int type) {
682
+ callback.begin(type);
683
+ }
684
+
685
+ @Override
686
+ public void end() {
687
+ callback.end();
688
+ }
689
+
690
+ @Override
691
+ public void vertex(Object data) {
692
+ callback.vertex(data);
693
+ }
694
+
695
+ @Override
696
+ public void combine(double[] coords, Object[] data,
697
+ float[] weight, Object[] outData) {
698
+ callback.combine(coords, data, weight, outData);
699
+ }
700
+
701
+ @Override
702
+ public void error(int errnum) {
703
+ callback.error(errnum);
704
+ }
705
+ }
706
+ }
707
+
708
+
709
+ @Override
710
+ protected String tessError(int err) {
711
+ return glu.gluErrorString(err);
712
+ }
713
+
714
+
715
+ ///////////////////////////////////////////////////////////
716
+
717
+ // Font outline
718
+
719
+
720
+ static {
721
+ SHAPE_TEXT_SUPPORTED = true;
722
+ SEG_MOVETO = PathIterator.SEG_MOVETO;
723
+ SEG_LINETO = PathIterator.SEG_LINETO;
724
+ SEG_QUADTO = PathIterator.SEG_QUADTO;
725
+ SEG_CUBICTO = PathIterator.SEG_CUBICTO;
726
+ SEG_CLOSE = PathIterator.SEG_CLOSE;
727
+ }
728
+
729
+
730
+ @Override
731
+ protected FontOutline createFontOutline(char ch, Object font) {
732
+ return new FontOutline(ch, (Font) font);
733
+ }
734
+
735
+
736
+ protected class FontOutline implements PGL.FontOutline {
737
+ PathIterator iter;
738
+
739
+ public FontOutline(char ch, Font font) {
740
+ char[] textArray = new char[] { ch };
741
+ FontRenderContext frc = getFontRenderContext(font);
742
+ GlyphVector gv = font.createGlyphVector(frc, textArray);
743
+ Shape shp = gv.getOutline();
744
+ iter = shp.getPathIterator(null);
745
+ }
746
+
747
+ @Override
748
+ public boolean isDone() {
749
+ return iter.isDone();
750
+ }
751
+
752
+ @Override
753
+ public int currentSegment(float[] coords) {
754
+ return iter.currentSegment(coords);
755
+ }
756
+
757
+ @Override
758
+ public void next() {
759
+ iter.next();
760
+ }
761
+ }
762
+
763
+
764
+ ///////////////////////////////////////////////////////////
765
+
766
+ // Constants
767
+
768
+ static {
769
+ FALSE = GL.GL_FALSE;
770
+ TRUE = GL.GL_TRUE;
771
+
772
+ INT = GL2ES2.GL_INT;
773
+ BYTE = GL.GL_BYTE;
774
+ SHORT = GL.GL_SHORT;
775
+ FLOAT = GL.GL_FLOAT;
776
+ BOOL = GL2ES2.GL_BOOL;
777
+ UNSIGNED_INT = GL.GL_UNSIGNED_INT;
778
+ UNSIGNED_BYTE = GL.GL_UNSIGNED_BYTE;
779
+ UNSIGNED_SHORT = GL.GL_UNSIGNED_SHORT;
780
+
781
+ RGB = GL.GL_RGB;
782
+ RGBA = GL.GL_RGBA;
783
+ ALPHA = GL.GL_ALPHA;
784
+ LUMINANCE = GL.GL_LUMINANCE;
785
+ LUMINANCE_ALPHA = GL.GL_LUMINANCE_ALPHA;
786
+
787
+ UNSIGNED_SHORT_5_6_5 = GL.GL_UNSIGNED_SHORT_5_6_5;
788
+ UNSIGNED_SHORT_4_4_4_4 = GL.GL_UNSIGNED_SHORT_4_4_4_4;
789
+ UNSIGNED_SHORT_5_5_5_1 = GL.GL_UNSIGNED_SHORT_5_5_5_1;
790
+
791
+ RGBA4 = GL.GL_RGBA4;
792
+ RGB5_A1 = GL.GL_RGB5_A1;
793
+ RGB565 = GL.GL_RGB565;
794
+ RGB8 = GL.GL_RGB8;
795
+ RGBA8 = GL.GL_RGBA8;
796
+ ALPHA8 = GL.GL_ALPHA8;
797
+
798
+ READ_ONLY = GL2ES3.GL_READ_ONLY;
799
+ WRITE_ONLY = GL.GL_WRITE_ONLY;
800
+ READ_WRITE = GL2ES3.GL_READ_WRITE;
801
+
802
+ TESS_WINDING_NONZERO = GLU.GLU_TESS_WINDING_NONZERO;
803
+ TESS_WINDING_ODD = GLU.GLU_TESS_WINDING_ODD;
804
+ TESS_EDGE_FLAG = GLU.GLU_TESS_EDGE_FLAG;
805
+
806
+ GENERATE_MIPMAP_HINT = GL.GL_GENERATE_MIPMAP_HINT;
807
+ FASTEST = GL.GL_FASTEST;
808
+ NICEST = GL.GL_NICEST;
809
+ DONT_CARE = GL.GL_DONT_CARE;
810
+
811
+ VENDOR = GL.GL_VENDOR;
812
+ RENDERER = GL.GL_RENDERER;
813
+ VERSION = GL.GL_VERSION;
814
+ EXTENSIONS = GL.GL_EXTENSIONS;
815
+ SHADING_LANGUAGE_VERSION = GL2ES2.GL_SHADING_LANGUAGE_VERSION;
816
+
817
+ MAX_SAMPLES = GL.GL_MAX_SAMPLES;
818
+ SAMPLES = GL.GL_SAMPLES;
819
+
820
+ ALIASED_LINE_WIDTH_RANGE = GL.GL_ALIASED_LINE_WIDTH_RANGE;
821
+ ALIASED_POINT_SIZE_RANGE = GL.GL_ALIASED_POINT_SIZE_RANGE;
822
+
823
+ DEPTH_BITS = GL.GL_DEPTH_BITS;
824
+ STENCIL_BITS = GL.GL_STENCIL_BITS;
825
+
826
+ CCW = GL.GL_CCW;
827
+ CW = GL.GL_CW;
828
+
829
+ VIEWPORT = GL.GL_VIEWPORT;
830
+
831
+ ARRAY_BUFFER = GL.GL_ARRAY_BUFFER;
832
+ ELEMENT_ARRAY_BUFFER = GL.GL_ELEMENT_ARRAY_BUFFER;
833
+ PIXEL_PACK_BUFFER = GL2ES3.GL_PIXEL_PACK_BUFFER;
834
+
835
+ MAX_VERTEX_ATTRIBS = GL2ES2.GL_MAX_VERTEX_ATTRIBS;
836
+
837
+ STATIC_DRAW = GL.GL_STATIC_DRAW;
838
+ DYNAMIC_DRAW = GL.GL_DYNAMIC_DRAW;
839
+ STREAM_DRAW = GL2ES2.GL_STREAM_DRAW;
840
+ STREAM_READ = GL2ES3.GL_STREAM_READ;
841
+
842
+ BUFFER_SIZE = GL.GL_BUFFER_SIZE;
843
+ BUFFER_USAGE = GL.GL_BUFFER_USAGE;
844
+
845
+ POINTS = GL.GL_POINTS;
846
+ LINE_STRIP = GL.GL_LINE_STRIP;
847
+ LINE_LOOP = GL.GL_LINE_LOOP;
848
+ LINES = GL.GL_LINES;
849
+ TRIANGLE_FAN = GL.GL_TRIANGLE_FAN;
850
+ TRIANGLE_STRIP = GL.GL_TRIANGLE_STRIP;
851
+ TRIANGLES = GL.GL_TRIANGLES;
852
+
853
+ CULL_FACE = GL.GL_CULL_FACE;
854
+ FRONT = GL.GL_FRONT;
855
+ BACK = GL.GL_BACK;
856
+ FRONT_AND_BACK = GL.GL_FRONT_AND_BACK;
857
+
858
+ POLYGON_OFFSET_FILL = GL.GL_POLYGON_OFFSET_FILL;
859
+
860
+ UNPACK_ALIGNMENT = GL.GL_UNPACK_ALIGNMENT;
861
+ PACK_ALIGNMENT = GL.GL_PACK_ALIGNMENT;
862
+
863
+ TEXTURE_2D = GL.GL_TEXTURE_2D;
864
+ TEXTURE_RECTANGLE = GL2GL3.GL_TEXTURE_RECTANGLE;
865
+
866
+ TEXTURE_BINDING_2D = GL.GL_TEXTURE_BINDING_2D;
867
+ TEXTURE_BINDING_RECTANGLE = GL2GL3.GL_TEXTURE_BINDING_RECTANGLE;
868
+
869
+ MAX_TEXTURE_SIZE = GL.GL_MAX_TEXTURE_SIZE;
870
+ TEXTURE_MAX_ANISOTROPY = GL.GL_TEXTURE_MAX_ANISOTROPY_EXT;
871
+ MAX_TEXTURE_MAX_ANISOTROPY = GL.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT;
872
+
873
+ MAX_VERTEX_TEXTURE_IMAGE_UNITS = GL2ES2.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS;
874
+ MAX_TEXTURE_IMAGE_UNITS = GL2ES2.GL_MAX_TEXTURE_IMAGE_UNITS;
875
+ MAX_COMBINED_TEXTURE_IMAGE_UNITS = GL2ES2.GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS;
876
+
877
+ NUM_COMPRESSED_TEXTURE_FORMATS = GL.GL_NUM_COMPRESSED_TEXTURE_FORMATS;
878
+ COMPRESSED_TEXTURE_FORMATS = GL.GL_COMPRESSED_TEXTURE_FORMATS;
879
+
880
+ NEAREST = GL.GL_NEAREST;
881
+ LINEAR = GL.GL_LINEAR;
882
+ LINEAR_MIPMAP_NEAREST = GL.GL_LINEAR_MIPMAP_NEAREST;
883
+ LINEAR_MIPMAP_LINEAR = GL.GL_LINEAR_MIPMAP_LINEAR;
884
+
885
+ CLAMP_TO_EDGE = GL.GL_CLAMP_TO_EDGE;
886
+ REPEAT = GL.GL_REPEAT;
887
+
888
+ TEXTURE0 = GL.GL_TEXTURE0;
889
+ TEXTURE1 = GL.GL_TEXTURE1;
890
+ TEXTURE2 = GL.GL_TEXTURE2;
891
+ TEXTURE3 = GL.GL_TEXTURE3;
892
+ TEXTURE_MIN_FILTER = GL.GL_TEXTURE_MIN_FILTER;
893
+ TEXTURE_MAG_FILTER = GL.GL_TEXTURE_MAG_FILTER;
894
+ TEXTURE_WRAP_S = GL.GL_TEXTURE_WRAP_S;
895
+ TEXTURE_WRAP_T = GL.GL_TEXTURE_WRAP_T;
896
+ TEXTURE_WRAP_R = GL2ES2.GL_TEXTURE_WRAP_R;
897
+
898
+ TEXTURE_CUBE_MAP = GL.GL_TEXTURE_CUBE_MAP;
899
+ TEXTURE_CUBE_MAP_POSITIVE_X = GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X;
900
+ TEXTURE_CUBE_MAP_POSITIVE_Y = GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y;
901
+ TEXTURE_CUBE_MAP_POSITIVE_Z = GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Z;
902
+ TEXTURE_CUBE_MAP_NEGATIVE_X = GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X;
903
+ TEXTURE_CUBE_MAP_NEGATIVE_Y = GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y;
904
+ TEXTURE_CUBE_MAP_NEGATIVE_Z = GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z;
905
+
906
+ VERTEX_SHADER = GL2ES2.GL_VERTEX_SHADER;
907
+ FRAGMENT_SHADER = GL2ES2.GL_FRAGMENT_SHADER;
908
+ INFO_LOG_LENGTH = GL2ES2.GL_INFO_LOG_LENGTH;
909
+ SHADER_SOURCE_LENGTH = GL2ES2.GL_SHADER_SOURCE_LENGTH;
910
+ COMPILE_STATUS = GL2ES2.GL_COMPILE_STATUS;
911
+ LINK_STATUS = GL2ES2.GL_LINK_STATUS;
912
+ VALIDATE_STATUS = GL2ES2.GL_VALIDATE_STATUS;
913
+ SHADER_TYPE = GL2ES2.GL_SHADER_TYPE;
914
+ DELETE_STATUS = GL2ES2.GL_DELETE_STATUS;
915
+
916
+ FLOAT_VEC2 = GL2ES2.GL_FLOAT_VEC2;
917
+ FLOAT_VEC3 = GL2ES2.GL_FLOAT_VEC3;
918
+ FLOAT_VEC4 = GL2ES2.GL_FLOAT_VEC4;
919
+ FLOAT_MAT2 = GL2ES2.GL_FLOAT_MAT2;
920
+ FLOAT_MAT3 = GL2ES2.GL_FLOAT_MAT3;
921
+ FLOAT_MAT4 = GL2ES2.GL_FLOAT_MAT4;
922
+ INT_VEC2 = GL2ES2.GL_INT_VEC2;
923
+ INT_VEC3 = GL2ES2.GL_INT_VEC3;
924
+ INT_VEC4 = GL2ES2.GL_INT_VEC4;
925
+ BOOL_VEC2 = GL2ES2.GL_BOOL_VEC2;
926
+ BOOL_VEC3 = GL2ES2.GL_BOOL_VEC3;
927
+ BOOL_VEC4 = GL2ES2.GL_BOOL_VEC4;
928
+ SAMPLER_2D = GL2ES2.GL_SAMPLER_2D;
929
+ SAMPLER_CUBE = GL2ES2.GL_SAMPLER_CUBE;
930
+
931
+ LOW_FLOAT = GL2ES2.GL_LOW_FLOAT;
932
+ MEDIUM_FLOAT = GL2ES2.GL_MEDIUM_FLOAT;
933
+ HIGH_FLOAT = GL2ES2.GL_HIGH_FLOAT;
934
+ LOW_INT = GL2ES2.GL_LOW_INT;
935
+ MEDIUM_INT = GL2ES2.GL_MEDIUM_INT;
936
+ HIGH_INT = GL2ES2.GL_HIGH_INT;
937
+
938
+ CURRENT_VERTEX_ATTRIB = GL2ES2.GL_CURRENT_VERTEX_ATTRIB;
939
+
940
+ VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = GL2ES2.GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING;
941
+ VERTEX_ATTRIB_ARRAY_ENABLED = GL2ES2.GL_VERTEX_ATTRIB_ARRAY_ENABLED;
942
+ VERTEX_ATTRIB_ARRAY_SIZE = GL2ES2.GL_VERTEX_ATTRIB_ARRAY_SIZE;
943
+ VERTEX_ATTRIB_ARRAY_STRIDE = GL2ES2.GL_VERTEX_ATTRIB_ARRAY_STRIDE;
944
+ VERTEX_ATTRIB_ARRAY_TYPE = GL2ES2.GL_VERTEX_ATTRIB_ARRAY_TYPE;
945
+ VERTEX_ATTRIB_ARRAY_NORMALIZED = GL2ES2.GL_VERTEX_ATTRIB_ARRAY_NORMALIZED;
946
+ VERTEX_ATTRIB_ARRAY_POINTER = GL2ES2.GL_VERTEX_ATTRIB_ARRAY_POINTER;
947
+
948
+ BLEND = GL.GL_BLEND;
949
+ ONE = GL.GL_ONE;
950
+ ZERO = GL.GL_ZERO;
951
+ SRC_ALPHA = GL.GL_SRC_ALPHA;
952
+ DST_ALPHA = GL.GL_DST_ALPHA;
953
+ ONE_MINUS_SRC_ALPHA = GL.GL_ONE_MINUS_SRC_ALPHA;
954
+ ONE_MINUS_DST_COLOR = GL.GL_ONE_MINUS_DST_COLOR;
955
+ ONE_MINUS_SRC_COLOR = GL.GL_ONE_MINUS_SRC_COLOR;
956
+ DST_COLOR = GL.GL_DST_COLOR;
957
+ SRC_COLOR = GL.GL_SRC_COLOR;
958
+
959
+ SAMPLE_ALPHA_TO_COVERAGE = GL.GL_SAMPLE_ALPHA_TO_COVERAGE;
960
+ SAMPLE_COVERAGE = GL.GL_SAMPLE_COVERAGE;
961
+
962
+ KEEP = GL.GL_KEEP;
963
+ REPLACE = GL.GL_REPLACE;
964
+ INCR = GL.GL_INCR;
965
+ DECR = GL.GL_DECR;
966
+ INVERT = GL.GL_INVERT;
967
+ INCR_WRAP = GL.GL_INCR_WRAP;
968
+ DECR_WRAP = GL.GL_DECR_WRAP;
969
+ NEVER = GL.GL_NEVER;
970
+ ALWAYS = GL.GL_ALWAYS;
971
+
972
+ EQUAL = GL.GL_EQUAL;
973
+ LESS = GL.GL_LESS;
974
+ LEQUAL = GL.GL_LEQUAL;
975
+ GREATER = GL.GL_GREATER;
976
+ GEQUAL = GL.GL_GEQUAL;
977
+ NOTEQUAL = GL.GL_NOTEQUAL;
978
+
979
+ FUNC_ADD = GL.GL_FUNC_ADD;
980
+ FUNC_MIN = GL2ES3.GL_MIN;
981
+ FUNC_MAX = GL2ES3.GL_MAX;
982
+ FUNC_REVERSE_SUBTRACT = GL.GL_FUNC_REVERSE_SUBTRACT;
983
+ FUNC_SUBTRACT = GL.GL_FUNC_SUBTRACT;
984
+
985
+ DITHER = GL.GL_DITHER;
986
+
987
+ CONSTANT_COLOR = GL2ES2.GL_CONSTANT_COLOR;
988
+ CONSTANT_ALPHA = GL2ES2.GL_CONSTANT_ALPHA;
989
+ ONE_MINUS_CONSTANT_COLOR = GL2ES2.GL_ONE_MINUS_CONSTANT_COLOR;
990
+ ONE_MINUS_CONSTANT_ALPHA = GL2ES2.GL_ONE_MINUS_CONSTANT_ALPHA;
991
+ SRC_ALPHA_SATURATE = GL.GL_SRC_ALPHA_SATURATE;
992
+
993
+ SCISSOR_TEST = GL.GL_SCISSOR_TEST;
994
+ STENCIL_TEST = GL.GL_STENCIL_TEST;
995
+ DEPTH_TEST = GL.GL_DEPTH_TEST;
996
+ DEPTH_WRITEMASK = GL.GL_DEPTH_WRITEMASK;
997
+
998
+ COLOR_BUFFER_BIT = GL.GL_COLOR_BUFFER_BIT;
999
+ DEPTH_BUFFER_BIT = GL.GL_DEPTH_BUFFER_BIT;
1000
+ STENCIL_BUFFER_BIT = GL.GL_STENCIL_BUFFER_BIT;
1001
+
1002
+ FRAMEBUFFER = GL.GL_FRAMEBUFFER;
1003
+ COLOR_ATTACHMENT0 = GL.GL_COLOR_ATTACHMENT0;
1004
+ COLOR_ATTACHMENT1 = GL2ES2.GL_COLOR_ATTACHMENT1;
1005
+ COLOR_ATTACHMENT2 = GL2ES2.GL_COLOR_ATTACHMENT2;
1006
+ COLOR_ATTACHMENT3 = GL2ES2.GL_COLOR_ATTACHMENT3;
1007
+ RENDERBUFFER = GL.GL_RENDERBUFFER;
1008
+ DEPTH_ATTACHMENT = GL.GL_DEPTH_ATTACHMENT;
1009
+ STENCIL_ATTACHMENT = GL.GL_STENCIL_ATTACHMENT;
1010
+ READ_FRAMEBUFFER = GL.GL_READ_FRAMEBUFFER;
1011
+ DRAW_FRAMEBUFFER = GL.GL_DRAW_FRAMEBUFFER;
1012
+
1013
+ RGBA8 = GL.GL_RGBA8;
1014
+ DEPTH24_STENCIL8 = GL.GL_DEPTH24_STENCIL8;
1015
+
1016
+ DEPTH_COMPONENT = GL2ES2.GL_DEPTH_COMPONENT;
1017
+ DEPTH_COMPONENT16 = GL.GL_DEPTH_COMPONENT16;
1018
+ DEPTH_COMPONENT24 = GL.GL_DEPTH_COMPONENT24;
1019
+ DEPTH_COMPONENT32 = GL.GL_DEPTH_COMPONENT32;
1020
+
1021
+ STENCIL_INDEX = GL2ES2.GL_STENCIL_INDEX;
1022
+ STENCIL_INDEX1 = GL.GL_STENCIL_INDEX1;
1023
+ STENCIL_INDEX4 = GL.GL_STENCIL_INDEX4;
1024
+ STENCIL_INDEX8 = GL.GL_STENCIL_INDEX8;
1025
+
1026
+ DEPTH_STENCIL = GL.GL_DEPTH_STENCIL;
1027
+
1028
+ FRAMEBUFFER_COMPLETE = GL.GL_FRAMEBUFFER_COMPLETE;
1029
+ FRAMEBUFFER_UNDEFINED = GL2ES3.GL_FRAMEBUFFER_UNDEFINED;
1030
+ FRAMEBUFFER_INCOMPLETE_ATTACHMENT = GL.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
1031
+ FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = GL.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT;
1032
+ FRAMEBUFFER_INCOMPLETE_DIMENSIONS = GL.GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS;
1033
+ FRAMEBUFFER_INCOMPLETE_FORMATS = GL.GL_FRAMEBUFFER_INCOMPLETE_FORMATS;
1034
+ FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = GL2GL3.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER;
1035
+ FRAMEBUFFER_INCOMPLETE_READ_BUFFER = GL2GL3.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER;
1036
+ FRAMEBUFFER_UNSUPPORTED = GL.GL_FRAMEBUFFER_UNSUPPORTED;
1037
+ FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = GL.GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE;
1038
+ FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = GL3ES3.GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS;
1039
+
1040
+ FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = GL.GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE;
1041
+ FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = GL.GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME;
1042
+ FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = GL.GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL;
1043
+ FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = GL.GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE;
1044
+
1045
+ RENDERBUFFER_WIDTH = GL.GL_RENDERBUFFER_WIDTH;
1046
+ RENDERBUFFER_HEIGHT = GL.GL_RENDERBUFFER_HEIGHT;
1047
+ RENDERBUFFER_RED_SIZE = GL.GL_RENDERBUFFER_RED_SIZE;
1048
+ RENDERBUFFER_GREEN_SIZE = GL.GL_RENDERBUFFER_GREEN_SIZE;
1049
+ RENDERBUFFER_BLUE_SIZE = GL.GL_RENDERBUFFER_BLUE_SIZE;
1050
+ RENDERBUFFER_ALPHA_SIZE = GL.GL_RENDERBUFFER_ALPHA_SIZE;
1051
+ RENDERBUFFER_DEPTH_SIZE = GL.GL_RENDERBUFFER_DEPTH_SIZE;
1052
+ RENDERBUFFER_STENCIL_SIZE = GL.GL_RENDERBUFFER_STENCIL_SIZE;
1053
+ RENDERBUFFER_INTERNAL_FORMAT = GL.GL_RENDERBUFFER_INTERNAL_FORMAT;
1054
+
1055
+ MULTISAMPLE = GL.GL_MULTISAMPLE;
1056
+ LINE_SMOOTH = GL.GL_LINE_SMOOTH;
1057
+ POLYGON_SMOOTH = GL2GL3.GL_POLYGON_SMOOTH;
1058
+
1059
+ SYNC_GPU_COMMANDS_COMPLETE = GL3ES3.GL_SYNC_GPU_COMMANDS_COMPLETE;
1060
+ ALREADY_SIGNALED = GL3ES3.GL_ALREADY_SIGNALED;
1061
+ CONDITION_SATISFIED = GL3ES3.GL_CONDITION_SATISFIED;
1062
+ }
1063
+
1064
+ ///////////////////////////////////////////////////////////
1065
+
1066
+ // Special Functions
1067
+
1068
+ @Override
1069
+ public void flush() {
1070
+ gl.glFlush();
1071
+ }
1072
+
1073
+ @Override
1074
+ public void finish() {
1075
+ gl.glFinish();
1076
+ }
1077
+
1078
+ @Override
1079
+ public void hint(int target, int hint) {
1080
+ gl.glHint(target, hint);
1081
+ }
1082
+
1083
+ ///////////////////////////////////////////////////////////
1084
+
1085
+ // State and State Requests
1086
+
1087
+ @Override
1088
+ public void enable(int value) {
1089
+ if (-1 < value) {
1090
+ gl.glEnable(value);
1091
+ }
1092
+ }
1093
+
1094
+ @Override
1095
+ public void disable(int value) {
1096
+ if (-1 < value) {
1097
+ gl.glDisable(value);
1098
+ }
1099
+ }
1100
+
1101
+ @Override
1102
+ public void getBooleanv(int value, IntBuffer data) {
1103
+ if (-1 < value) {
1104
+ if (byteBuffer.capacity() < data.capacity()) {
1105
+ byteBuffer = allocateDirectByteBuffer(data.capacity());
1106
+ }
1107
+ gl.glGetBooleanv(value, byteBuffer);
1108
+ for (int i = 0; i < data.capacity(); i++) {
1109
+ data.put(i, byteBuffer.get(i));
1110
+ }
1111
+ } else {
1112
+ fillIntBuffer(data, 0, data.capacity() - 1, 0);
1113
+ }
1114
+ }
1115
+
1116
+ @Override
1117
+ public void getIntegerv(int value, IntBuffer data) {
1118
+ if (-1 < value) {
1119
+ gl.glGetIntegerv(value, data);
1120
+ } else {
1121
+ fillIntBuffer(data, 0, data.capacity() - 1, 0);
1122
+ }
1123
+ }
1124
+
1125
+ @Override
1126
+ public void getFloatv(int value, FloatBuffer data) {
1127
+ if (-1 < value) {
1128
+ gl.glGetFloatv(value, data);
1129
+ } else {
1130
+ fillFloatBuffer(data, 0, data.capacity() - 1, 0);
1131
+ }
1132
+ }
1133
+
1134
+ @Override
1135
+ public boolean isEnabled(int value) {
1136
+ return gl.glIsEnabled(value);
1137
+ }
1138
+
1139
+ @Override
1140
+ public String getString(int name) {
1141
+ if (gl == null) {
1142
+ throw new PGL.GraphicsNotInitializedException("Context not initalized.");
1143
+ }
1144
+ return gl.glGetString(name);
1145
+ }
1146
+
1147
+ ///////////////////////////////////////////////////////////
1148
+
1149
+ // Error Handling
1150
+
1151
+ @Override
1152
+ public int getError() {
1153
+ return gl.glGetError();
1154
+ }
1155
+
1156
+ @Override
1157
+ public String errorString(int err) {
1158
+ return glu.gluErrorString(err);
1159
+ }
1160
+
1161
+ //////////////////////////////////////////////////////////////////////////////
1162
+
1163
+ // Buffer Objects
1164
+
1165
+ @Override
1166
+ public void genBuffers(int n, IntBuffer buffers) {
1167
+ gl.glGenBuffers(n, buffers);
1168
+ }
1169
+
1170
+ @Override
1171
+ public void deleteBuffers(int n, IntBuffer buffers) {
1172
+ gl.glDeleteBuffers(n, buffers);
1173
+ }
1174
+
1175
+ @Override
1176
+ public void bindBuffer(int target, int buffer) {
1177
+ gl.glBindBuffer(target, buffer);
1178
+ }
1179
+
1180
+ @Override
1181
+ public void bufferData(int target, int size, Buffer data, int usage) {
1182
+ gl.glBufferData(target, size, data, usage);
1183
+ }
1184
+
1185
+ @Override
1186
+ public void bufferSubData(int target, int offset, int size, Buffer data) {
1187
+ gl.glBufferSubData(target, offset, size, data);
1188
+ }
1189
+
1190
+ @Override
1191
+ public void isBuffer(int buffer) {
1192
+ gl.glIsBuffer(buffer);
1193
+ }
1194
+
1195
+ @Override
1196
+ public void getBufferParameteriv(int target, int value, IntBuffer data) {
1197
+ gl.glGetBufferParameteriv(target, value, data);
1198
+ }
1199
+
1200
+ @Override
1201
+ public ByteBuffer mapBuffer(int target, int access) {
1202
+ return gl2.glMapBuffer(target, access);
1203
+ }
1204
+
1205
+ @Override
1206
+ public ByteBuffer mapBufferRange(int target, int offset, int length, int access) {
1207
+ if (gl2x != null) {
1208
+ return gl2x.glMapBufferRange(target, offset, length, access);
1209
+ } else if (gl3 != null) {
1210
+ return gl3.glMapBufferRange(target, offset, length, access);
1211
+ } else {
1212
+ throw new RuntimeException(String.format(MISSING_GLFUNC_ERROR, "glMapBufferRange()"));
1213
+ }
1214
+ }
1215
+
1216
+ @Override
1217
+ public void unmapBuffer(int target) {
1218
+ gl2.glUnmapBuffer(target);
1219
+ }
1220
+
1221
+ //////////////////////////////////////////////////////////////////////////////
1222
+
1223
+ // Synchronization
1224
+
1225
+ @Override
1226
+ public long fenceSync(int condition, int flags) {
1227
+ if (gl3es3 != null) {
1228
+ return gl3es3.glFenceSync(condition, flags);
1229
+ } else {
1230
+ throw new RuntimeException(String.format(MISSING_GLFUNC_ERROR, "fenceSync()"));
1231
+ }
1232
+ }
1233
+
1234
+ @Override
1235
+ public void deleteSync(long sync) {
1236
+ if (gl3es3 != null) {
1237
+ gl3es3.glDeleteSync(sync);
1238
+ } else {
1239
+ throw new RuntimeException(String.format(MISSING_GLFUNC_ERROR, "deleteSync()"));
1240
+ }
1241
+ }
1242
+
1243
+ @Override
1244
+ public int clientWaitSync(long sync, int flags, long timeout) {
1245
+ if (gl3es3 != null) {
1246
+ return gl3es3.glClientWaitSync(sync, flags, timeout);
1247
+ } else {
1248
+ throw new RuntimeException(String.format(MISSING_GLFUNC_ERROR, "clientWaitSync()"));
1249
+ }
1250
+ }
1251
+
1252
+ //////////////////////////////////////////////////////////////////////////////
1253
+
1254
+ // Viewport and Clipping
1255
+
1256
+ @Override
1257
+ public void depthRangef(float n, float f) {
1258
+ gl.glDepthRangef(n, f);
1259
+ }
1260
+
1261
+ @Override
1262
+ public void viewport(int x, int y, int w, int h) {
1263
+ float scale = getPixelScale();
1264
+ viewportImpl((int)scale * x, (int)(scale * y), (int)(scale * w), (int)(scale * h));
1265
+ }
1266
+
1267
+ @Override
1268
+ protected void viewportImpl(int x, int y, int w, int h) {
1269
+ gl.glViewport(x, y, w, h);
1270
+ }
1271
+
1272
+ //////////////////////////////////////////////////////////////////////////////
1273
+
1274
+ // Reading Pixels
1275
+
1276
+ @Override
1277
+ protected void readPixelsImpl(int x, int y, int width, int height, int format, int type, Buffer buffer) {
1278
+ gl.glReadPixels(x, y, width, height, format, type, buffer);
1279
+ }
1280
+
1281
+ @Override
1282
+ protected void readPixelsImpl(int x, int y, int width, int height, int format, int type, long offset) {
1283
+ gl.glReadPixels(x, y, width, height, format, type, 0);
1284
+ }
1285
+
1286
+ //////////////////////////////////////////////////////////////////////////////
1287
+
1288
+ // Vertices
1289
+
1290
+ @Override
1291
+ public void vertexAttrib1f(int index, float value) {
1292
+ gl2.glVertexAttrib1f(index, value);
1293
+ }
1294
+
1295
+ @Override
1296
+ public void vertexAttrib2f(int index, float value0, float value1) {
1297
+ gl2.glVertexAttrib2f(index, value0, value1);
1298
+ }
1299
+
1300
+ @Override
1301
+ public void vertexAttrib3f(int index, float value0, float value1, float value2) {
1302
+ gl2.glVertexAttrib3f(index, value0, value1, value2);
1303
+ }
1304
+
1305
+ @Override
1306
+ public void vertexAttrib4f(int index, float value0, float value1, float value2, float value3) {
1307
+ gl2.glVertexAttrib4f(index, value0, value1, value2, value3);
1308
+ }
1309
+
1310
+ @Override
1311
+ public void vertexAttrib1fv(int index, FloatBuffer values) {
1312
+ gl2.glVertexAttrib1fv(index, values);
1313
+ }
1314
+
1315
+ @Override
1316
+ public void vertexAttrib2fv(int index, FloatBuffer values) {
1317
+ gl2.glVertexAttrib2fv(index, values);
1318
+ }
1319
+
1320
+ @Override
1321
+ public void vertexAttrib3fv(int index, FloatBuffer values) {
1322
+ gl2.glVertexAttrib3fv(index, values);
1323
+ }
1324
+
1325
+ @Override
1326
+ public void vertexAttrib4fv(int index, FloatBuffer values) {
1327
+ gl2.glVertexAttrib4fv(index, values);
1328
+ }
1329
+
1330
+ @Override
1331
+ public void vertexAttribPointer(int index, int size, int type, boolean normalized, int stride, int offset) {
1332
+ gl2.glVertexAttribPointer(index, size, type, normalized, stride, offset);
1333
+ }
1334
+
1335
+ @Override
1336
+ public void enableVertexAttribArray(int index) {
1337
+ gl2.glEnableVertexAttribArray(index);
1338
+ }
1339
+
1340
+ @Override
1341
+ public void disableVertexAttribArray(int index) {
1342
+ gl2.glDisableVertexAttribArray(index);
1343
+ }
1344
+
1345
+ @Override
1346
+ public void drawArraysImpl(int mode, int first, int count) {
1347
+ gl.glDrawArrays(mode, first, count);
1348
+ }
1349
+
1350
+ @Override
1351
+ public void drawElementsImpl(int mode, int count, int type, int offset) {
1352
+ gl.glDrawElements(mode, count, type, offset);
1353
+ }
1354
+
1355
+ //////////////////////////////////////////////////////////////////////////////
1356
+
1357
+ // Rasterization
1358
+
1359
+ @Override
1360
+ public void lineWidth(float width) {
1361
+ gl.glLineWidth(width);
1362
+ }
1363
+
1364
+ @Override
1365
+ public void frontFace(int dir) {
1366
+ gl.glFrontFace(dir);
1367
+ }
1368
+
1369
+ @Override
1370
+ public void cullFace(int mode) {
1371
+ gl.glCullFace(mode);
1372
+ }
1373
+
1374
+ @Override
1375
+ public void polygonOffset(float factor, float units) {
1376
+ gl.glPolygonOffset(factor, units);
1377
+ }
1378
+
1379
+ //////////////////////////////////////////////////////////////////////////////
1380
+
1381
+ // Pixel Rectangles
1382
+
1383
+ @Override
1384
+ public void pixelStorei(int pname, int param) {
1385
+ gl.glPixelStorei(pname, param);
1386
+ }
1387
+
1388
+ ///////////////////////////////////////////////////////////
1389
+
1390
+ // Texturing
1391
+
1392
+ @Override
1393
+ public void texImage2D(int target, int level, int internalFormat, int width, int height, int border, int format, int type, Buffer data) {
1394
+ gl.glTexImage2D(target, level, internalFormat, width, height, border, format, type, data);
1395
+ }
1396
+
1397
+ @Override
1398
+ public void copyTexImage2D(int target, int level, int internalFormat, int x, int y, int width, int height, int border) {
1399
+ gl.glCopyTexImage2D(target, level, internalFormat, x, y, width, height, border);
1400
+ }
1401
+
1402
+ @Override
1403
+ public void texSubImage2D(int target, int level, int xOffset, int yOffset, int width, int height, int format, int type, Buffer data) {
1404
+ gl.glTexSubImage2D(target, level, xOffset, yOffset, width, height, format, type, data);
1405
+ }
1406
+
1407
+ @Override
1408
+ public void copyTexSubImage2D(int target, int level, int xOffset, int yOffset, int x, int y, int width, int height) {
1409
+ gl.glCopyTexSubImage2D(target, level, x, y, xOffset, yOffset, width, height);
1410
+ }
1411
+
1412
+ @Override
1413
+ public void compressedTexImage2D(int target, int level, int internalFormat, int width, int height, int border, int imageSize, Buffer data) {
1414
+ gl.glCompressedTexImage2D(target, level, internalFormat, width, height, border, imageSize, data);
1415
+ }
1416
+
1417
+ @Override
1418
+ public void compressedTexSubImage2D(int target, int level, int xOffset, int yOffset, int width, int height, int format, int imageSize, Buffer data) {
1419
+ gl.glCompressedTexSubImage2D(target, level, xOffset, yOffset, width, height, format, imageSize, data);
1420
+ }
1421
+
1422
+ @Override
1423
+ public void texParameteri(int target, int pname, int param) {
1424
+ gl.glTexParameteri(target, pname, param);
1425
+ }
1426
+
1427
+ @Override
1428
+ public void texParameterf(int target, int pname, float param) {
1429
+ gl.glTexParameterf(target, pname, param);
1430
+ }
1431
+
1432
+ @Override
1433
+ public void texParameteriv(int target, int pname, IntBuffer params) {
1434
+ gl.glTexParameteriv(target, pname, params);
1435
+ }
1436
+
1437
+ @Override
1438
+ public void texParameterfv(int target, int pname, FloatBuffer params) {
1439
+ gl.glTexParameterfv(target, pname, params);
1440
+ }
1441
+
1442
+ @Override
1443
+ public void generateMipmap(int target) {
1444
+ gl.glGenerateMipmap(target);
1445
+ }
1446
+
1447
+ @Override
1448
+ public void genTextures(int n, IntBuffer textures) {
1449
+ gl.glGenTextures(n, textures);
1450
+ }
1451
+
1452
+ @Override
1453
+ public void deleteTextures(int n, IntBuffer textures) {
1454
+ gl.glDeleteTextures(n, textures);
1455
+ }
1456
+
1457
+ @Override
1458
+ public void getTexParameteriv(int target, int pname, IntBuffer params) {
1459
+ gl.glGetTexParameteriv(target, pname, params);
1460
+ }
1461
+
1462
+ @Override
1463
+ public void getTexParameterfv(int target, int pname, FloatBuffer params) {
1464
+ gl.glGetTexParameterfv(target, pname, params);
1465
+ }
1466
+
1467
+ @Override
1468
+ public boolean isTexture(int texture) {
1469
+ return gl.glIsTexture(texture);
1470
+ }
1471
+
1472
+ @Override
1473
+ protected void activeTextureImpl(int texture) {
1474
+ gl.glActiveTexture(texture);
1475
+ }
1476
+
1477
+ @Override
1478
+ protected void bindTextureImpl(int target, int texture) {
1479
+ gl.glBindTexture(target, texture);
1480
+ }
1481
+
1482
+ ///////////////////////////////////////////////////////////
1483
+
1484
+ // Shaders and Programs
1485
+
1486
+ @Override
1487
+ public int createShader(int type) {
1488
+ return gl2.glCreateShader(type);
1489
+ }
1490
+
1491
+ @Override
1492
+ public void shaderSource(int shader, String source) {
1493
+ gl2.glShaderSource(shader, 1, new String[] { source }, null, 0);
1494
+ }
1495
+
1496
+ @Override
1497
+ public void compileShader(int shader) {
1498
+ gl2.glCompileShader(shader);
1499
+ }
1500
+
1501
+ @Override
1502
+ public void releaseShaderCompiler() {
1503
+ gl2.glReleaseShaderCompiler();
1504
+ }
1505
+
1506
+ @Override
1507
+ public void deleteShader(int shader) {
1508
+ gl2.glDeleteShader(shader);
1509
+ }
1510
+
1511
+ @Override
1512
+ public void shaderBinary(int count, IntBuffer shaders, int binaryFormat, Buffer binary, int length) {
1513
+ gl2.glShaderBinary(count, shaders, binaryFormat, binary, length);
1514
+ }
1515
+
1516
+ @Override
1517
+ public int createProgram() {
1518
+ return gl2.glCreateProgram();
1519
+ }
1520
+
1521
+ @Override
1522
+ public void attachShader(int program, int shader) {
1523
+ gl2.glAttachShader(program, shader);
1524
+ }
1525
+
1526
+ @Override
1527
+ public void detachShader(int program, int shader) {
1528
+ gl2.glDetachShader(program, shader);
1529
+ }
1530
+
1531
+ @Override
1532
+ public void linkProgram(int program) {
1533
+ gl2.glLinkProgram(program);
1534
+ }
1535
+
1536
+ @Override
1537
+ public void useProgram(int program) {
1538
+ gl2.glUseProgram(program);
1539
+ }
1540
+
1541
+ @Override
1542
+ public void deleteProgram(int program) {
1543
+ gl2.glDeleteProgram(program);
1544
+ }
1545
+
1546
+ @Override
1547
+ public String getActiveAttrib(int program, int index, IntBuffer size, IntBuffer type) {
1548
+ int[] tmp = {0, 0, 0};
1549
+ byte[] namebuf = new byte[1024];
1550
+ gl2.glGetActiveAttrib(program, index, 1024, tmp, 0, tmp, 1, tmp, 2, namebuf, 0);
1551
+ size.put(tmp[1]);
1552
+ type.put(tmp[2]);
1553
+ String name = new String(namebuf, 0, tmp[0]);
1554
+ return name;
1555
+ }
1556
+
1557
+ @Override
1558
+ public int getAttribLocation(int program, String name) {
1559
+ return gl2.glGetAttribLocation(program, name);
1560
+ }
1561
+
1562
+ @Override
1563
+ public void bindAttribLocation(int program, int index, String name) {
1564
+ gl2.glBindAttribLocation(program, index, name);
1565
+ }
1566
+
1567
+ @Override
1568
+ public int getUniformLocation(int program, String name) {
1569
+ return gl2.glGetUniformLocation(program, name);
1570
+ }
1571
+
1572
+ @Override
1573
+ public String getActiveUniform(int program, int index, IntBuffer size, IntBuffer type) {
1574
+ int[] tmp= {0, 0, 0};
1575
+ byte[] namebuf = new byte[1024];
1576
+ gl2.glGetActiveUniform(program, index, 1024, tmp, 0, tmp, 1, tmp, 2, namebuf, 0);
1577
+ size.put(tmp[1]);
1578
+ type.put(tmp[2]);
1579
+ String name = new String(namebuf, 0, tmp[0]);
1580
+ return name;
1581
+ }
1582
+
1583
+ @Override
1584
+ public void uniform1i(int location, int value) {
1585
+ gl2.glUniform1i(location, value);
1586
+ }
1587
+
1588
+ @Override
1589
+ public void uniform2i(int location, int value0, int value1) {
1590
+ gl2.glUniform2i(location, value0, value1);
1591
+ }
1592
+
1593
+ @Override
1594
+ public void uniform3i(int location, int value0, int value1, int value2) {
1595
+ gl2.glUniform3i(location, value0, value1, value2);
1596
+ }
1597
+
1598
+ @Override
1599
+ public void uniform4i(int location, int value0, int value1, int value2, int value3) {
1600
+ gl2.glUniform4i(location, value0, value1, value2, value3);
1601
+ }
1602
+
1603
+ @Override
1604
+ public void uniform1f(int location, float value) {
1605
+ gl2.glUniform1f(location, value);
1606
+ }
1607
+
1608
+ @Override
1609
+ public void uniform2f(int location, float value0, float value1) {
1610
+ gl2.glUniform2f(location, value0, value1);
1611
+ }
1612
+
1613
+ @Override
1614
+ public void uniform3f(int location, float value0, float value1, float value2) {
1615
+ gl2.glUniform3f(location, value0, value1, value2);
1616
+ }
1617
+
1618
+ @Override
1619
+ public void uniform4f(int location, float value0, float value1, float value2, float value3) {
1620
+ gl2.glUniform4f(location, value0, value1, value2, value3);
1621
+ }
1622
+
1623
+ @Override
1624
+ public void uniform1iv(int location, int count, IntBuffer v) {
1625
+ gl2.glUniform1iv(location, count, v);
1626
+ }
1627
+
1628
+ @Override
1629
+ public void uniform2iv(int location, int count, IntBuffer v) {
1630
+ gl2.glUniform2iv(location, count, v);
1631
+ }
1632
+
1633
+ @Override
1634
+ public void uniform3iv(int location, int count, IntBuffer v) {
1635
+ gl2.glUniform3iv(location, count, v);
1636
+ }
1637
+
1638
+ @Override
1639
+ public void uniform4iv(int location, int count, IntBuffer v) {
1640
+ gl2.glUniform4iv(location, count, v);
1641
+ }
1642
+
1643
+ @Override
1644
+ public void uniform1fv(int location, int count, FloatBuffer v) {
1645
+ gl2.glUniform1fv(location, count, v);
1646
+ }
1647
+
1648
+ @Override
1649
+ public void uniform2fv(int location, int count, FloatBuffer v) {
1650
+ gl2.glUniform2fv(location, count, v);
1651
+ }
1652
+
1653
+ @Override
1654
+ public void uniform3fv(int location, int count, FloatBuffer v) {
1655
+ gl2.glUniform3fv(location, count, v);
1656
+ }
1657
+
1658
+ @Override
1659
+ public void uniform4fv(int location, int count, FloatBuffer v) {
1660
+ gl2.glUniform4fv(location, count, v);
1661
+ }
1662
+
1663
+ @Override
1664
+ public void uniformMatrix2fv(int location, int count, boolean transpose, FloatBuffer mat) {
1665
+ gl2.glUniformMatrix2fv(location, count, transpose, mat);
1666
+ }
1667
+
1668
+ @Override
1669
+ public void uniformMatrix3fv(int location, int count, boolean transpose, FloatBuffer mat) {
1670
+ gl2.glUniformMatrix3fv(location, count, transpose, mat);
1671
+ }
1672
+
1673
+ @Override
1674
+ public void uniformMatrix4fv(int location, int count, boolean transpose, FloatBuffer mat) {
1675
+ gl2.glUniformMatrix4fv(location, count, transpose, mat);
1676
+ }
1677
+
1678
+ @Override
1679
+ public void validateProgram(int program) {
1680
+ gl2.glValidateProgram(program);
1681
+ }
1682
+
1683
+ @Override
1684
+ public boolean isShader(int shader) {
1685
+ return gl2.glIsShader(shader);
1686
+ }
1687
+
1688
+ @Override
1689
+ public void getShaderiv(int shader, int pname, IntBuffer params) {
1690
+ gl2.glGetShaderiv(shader, pname, params);
1691
+ }
1692
+
1693
+ @Override
1694
+ public void getAttachedShaders(int program, int maxCount, IntBuffer count, IntBuffer shaders) {
1695
+ gl2.glGetAttachedShaders(program, maxCount, count, shaders);
1696
+ }
1697
+
1698
+ @Override
1699
+ public String getShaderInfoLog(int shader) {
1700
+ int[] val = { 0 };
1701
+ gl2.glGetShaderiv(shader, GL2ES2.GL_INFO_LOG_LENGTH, val, 0);
1702
+ int length = val[0];
1703
+
1704
+ byte[] log = new byte[length];
1705
+ gl2.glGetShaderInfoLog(shader, length, val, 0, log, 0);
1706
+ return new String(log);
1707
+ }
1708
+
1709
+ @Override
1710
+ public String getShaderSource(int shader) {
1711
+ int[] len = {0};
1712
+ byte[] buf = new byte[1024];
1713
+ gl2.glGetShaderSource(shader, 1024, len, 0, buf, 0);
1714
+ return new String(buf, 0, len[0]);
1715
+ }
1716
+
1717
+ @Override
1718
+ public void getShaderPrecisionFormat(int shaderType, int precisionType, IntBuffer range, IntBuffer precision) {
1719
+ gl2.glGetShaderPrecisionFormat(shaderType, precisionType, range, precision);
1720
+ }
1721
+
1722
+ @Override
1723
+ public void getVertexAttribfv(int index, int pname, FloatBuffer params) {
1724
+ gl2.glGetVertexAttribfv(index, pname, params);
1725
+ }
1726
+
1727
+ @Override
1728
+ public void getVertexAttribiv(int index, int pname, IntBuffer params) {
1729
+ gl2.glGetVertexAttribiv(index, pname, params);
1730
+ }
1731
+
1732
+ @Override
1733
+ public void getVertexAttribPointerv(int index, int pname, ByteBuffer data) {
1734
+ throw new RuntimeException(String.format(MISSING_GLFUNC_ERROR, "glGetVertexAttribPointerv()"));
1735
+ }
1736
+
1737
+ @Override
1738
+ public void getUniformfv(int program, int location, FloatBuffer params) {
1739
+ gl2.glGetUniformfv(program, location, params);
1740
+ }
1741
+
1742
+ @Override
1743
+ public void getUniformiv(int program, int location, IntBuffer params) {
1744
+ gl2.glGetUniformiv(program, location, params);
1745
+ }
1746
+
1747
+ @Override
1748
+ public boolean isProgram(int program) {
1749
+ return gl2.glIsProgram(program);
1750
+ }
1751
+
1752
+ @Override
1753
+ public void getProgramiv(int program, int pname, IntBuffer params) {
1754
+ gl2.glGetProgramiv(program, pname, params);
1755
+ }
1756
+
1757
+ @Override
1758
+ public String getProgramInfoLog(int program) {
1759
+ int[] val = { 0 };
1760
+ gl2.glGetProgramiv(program, GL2ES2.GL_INFO_LOG_LENGTH, val, 0);
1761
+ int length = val[0];
1762
+
1763
+ if (0 < length) {
1764
+ byte[] log = new byte[length];
1765
+ gl2.glGetProgramInfoLog(program, length, val, 0, log, 0);
1766
+ return new String(log);
1767
+ } else {
1768
+ return "Unknown error";
1769
+ }
1770
+ }
1771
+
1772
+ ///////////////////////////////////////////////////////////
1773
+
1774
+ // Per-Fragment Operations
1775
+
1776
+ @Override
1777
+ public void scissor(int x, int y, int w, int h) {
1778
+ float scale = getPixelScale();
1779
+ gl.glScissor((int)scale * x, (int)(scale * y), (int)(scale * w), (int)(scale * h));
1780
+ // gl.glScissor(x, y, w, h);
1781
+ }
1782
+
1783
+ @Override
1784
+ public void sampleCoverage(float value, boolean invert) {
1785
+ gl2.glSampleCoverage(value, invert);
1786
+ }
1787
+
1788
+ @Override
1789
+ public void stencilFunc(int func, int ref, int mask) {
1790
+ gl2.glStencilFunc(func, ref, mask);
1791
+ }
1792
+
1793
+ @Override
1794
+ public void stencilFuncSeparate(int face, int func, int ref, int mask) {
1795
+ gl2.glStencilFuncSeparate(face, func, ref, mask);
1796
+ }
1797
+
1798
+ @Override
1799
+ public void stencilOp(int sfail, int dpfail, int dppass) {
1800
+ gl2.glStencilOp(sfail, dpfail, dppass);
1801
+ }
1802
+
1803
+ @Override
1804
+ public void stencilOpSeparate(int face, int sfail, int dpfail, int dppass) {
1805
+ gl2.glStencilOpSeparate(face, sfail, dpfail, dppass);
1806
+ }
1807
+
1808
+ @Override
1809
+ public void depthFunc(int func) {
1810
+ gl.glDepthFunc(func);
1811
+ }
1812
+
1813
+ @Override
1814
+ public void blendEquation(int mode) {
1815
+ gl.glBlendEquation(mode);
1816
+ }
1817
+
1818
+ @Override
1819
+ public void blendEquationSeparate(int modeRGB, int modeAlpha) {
1820
+ gl.glBlendEquationSeparate(modeRGB, modeAlpha);
1821
+ }
1822
+
1823
+ @Override
1824
+ public void blendFunc(int src, int dst) {
1825
+ gl.glBlendFunc(src, dst);
1826
+ }
1827
+
1828
+ @Override
1829
+ public void blendFuncSeparate(int srcRGB, int dstRGB, int srcAlpha, int dstAlpha) {
1830
+ gl.glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
1831
+ }
1832
+
1833
+ @Override
1834
+ public void blendColor(float red, float green, float blue, float alpha) {
1835
+ gl2.glBlendColor(red, green, blue, alpha);
1836
+ }
1837
+
1838
+ // Whole Framebuffer Operations
1839
+
1840
+ @Override
1841
+ public void colorMask(boolean r, boolean g, boolean b, boolean a) {
1842
+ gl.glColorMask(r, g, b, a);
1843
+ }
1844
+
1845
+ @Override
1846
+ public void depthMask(boolean mask) {
1847
+ gl.glDepthMask(mask);
1848
+ }
1849
+
1850
+ @Override
1851
+ public void stencilMask(int mask) {
1852
+ gl.glStencilMask(mask);
1853
+ }
1854
+
1855
+ @Override
1856
+ public void stencilMaskSeparate(int face, int mask) {
1857
+ gl2.glStencilMaskSeparate(face, mask);
1858
+ }
1859
+
1860
+ @Override
1861
+ public void clearColor(float r, float g, float b, float a) {
1862
+ gl.glClearColor(r, g, b, a);
1863
+ }
1864
+
1865
+ @Override
1866
+ public void clearDepth(float d) {
1867
+ gl.glClearDepth(d);
1868
+ }
1869
+
1870
+ @Override
1871
+ public void clearStencil(int s) {
1872
+ gl.glClearStencil(s);
1873
+ }
1874
+
1875
+ @Override
1876
+ public void clear(int buf) {
1877
+ gl.glClear(buf);
1878
+ }
1879
+
1880
+ ///////////////////////////////////////////////////////////
1881
+
1882
+ // Framebuffers Objects
1883
+
1884
+ @Override
1885
+ protected void bindFramebufferImpl(int target, int framebuffer) {
1886
+ gl.glBindFramebuffer(target, framebuffer);
1887
+ }
1888
+
1889
+ @Override
1890
+ public void deleteFramebuffers(int n, IntBuffer framebuffers) {
1891
+ gl.glDeleteFramebuffers(n, framebuffers);
1892
+ }
1893
+
1894
+ @Override
1895
+ public void genFramebuffers(int n, IntBuffer framebuffers) {
1896
+ gl.glGenFramebuffers(n, framebuffers);
1897
+ }
1898
+
1899
+ @Override
1900
+ public void bindRenderbuffer(int target, int renderbuffer) {
1901
+ gl.glBindRenderbuffer(target, renderbuffer);
1902
+ }
1903
+
1904
+ @Override
1905
+ public void deleteRenderbuffers(int n, IntBuffer renderbuffers) {
1906
+ gl.glDeleteRenderbuffers(n, renderbuffers);
1907
+ }
1908
+
1909
+ @Override
1910
+ public void genRenderbuffers(int n, IntBuffer renderbuffers) {
1911
+ gl.glGenRenderbuffers(n, renderbuffers);
1912
+ }
1913
+
1914
+ @Override
1915
+ public void renderbufferStorage(int target, int internalFormat, int width, int height) {
1916
+ gl.glRenderbufferStorage(target, internalFormat, width, height);
1917
+ }
1918
+
1919
+ @Override
1920
+ public void framebufferRenderbuffer(int target, int attachment, int rendbuferfTarget, int renderbuffer) {
1921
+ gl.glFramebufferRenderbuffer(target, attachment, rendbuferfTarget, renderbuffer);
1922
+ }
1923
+
1924
+ @Override
1925
+ public void framebufferTexture2D(int target, int attachment, int texTarget, int texture, int level) {
1926
+ gl.glFramebufferTexture2D(target, attachment, texTarget, texture, level);
1927
+ }
1928
+
1929
+ @Override
1930
+ public int checkFramebufferStatus(int target) {
1931
+ return gl.glCheckFramebufferStatus(target);
1932
+ }
1933
+
1934
+ @Override
1935
+ public boolean isFramebuffer(int framebuffer) {
1936
+ return gl2.glIsFramebuffer(framebuffer);
1937
+ }
1938
+
1939
+ @Override
1940
+ public void getFramebufferAttachmentParameteriv(int target, int attachment, int pname, IntBuffer params) {
1941
+ gl2.glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
1942
+ }
1943
+
1944
+ @Override
1945
+ public boolean isRenderbuffer(int renderbuffer) {
1946
+ return gl2.glIsRenderbuffer(renderbuffer);
1947
+ }
1948
+
1949
+ @Override
1950
+ public void getRenderbufferParameteriv(int target, int pname, IntBuffer params) {
1951
+ gl2.glGetRenderbufferParameteriv(target, pname, params);
1952
+ }
1953
+
1954
+ @Override
1955
+ public void blitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, int mask, int filter) {
1956
+ if (gl2x != null) {
1957
+ gl2x.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
1958
+ } else if (gl3 != null) {
1959
+ gl3.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
1960
+ } else if (gl3es3 != null) {
1961
+ gl3es3.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
1962
+ } else {
1963
+ throw new RuntimeException(String.format(MISSING_GLFUNC_ERROR, "glBlitFramebuffer()"));
1964
+ }
1965
+ }
1966
+
1967
+ @Override
1968
+ public void renderbufferStorageMultisample(int target, int samples, int format, int width, int height) {
1969
+ if (gl2x != null) {
1970
+ gl2x.glRenderbufferStorageMultisample(target, samples, format, width, height);
1971
+ } else if (gl3 != null) {
1972
+ gl3.glRenderbufferStorageMultisample(target, samples, format, width, height);
1973
+ } else if (gl3es3 != null) {
1974
+ gl3es3.glRenderbufferStorageMultisample(target, samples, format, width, height);
1975
+ } else {
1976
+ throw new RuntimeException(String.format(MISSING_GLFUNC_ERROR, "glRenderbufferStorageMultisample()"));
1977
+ }
1978
+ }
1979
+
1980
+ @Override
1981
+ public void readBuffer(int buf) {
1982
+ if (gl2x != null) {
1983
+ gl2x.glReadBuffer(buf);
1984
+ } else if (gl3 != null) {
1985
+ gl3.glReadBuffer(buf);
1986
+ } else if (gl3es3 != null) {
1987
+ gl3es3.glReadBuffer(buf);
1988
+ } else {
1989
+ throw new RuntimeException(String.format(MISSING_GLFUNC_ERROR, "glReadBuffer()"));
1990
+ }
1991
+ }
1992
+
1993
+ @Override
1994
+ public void drawBuffer(int buf) {
1995
+ if (gl2x != null) {
1996
+ gl2x.glDrawBuffer(buf);
1997
+ } else if (gl3 != null) {
1998
+ gl3.glDrawBuffer(buf);
1999
+ } else if (gl3es3 != null) {
2000
+ IntBuffer intBuffer = IntBuffer.allocate(1);
2001
+ intBuffer.put(buf);
2002
+ intBuffer.rewind();
2003
+ gl3es3.glDrawBuffers(1, intBuffer);
2004
+ } else {
2005
+ throw new RuntimeException(String.format(MISSING_GLFUNC_ERROR, "glDrawBuffer()"));
2006
+ }
2007
+ }
2008
+ }