JOGL v2.6.0-rc-20250822
JOGL, High-Performance Graphics Binding for Java™ (public API).
GearsFBO01.java
Go to the documentation of this file.
1/**
2 * Copyright 2011-2025 JogAmp Community. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without modification, are
5 * permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice, this list of
8 * conditions and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * The views and conclusions contained in the software and documentation are those of the
25 * authors and should not be interpreted as representing official policies, either expressed
26 * or implied, of JogAmp Community.
27 */
28package com.jogamp.opengl.demos.es2;
29
30import java.nio.FloatBuffer;
31
32import com.jogamp.opengl.GL;
33import com.jogamp.opengl.GL2ES2;
34import com.jogamp.opengl.GL2GL3;
35import com.jogamp.opengl.GLAutoDrawable;
36import com.jogamp.opengl.GLCapabilities;
37import com.jogamp.opengl.GLEventListener;
38import com.jogamp.opengl.GLException;
39import com.jogamp.opengl.GLUniformData;
40import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
41import com.jogamp.common.util.VersionUtil;
42import com.jogamp.math.Recti;
43import com.jogamp.newt.event.WindowAdapter;
44import com.jogamp.newt.event.WindowEvent;
45import com.jogamp.newt.opengl.GLWindow;
46import com.jogamp.opengl.demos.util.CommandlineOptions;
47import com.jogamp.opengl.util.Animator;
48import com.jogamp.opengl.util.GLArrayDataServer;
49import com.jogamp.opengl.util.PMVMatrix;
50import com.jogamp.opengl.util.caps.NonFSAAGLCapsChooser;
51import com.jogamp.opengl.util.glsl.ShaderCode;
52import com.jogamp.opengl.util.glsl.ShaderProgram;
53import com.jogamp.opengl.util.glsl.ShaderState;
54
55/**
56 * FBO demo using a texture attachment for color- and depth-buffer
57 * - The color-buffer texture is visualized.
58 * - The depth-buffer texture is visualized non-linear and linear.
59 *
60 * The FBO programming is done `manually` w/o FBObject.
61 *
62 * We split viewport in 2 parts
63 * - left: original
64 * - right: depth-buffer
65 */
66public class GearsFBO01 implements GLEventListener {
67 private final GLEventListener demo;
68 private final int swapInterval;
69
70 private final ShaderState st;
71 private final PMVMatrix pmvMatrix;
72
73 private ShaderProgram sp0;
74 private GLUniformData pmvMatrixUniform;
75 private GLArrayDataServer interleavedVBO;
76 private final GLUniformData texUnit0;
77 private GLUniformData texType;
78
79 public GearsFBO01(final int swapInterval) {
80 this.demo = new GearsES2(0);
81 this.swapInterval = swapInterval;
82
83 st = new ShaderState();
84 // st.setVerbose(true);
85 pmvMatrix = new PMVMatrix();
86 texUnit0 = new GLUniformData("mgl_Texture0", 0);
87 }
88
89 @Override
90 public void init(final GLAutoDrawable drawable) {
91 System.err.println("Init: Chosen Caps: "+drawable.getChosenGLCapabilities());
92 final GL2ES2 gl = drawable.getGL().getGL2ES2();
93
94 demo.init(drawable);
95
96 final ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, GearsFBO01.class, "shader",
97 "shader/bin", "texture01_xxx", true);
98 final ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, GearsFBO01.class, "shader",
99 "shader/bin", "texture01_customtex", true);
100 vp0.defaultShaderCustomization(gl, true, true);
101 fp0.defaultShaderCustomization(gl, true, true);
102
103 sp0 = new ShaderProgram();
104 sp0.add(gl, vp0, System.err);
105 sp0.add(gl, fp0, System.err);
106 st.attachShaderProgram(gl, sp0, true);
107
108 pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.getSyncPMv());
109 st.ownUniform(pmvMatrixUniform);
110 st.uniform(gl, pmvMatrixUniform);
111
112 interleavedVBO = GLArrayDataServer.createGLSLInterleaved(3+4+2, GL.GL_FLOAT, false, 3*4, GL.GL_STATIC_DRAW);
113 {
114 interleavedVBO.addGLSLSubArray("mgl_Vertex", 3, GL.GL_ARRAY_BUFFER);
115 interleavedVBO.addGLSLSubArray("mgl_Color", 4, GL.GL_ARRAY_BUFFER);
116 //interleavedVBO.addGLSLSubArray("mgl_Normal", 3, GL.GL_ARRAY_BUFFER);
117 interleavedVBO.addGLSLSubArray("mgl_MultiTexCoord", 2, GL.GL_ARRAY_BUFFER);
118
119 final FloatBuffer ib = (FloatBuffer)interleavedVBO.getBuffer();
120
121 for(int i=0; i<4; i++) {
122 ib.put(s_quadVertices, i*3, 3);
123 ib.put(s_quadColors, i*4, 4);
124 //ib.put(s_cubeNormals, i*3, 3);
125 ib.put(s_quadTexCoords, i*2, 2);
126 }
127 }
128 interleavedVBO.seal(gl, true);
129 interleavedVBO.enableBuffer(gl, false);
130 st.ownAttribute(interleavedVBO, true);
131
132 texType = new GLUniformData("mgl_TexType", 1);
133 st.ownUniform(texType);
134 st.uniform(gl, texType);
135 st.ownUniform(texUnit0);
136 st.uniform(gl, texUnit0);
137
138 st.useProgram(gl, false);
139
140 viewport.set(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight());
141 initFBO(gl, viewport.width()/2, viewport.height());
142
144 }
145
146 Recti viewport = new Recti();
147 private int fboID, fboWidth, fboHeight;
148 private int colorTexID, depthTexID; // via textures
149 private int depthRenderID; // via renderbuffer
150 private final boolean useDepthTexture = true;
151 private final int colorAttachmentPoint = 0;
152
153 private void initTexParam(final GL2ES2 gl) {
158 }
159 private void initFBO(final GL2ES2 gl, final int width, final int height) {
160 // Generate a Framebuffer
161 final int tmp[] = { 0 };
162
163 colorTexID=0;
164 depthTexID=0;
165 depthRenderID=0;
166 fboWidth = 0;
167 fboHeight = 0;
168
169 gl.glGenTextures(1, tmp, 0);
170 colorTexID = tmp[0];
171 if (0 == colorTexID) {
172 throw new GLException("XXX");
173 }
174
175 if( useDepthTexture ) {
176 gl.glGenTextures(1, tmp, 0);
177 depthTexID = tmp[0];
178 if (0 == depthTexID) {
179 throw new GLException("XXX");
180 }
181 } else {
182 gl.glGenRenderbuffers(1, tmp, 0);
183 depthRenderID = tmp[0];
184 if (0 == depthRenderID) {
185 throw new GLException("XXX");
186 }
187 }
188
189 gl.glGenFramebuffers(1, tmp, 0);
190 fboID = tmp[0];
191 if (0 == fboID) {
192 throw new GLException("XXX");
193 }
194 gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, fboID);
195
196 // color tex
197 {
198 final boolean alpha=true;
199 final int iFormat, dataFormat, dataType;
200 if(gl.isGLES3()) {
201 iFormat = alpha ? GL.GL_RGBA8 : GL.GL_RGB8;
202 dataFormat = alpha ? GL.GL_RGBA : GL.GL_RGB;
203 dataType = GL.GL_UNSIGNED_BYTE;
204 } else if(gl.isGLES()) {
205 iFormat = alpha ? GL.GL_RGBA : GL.GL_RGB;
206 dataFormat = alpha ? GL.GL_RGBA : GL.GL_RGB;
207 dataType = GL.GL_UNSIGNED_BYTE;
208 } else {
209 iFormat = alpha ? GL.GL_RGBA8 : GL.GL_RGB8;
210 // textureInternalFormat = alpha ? GL.GL_RGBA : GL.GL_RGB;
211 // textureInternalFormat = alpha ? 4 : 3;
212 dataFormat = alpha ? GL.GL_BGRA : GL.GL_RGB;
213 dataType = alpha ? GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV : GL.GL_UNSIGNED_BYTE;
214 }
215 gl.glBindTexture(GL.GL_TEXTURE_2D, colorTexID);
216 gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, iFormat, width, height, 0, dataFormat, dataType, null);
217 initTexParam(gl);
218 // gl.glFramebufferTexture(GL.GL_FRAMEBUFFER, GL.GL_COLOR_ATTACHMENT0, colorTexID, 0);
219 gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_COLOR_ATTACHMENT0 + colorAttachmentPoint, GL.GL_TEXTURE_2D, colorTexID, 0);
220 }
221
222 if( useDepthTexture ) {
223 gl.glBindTexture(GL.GL_TEXTURE_2D, depthTexID);
224 gl.glTexImage2D(GL.GL_TEXTURE_2D, 0, GL.GL_DEPTH_COMPONENT32, width, height, 0, GL2ES2.GL_DEPTH_COMPONENT, GL.GL_FLOAT, null);
225 initTexParam(gl);
226 // gl.glFramebufferTexture(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, depthTexID, 0);
227 gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, GL.GL_TEXTURE_2D, depthTexID, 0);
228 } else {
229 gl.glBindRenderbuffer(GL.GL_RENDERBUFFER, depthRenderID);
230 gl.glRenderbufferStorage(GL.GL_RENDERBUFFER, GL2ES2.GL_DEPTH_COMPONENT, width, height);
231 gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, GL.GL_RENDERBUFFER, depthRenderID);
232 }
233 gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0);
234 final int fboStatus = gl.glCheckFramebufferStatus(GL.GL_FRAMEBUFFER);
235 if( GL.GL_FRAMEBUFFER_COMPLETE != fboStatus ) {
236 throw new GLException("FBO not complete, but 0x"+Integer.toHexString(fboStatus));
237 }
238 fboWidth = width;
239 fboHeight = height;
240 }
241 private void disposeFBO(final GL gl) {
242 gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, fboID);
243 gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_COLOR_ATTACHMENT0 + colorAttachmentPoint, GL.GL_TEXTURE_2D, 0, 0);
244 if( useDepthTexture ) {
245 gl.glFramebufferTexture2D(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, GL.GL_TEXTURE_2D, 0, 0);
246 } else {
247 gl.glFramebufferRenderbuffer(GL.GL_FRAMEBUFFER, GL.GL_DEPTH_ATTACHMENT, GL.GL_RENDERBUFFER, 0);
248 }
249 gl.glBindTexture(GL.GL_TEXTURE_2D, 0);
250 {
251 final int tmp[] = { colorTexID };
252 gl.glDeleteTextures(1, tmp, 0);
253 }
254 if( useDepthTexture ) {
255 final int tmp[] = { depthTexID };
256 gl.glDeleteTextures(1, tmp, 0);
257 } else {
258 final int tmp[] = { depthRenderID };
259 gl.glDeleteRenderbuffers(1, tmp, 0);
260 }
261 colorTexID=0;
262 depthTexID=0;
263 depthRenderID=0;
264 fboWidth = 0;
265 fboHeight = 0;
266
267 gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, 0);
268 {
269 final int tmp[] = { fboID };
270 gl.glDeleteFramebuffers(1, tmp, 0);
271 fboID = 0;
272 }
273 }
274 private void resetFBOs(final GL2ES2 gl, final int width, final int height) {
275 if( fboWidth != width || fboHeight != height ) {
276 disposeFBO(gl);
277 initFBO(gl, width, height);
278 }
279 }
280
281 @Override
282 public void dispose(final GLAutoDrawable drawable) {
283 final GL2ES2 gl = drawable.getGL().getGL2ES2();
284 demo.dispose(drawable);
285 disposeFBO(gl);
286 st.destroy(gl);
287
288 sp0 = null;
289 pmvMatrixUniform = null;
290 interleavedVBO = null;
291 }
292
293 @Override
294 public void display(final GLAutoDrawable drawable) {
295 final GL2ES2 gl = drawable.getGL().getGL2ES2();
296
297 {
298 gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
300 }
301 {
302 gl.glViewport(viewport.x(), viewport.y(), fboWidth, fboHeight);
304 demo.display(drawable);
306 }
307 st.useProgram(gl, true);
308 {
309 // FBO color-buffer
310 texType.setData(0);
311 st.uniform(gl, texType);
312
313 gl.glActiveTexture(GL.GL_TEXTURE0 + texUnit0.intValue());
314 {
315 gl.glBindTexture(GL.GL_TEXTURE_2D, colorTexID);
316 if( !gl.isGLcore() ) {
318 }
319 }
320 interleavedVBO.enableBuffer(gl, true);
321
323
324 interleavedVBO.enableBuffer(gl, false);
325
327
328 gl.glViewport(viewport.x(), viewport.y(), viewport.width(), viewport.height());
329 }
330 {
331 // FBO depth-buffer
332 gl.glViewport(viewport.x()+fboWidth, viewport.y(), fboWidth, fboHeight);
333
334 texType.setData(1);
335 st.uniform(gl, texType);
336
337 gl.glActiveTexture(GL.GL_TEXTURE0 + texUnit0.intValue());
338 {
339 gl.glBindTexture(GL.GL_TEXTURE_2D, depthTexID);
340 if( !gl.isGLcore() ) {
342 }
343 }
344 interleavedVBO.enableBuffer(gl, true);
345
347
348 interleavedVBO.enableBuffer(gl, false);
349
351
352 gl.glViewport(viewport.x(), viewport.y(), viewport.width(), viewport.height());
353 }
354 st.useProgram(gl, false);
355 }
356
357 @Override
358 public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {
359 final GL2ES2 gl = drawable.getGL().getGL2ES2();
360
361 viewport.set(x, y, width, height);
362
363 System.err.println("**** Reshape.Reset: "+width+"x"+height);
364 resetFBOs(gl, width/2, height);
365
366 gl.glViewport(viewport.x(), viewport.y(), fboWidth, fboHeight);
368 demo.reshape(drawable, x, y, fboWidth, fboHeight);
370 gl.glViewport(viewport.x(), viewport.y(), viewport.width(), viewport.height());
371
372 gl.setSwapInterval(swapInterval);
373
375 pmvMatrix.glLoadIdentity();
376 pmvMatrix.glOrthof(-1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 10.0f);
377
379 pmvMatrix.glLoadIdentity();
380
381 st.useProgram(gl, true);
382 st.uniform(gl, pmvMatrixUniform);
383 st.useProgram(gl, false);
384
385 }
386
387 private static final float[] s_quadVertices = {
388 -1f, -1f, 0f, // LB
389 1f, -1f, 0f, // RB
390 -1f, 1f, 0f, // LT
391 1f, 1f, 0f // RT
392 };
393 private static final float[] s_quadColors = {
394 1f, 1f, 1f, 1f,
395 1f, 1f, 1f, 1f,
396 1f, 1f, 1f, 1f,
397 1f, 1f, 1f, 1f };
398 private static final float[] s_quadTexCoords = {
399 0f, 0f, // LB
400 1f, 0f, // RB
401 0f, 1f, // LT
402 1f, 1f // RT
403 };
404
405 public static void main(final String[] args) {
406 final CommandlineOptions options = new CommandlineOptions(1280, 720, 0);
407
408 System.err.println(options);
409 System.err.println(VersionUtil.getPlatformInfo());
410 // System.err.println(JoglVersion.getAllAvailableCapabilitiesInfo(dpy.getGraphicsDevice(), null).toString());
411
412 final GLCapabilities reqCaps = options.getGLCaps();
413 System.out.println("Requested: " + reqCaps);
414
415 final GLWindow window = GLWindow.create(reqCaps);
416 if( 0 == options.sceneMSAASamples ) {
418 }
419 window.setSize(options.surface_width, options.surface_height);
420 window.setTitle(GearsFBO01.class.getSimpleName());
421
422 window.addGLEventListener(new GearsFBO01(1));
423 final Animator animator = new Animator(0 /* w/o AWT */);
424 animator.setUpdateFPSFrames(5*60, null);
425 animator.add(window);
426
427 window.addWindowListener(new WindowAdapter() {
428 @Override
429 public void windowDestroyed(final WindowEvent e) {
430 animator.stop();
431 }
432 });
433
434 window.setVisible(true);
435 animator.start();
436 }
437
438}
Rectangle with x, y, width and height integer components.
Definition: Recti.java:34
void set(final Recti o)
this = o, returns this.
Definition: Recti.java:59
final SyncMatrices4f getSyncPMv()
Returns SyncMatrices4f of 2 matrices within one FloatBuffer: P and Mv.
NEWT Window events are provided for notification purposes ONLY.
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
Definition: GLWindow.java:121
final void setTitle(final String title)
Definition: GLWindow.java:297
final void setSize(final int width, final int height)
Sets the size of the window's client area in window units, excluding decorations.
Definition: GLWindow.java:625
final void setVisible(final boolean visible)
Calls setVisible(true, visible), i.e.
Definition: GLWindow.java:615
final void addWindowListener(final WindowListener l)
Appends the given com.jogamp.newt.event.WindowListener to the end of the list.
Definition: GLWindow.java:882
CapabilitiesChooser setCapabilitiesChooser(final CapabilitiesChooser chooser)
Set the CapabilitiesChooser to help determine the native visual type.
Definition: GLWindow.java:261
static GLWindow create(final GLCapabilitiesImmutable caps)
Creates a new GLWindow attaching a new Window referencing a new default Screen and default Display wi...
Definition: GLWindow.java:169
Specifies a set of OpenGL capabilities.
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
GLSL uniform data wrapper encapsulating data to be uploaded to the GPU as a uniform.
GLUniformData setData(final int data)
FBO demo using a texture attachment for color- and depth-buffer.
Definition: GearsFBO01.java:66
void init(final GLAutoDrawable drawable)
Called by the drawable immediately after the OpenGL context is initialized.
Definition: GearsFBO01.java:90
void dispose(final GLAutoDrawable drawable)
Notifies the listener to perform the release of all OpenGL resources per GLContext,...
void display(final GLAutoDrawable drawable)
Called by the drawable to initiate OpenGL rendering by the client.
static void main(final String[] args)
GearsFBO01(final int swapInterval)
Definition: GearsFBO01.java:79
void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height)
Called by the drawable during the first repaint after the component has been resized.
final synchronized void add(final GLAutoDrawable drawable)
Adds a drawable to this animator's list of rendering drawables.
final void setUpdateFPSFrames(final int frames, final PrintStream out)
final synchronized boolean start()
Starts this animator, if not running.
Definition: Animator.java:344
final synchronized boolean stop()
Stops this animator.
Definition: Animator.java:368
void seal(final GL gl, final boolean seal)
Convenience method calling seal(boolean) and enableBuffer(GL, boolean).
void enableBuffer(final GL gl, final boolean enable)
Enables the buffer if enable is true, and transfers the data if required.
static GLArrayDataServer createGLSLInterleaved(final int compsPerElement, final int dataType, final boolean normalized, final int initialElementCount, final int vboUsage)
Create a VBO for GLSL interleaved array data starting with a new created Buffer object with initialEl...
GLArrayDataWrapper addGLSLSubArray(final String name, final int comps, final int vboTarget)
Configure a segment of this GLSL interleaved array (see createGLSLInterleaved(int,...
Buffer getBuffer()
The Buffer holding the data, may be null if a GPU buffer without client bound data.
PMVMatrix implements a subset of the fixed function pipeline GLMatrixFunc using PMVMatrix4f.
Definition: PMVMatrix.java:62
final void glMatrixMode(final int matrixName)
Sets the current matrix mode.
Definition: PMVMatrix.java:218
final void glOrthof(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar)
Multiply the current matrix with the orthogonal matrix.
Definition: PMVMatrix.java:469
final void glLoadIdentity()
Load the current matrix with the identity matrix.
Definition: PMVMatrix.java:325
Custom GLCapabilitiesChooser, filtering out all full screen anti-aliasing (FSAA, multisample) capabil...
Convenient shader code class to use and instantiate vertex or fragment programs.
Definition: ShaderCode.java:75
final int defaultShaderCustomization(final GL2ES2 gl, final boolean preludeVersion, final boolean addDefaultPrecision)
Default customization of this shader source code.
static ShaderCode create(final GL2ES2 gl, final int type, final int count, final Class<?> context, final String[] sourceFiles, final boolean mutableStringBuilder)
Creates a complete ShaderCode object while reading all shader source of sourceFiles,...
synchronized void add(final ShaderCode shaderCode)
Adds a new shader to this program.
ShaderState allows to sharing data between shader programs, while updating the attribute and uniform ...
void ownAttribute(final GLArrayData attribute, final boolean own)
Binds or unbinds the GLArrayData lifecycle to this ShaderState.
synchronized void useProgram(final GL2ES2 gl, final boolean on)
Turns the shader program on or off.
synchronized boolean attachShaderProgram(final GL2ES2 gl, final ShaderProgram prog, final boolean enable)
Attach or switch a shader program.
synchronized void destroy(final GL2ES2 gl)
Calls release(gl, true, true, true).
boolean uniform(final GL2ES2 gl, final GLUniformData data)
Set the uniform data, if it's location is valid, i.e.
void ownUniform(final GLUniformData uniform)
Bind the GLUniform lifecycle to this ShaderState.
static final int GL_VERTEX_SHADER
GL_ES_VERSION_2_0, GL_VERSION_2_0, GL_EXT_vertex_shader, GL_ARB_vertex_shader Alias for: GL_VERTEX_SH...
Definition: GL2ES2.java:39
static final int GL_FRAGMENT_SHADER
GL_ES_VERSION_2_0, GL_VERSION_2_0, GL_ATI_fragment_shader, GL_ARB_fragment_shader Alias for: GL_FRAGM...
Definition: GL2ES2.java:585
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
GL getGL()
Returns the GL pipeline object this GLAutoDrawable uses.
void addGLEventListener(GLEventListener listener)
Adds the given listener to the end of this drawable queue.
boolean isGLES()
Indicates whether this GL object conforms to one of the OpenGL ES profiles, see isGLES1(),...
GL2ES2 getGL2ES2()
Casts this object to the GL2ES2 interface.
void setSwapInterval(int interval)
Set the swap interval of the current context and attached onscreen GLDrawable.
boolean isGLcore()
Indicates whether this GL object uses a GL core profile.
boolean isGLES3()
Indicates whether this GL object conforms to the OpenGL ES ≥ 3.0 profile.
GLCapabilitiesImmutable getChosenGLCapabilities()
Fetches the GLCapabilitiesImmutable corresponding to the chosen OpenGL capabilities (pixel format / v...
int getSurfaceWidth()
Returns the width of this GLDrawable's surface client area in pixel units.
int getSurfaceHeight()
Returns the height of this GLDrawable's surface client area in pixel units.
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.
void dispose(GLAutoDrawable drawable)
Notifies the listener to perform the release of all OpenGL resources per GLContext,...
void display(GLAutoDrawable drawable)
Called by the drawable to initiate OpenGL rendering by the client.
void init(GLAutoDrawable drawable)
Called by the drawable immediately after the OpenGL context is initialized.
void reshape(GLAutoDrawable drawable, int x, int y, int width, int height)
Called by the drawable during the first repaint after the component has been resized.
void glFramebufferTexture2D(int target, int attachment, int textarget, int texture, int level)
Entry point to C language function: void {@native glFramebufferTexture2D}(GLenum target,...
static final int GL_TEXTURE_MAG_FILTER
GL_ES_VERSION_2_0, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_TEXTURE_MAG_FILTER" with expression '...
Definition: GL.java:197
void glDrawArrays(int mode, int first, int count)
Entry point to C language function: void {@native glDrawArrays}(GLenum mode, GLint first,...
static final int GL_STATIC_DRAW
GL_VERSION_1_5, GL_ES_VERSION_2_0, GL_VERSION_ES_1_0, GL_ARB_vertex_buffer_object Alias for: GL_STATI...
Definition: GL.java:673
static final int GL_TEXTURE_2D
GL_ES_VERSION_2_0, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_TEXTURE_2D" with expression '0x0DE1',...
Definition: GL.java:491
static final int GL_TEXTURE_WRAP_S
GL_ES_VERSION_2_0, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_TEXTURE_WRAP_S" with expression '0x28...
Definition: GL.java:485
void glBindTexture(int target, int texture)
Entry point to C language function: void {@native glBindTexture}(GLenum target, GLuint texture) Pa...
static final int GL_FLOAT
GL_ES_VERSION_2_0, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_FLOAT" with expression '0x1406',...
Definition: GL.java:786
void glGenTextures(int n, IntBuffer textures)
Entry point to C language function: void {@native glGenTextures}(GLsizei n, GLuint * textures) Par...
int glCheckFramebufferStatus(int target)
Entry point to C language function: GLenum {@native glCheckFramebufferStatus}(GLenum target) Part ...
void glRenderbufferStorage(int target, int internalformat, int width, int height)
Entry point to C language function: void {@native glRenderbufferStorage}(GLenum target,...
void glGenFramebuffers(int n, IntBuffer framebuffers)
Entry point to C language function: void {@native glGenFramebuffers}(GLsizei n, GLuint * framebuffer...
static final int GL_TEXTURE_MIN_FILTER
GL_ES_VERSION_2_0, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_TEXTURE_MIN_FILTER" with expression '...
Definition: GL.java:372
static final int GL_COLOR_BUFFER_BIT
GL_ES_VERSION_2_0, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_COLOR_BUFFER_BIT" with expression '0x...
Definition: GL.java:390
void glBindRenderbuffer(int target, int renderbuffer)
Entry point to C language function: void {@native glBindRenderbuffer}(GLenum target,...
void glFramebufferRenderbuffer(int target, int attachment, int renderbuffertarget, int renderbuffer)
Entry point to C language function: void {@native glFramebufferRenderbuffer}(GLenum target,...
void glClearColor(float red, float green, float blue, float alpha)
Entry point to C language function: void {@native glClearColor}(GLfloat red, GLfloat green,...
void glEnable(int cap)
Entry point to C language function: void {@native glEnable}(GLenum cap) Part of GL_ES_VERSION_2_0,...
static final int GL_TEXTURE_WRAP_T
GL_ES_VERSION_2_0, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_TEXTURE_WRAP_T" with expression '0x28...
Definition: GL.java:489
static final int GL_DEPTH_TEST
GL_ES_VERSION_2_0, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_DEPTH_TEST" with expression '0x0B71',...
Definition: GL.java:43
void glActiveTexture(int texture)
Entry point to C language function: void {@native glActiveTexture}(GLenum texture) Part of GL_ES_V...
void glClear(int mask)
Entry point to C language function: void {@native glClear}(GLbitfield mask) Part of GL_ES_VERSION_...
void glTexParameteri(int target, int pname, int param)
Entry point to C language function: void {@native glTexParameteri}(GLenum target,...
static final int GL_TRIANGLE_STRIP
GL_ES_VERSION_2_0, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_TRIANGLE_STRIP" with expression '0x00...
Definition: GL.java:760
void glBindFramebuffer(int target, int framebuffer)
Entry point to C language function: void {@native glBindFramebuffer}(GLenum target,...
static final int GL_NEAREST
GL_ES_VERSION_2_0, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_NEAREST" with expression '0x2600',...
Definition: GL.java:715
void glViewport(int x, int y, int width, int height)
Entry point to C language function: void {@native glViewport}(GLint x, GLint y, GLsizei width,...
static final int GL_TEXTURE0
GL_ES_VERSION_2_0, GL_VERSION_1_3, GL_VERSION_ES_1_0, GL_ARB_multitexture Alias for: GL_TEXTURE0_ARB ...
Definition: GL.java:71
void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, int format, int type, Buffer pixels)
Entry point to C language function: void {@native glTexImage2D}(GLenum target, GLint level,...
static final int GL_DEPTH_BUFFER_BIT
GL_ES_VERSION_2_0, GL_VERSION_1_0, GL_VERSION_ES_1_0 Define "GL_DEPTH_BUFFER_BIT" with expression '0x...
Definition: GL.java:738
static final int GL_CLAMP_TO_EDGE
GL_ES_VERSION_2_0, GL_VERSION_1_2, GL_VERSION_ES_1_0, GL_SGIS_texture_edge_clamp Alias for: GL_CLAMP_...
Definition: GL.java:775
void glGenRenderbuffers(int n, IntBuffer renderbuffers)
Entry point to C language function: void {@native glGenRenderbuffers}(GLsizei n, GLuint * renderbuff...
static final int GL_FRAMEBUFFER
GL_ES_VERSION_2_0, GL_ARB_framebuffer_object, GL_VERSION_3_0, GL_OES_framebuffer_object,...
Definition: GL.java:630
static final int GL_ARRAY_BUFFER
GL_VERSION_1_5, GL_ES_VERSION_2_0, GL_VERSION_ES_1_0, GL_ARB_vertex_buffer_object Alias for: GL_ARRAY...
Definition: GL.java:633
Subset of OpenGL fixed function pipeline's matrix operations.
static final int GL_PROJECTION
Matrix mode projection.
static final int GL_MODELVIEW
Matrix mode modelview.