JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
GLBase.java
Go to the documentation of this file.
1/**
2 * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
3 * Copyright 2010 JogAmp Community. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification, are
6 * permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice, this list of
9 * conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
12 * of conditions and the following disclaimer in the documentation and/or other materials
13 * provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
17 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
23 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 * The views and conclusions contained in the software and documentation are those of the
26 * authors and should not be interpreted as representing official policies, either expressed
27 * or implied, of JogAmp Community.
28 */
29
30package com.jogamp.opengl;
31
32/**
33 * <P>The base interface from which all GL profiles derive, providing
34 * checked conversion down to concrete profiles, access to the
35 * OpenGL context associated with the GL and extension/function
36 * availability queries as described below.</P>
37 *
38 * <P> While the APIs for vendor extensions are unconditionally
39 * exposed, the underlying functions may not be present. The method
40 * {@link #isFunctionAvailable} should be used to query the
41 * availability of any non-core function before it is used for the
42 * first time; for example,
43 * <code>gl.isFunctionAvailable("glProgramStringARB")</code>. On
44 * certain platforms (Windows in particular), the most "core"
45 * functionality is only OpenGL 1.1, so in theory any routines first
46 * exposed in OpenGL 1.2, 1.3, and 1.4, 1.5, or 2.0 as well as vendor
47 * extensions should all be queried. Calling an unavailable function
48 * will cause a {@link GLException} to be raised. </P>
49 *
50 * {@link #isExtensionAvailable} may also be used to determine whether
51 * a specific extension is available before calling the routines or
52 * using the functionality it exposes: for example,
53 * <code>gl.isExtensionAvailable("GL_ARB_vertex_program");</code>.
54 * However, in this case it is up to the end user to know which
55 * routines or functionality are associated with which OpenGL
56 * extensions. It may also be used to test for the availability of a
57 * particular version of OpenGL: for example,
58 * <code>gl.isExtensionAvailable("GL_VERSION_1_5");</code>.
59 *
60 * <P> Exceptions to the window system extension naming rules:
61 *
62 * <UL>
63 *
64 * <LI> WGL_ARB_pbuffer, WGL_ARB_pixel_format, and other
65 * platform-specific pbuffer functionality; the availability of
66 * pbuffers can be queried on Windows, X11 and Mac OS X platforms by
67 * querying {@link #isExtensionAvailable} with an argument of
68 * "GL_ARB_pbuffer" or "GL_ARB_pixel_format".</LI>
69 *
70 * </UL> <P>
71 *
72 */
73public interface GLBase {
74
75 /**
76 * Indicates whether this GL object conforms to any of the OpenGL profiles.
77 */
78 public boolean isGL();
79
80 /**
81 * Indicates whether this GL object conforms to the OpenGL &ge; 4.0 compatibility profile.
82 * The GL4 compatibility profile includes the GL2, GL2ES1, GL2ES2, GL3, GL3bc and GL4 profile.
83 * @see GLContext#isGL4bc()
84 */
85 public boolean isGL4bc();
86
87 /**
88 * Indicates whether this GL object conforms to the OpenGL &ge; 4.0 core profile.
89 * The GL4 core profile includes the GL2ES2, and GL3 profile.
90 * @see GLContext#isGL4()
91 */
92 public boolean isGL4();
93
94 /**
95 * Indicates whether this GL object conforms to the OpenGL &ge; 3.1 compatibility profile.
96 * The GL3 compatibility profile includes the GL2, GL2ES1, GL2ES2 and GL3 profile.
97 * @see GLContext#isGL3bc()
98 */
99 public boolean isGL3bc();
100
101 /**
102 * Indicates whether this GL object conforms to the OpenGL &ge; 3.1 core profile.
103 * The GL3 core profile includes the GL2ES2 profile.
104 * @see GLContext#isGL3()
105 */
106 public boolean isGL3();
107
108 /**
109 * Indicates whether this GL object conforms to the OpenGL &le; 3.0 profile.
110 * The GL2 profile includes the GL2ES1 and GL2ES2 profile.
111 * @see GLContext#isGL2()
112 */
113 public boolean isGL2();
114
115 /**
116 * Indicates whether this GL object conforms to the OpenGL ES &ge; 1.0 profile.
117 * @see GLContext#isGLES1()
118 */
119 public boolean isGLES1();
120
121 /**
122 * Indicates whether this GL object conforms to the OpenGL ES &ge; 2.0 profile.
123 * <p>
124 * Remark: ES2 compatible desktop profiles are not included.
125 * To query whether core ES2 functionality is provided, use {@link #isGLES2Compatible()}.
126 * </p>
127 * @see #isGLES2Compatible()
128 * @see GLContext#isGLES2()
129 */
130 public boolean isGLES2();
131
132 /**
133 * Indicates whether this GL object conforms to the OpenGL ES &ge; 3.0 profile.
134 * <p>
135 * Remark: ES3 compatible desktop profiles are not included.
136 * To query whether core ES3 functionality is provided, use {@link #isGLES3Compatible()}.
137 * </p>
138 * @see #isGLES3Compatible()
139 * @see GLContext#isGLES3()
140 */
141 public boolean isGLES3();
142
143 /**
144 * Indicates whether this GL object conforms to one of the OpenGL ES profiles,
145 * see {@link #isGLES1()}, {@link #isGLES2()} and {@link #isGLES3()}.
146 * @see GLContext#isGLES()
147 */
148 public boolean isGLES();
149
150 /**
151 * Indicates whether this GL object conforms to a GL2ES1 compatible profile.
152 * @see GLContext#isGL2ES1()
153 */
154 public boolean isGL2ES1();
155
156 /**
157 * Indicates whether this GL object conforms to a GL2ES2 compatible profile.
158 * @see GLContext#isGL2ES2()
159 */
160 public boolean isGL2ES2();
161
162 /**
163 * Indicates whether this GL object conforms to a either a GL2GL3 or GL3ES3 compatible profile.
164 * @see GLContext#isGL2ES3()
165 */
166 public boolean isGL2ES3();
167
168 /**
169 * Indicates whether this GL object conforms to a GL3ES3 compatible profile.
170 * @see GLContext#isGL3ES3()
171 */
172 public boolean isGL3ES3();
173
174 /**
175 * Returns true if this GL object conforms to a GL4ES3 compatible profile, i.e. if {@link #isGLES3Compatible()} returns true.
176 * <p>Includes [ GL &ge; 4.3, GL &ge; 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ]</p>
177 * @see GLContext#isGL4ES3()
178 */
179 public boolean isGL4ES3();
180
181 /**
182 * Indicates whether this GL object conforms to a GL2GL3 compatible profile.
183 * @see GLContext#isGL2GL3()
184 */
185 public boolean isGL2GL3();
186
187 /**
188 * Indicates whether this GL object uses a GL4 core profile. <p>Includes [ GL4 ].</p>
189 * @see GLContext#isGL4core()
190 */
191 public boolean isGL4core();
192
193 /**
194 * Indicates whether this GL object uses a GL3 core profile. <p>Includes [ GL4, GL3 ].</p>
195 * @see GLContext#isGL3core()
196 */
197 public boolean isGL3core();
198
199 /**
200 * Indicates whether this GL object uses a GL core profile. <p>Includes [ GL4, GL3, GLES3, GL2ES2 ].</p>
201 * @see GLContext#isGLcore()
202 */
203 public boolean isGLcore();
204
205 /**
206 * Indicates whether this GL object is compatible with the core OpenGL ES2 functionality.
207 * @return true if this context is an ES2 context or implements
208 * the extension <code>GL_ARB_ES2_compatibility</code>, otherwise false
209 * @see GLContext#isGLES2Compatible()
210 */
211 public boolean isGLES2Compatible();
212
213 /**
214 * Indicates whether this GL object is compatible with the core OpenGL ES3 functionality.
215 * <p>
216 * Return true if the underlying context is an ES3 context or implements
217 * the extension <code>GL_ARB_ES3_compatibility</code>, otherwise false.
218 * </p>
219 * <p>
220 * Includes [ GL &ge; 4.3, GL &ge; 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ]
221 * </p>
222 * @see GLContext#isGLES3Compatible()
223 */
224 public boolean isGLES3Compatible();
225
226 /**
227 * Indicates whether this GL object is compatible with the core OpenGL ES3.1 functionality.
228 * <p>
229 * Return true if the underlying context is an ES3 context &ge; 3.1 or implements
230 * the extension <code>GL_ARB_ES3_1_compatibility</code>, otherwise false.
231 * </p>
232 * <p>
233 * Includes [ GL &ge; 4.5, GL &ge; 3.1 w/ GL_ARB_ES3_1_compatibility and GLES3 &ge; 3.1 ]
234 * </p>
235 * @see GLContext#isGLES31Compatible()
236 */
237 public boolean isGLES31Compatible();
238
239 /**
240 * Indicates whether this GL object is compatible with the core OpenGL ES3.2 functionality.
241 * <p>
242 * Return true if the underlying context is an ES3 context &ge; 3.2 or implements
243 * the extension <code>GL_ARB_ES3_2_compatibility</code>, otherwise false.
244 * </p>
245 * <p>
246 * Includes [ GL &ge; 4.5, GL &ge; 3.1 w/ GL_ARB_ES3_2_compatibility and GLES3 &ge; 3.2 ]
247 * </p>
248 * @see GLContext#isGLES32Compatible()
249 */
250 public boolean isGLES32Compatible();
251
252 /**
253 * Indicates whether this GL object supports GLSL.
254 * @see GLContext#hasGLSL()
255 */
256 public boolean hasGLSL();
257
258 /**
259 * Returns the downstream GL instance in case this is a wrapping pipeline, otherwise <code>null</code>.
260 * <p>
261 * See {@link #getRootGL()} for retrieving the implementing root instance.
262 * </p>
263 * @throws GLException if the downstream instance is not null and not a GL implementation
264 * @see #getRootGL()
265 */
267
268 /**
269 * Returns the implementing root instance, considering a wrapped pipelined hierarchy, see {@link #getDownstreamGL()}.
270 * <p>
271 * If this instance is not a wrapping pipeline, i.e. has no downstream instance,
272 * this instance is returned.
273 * </p>
274 * @throws GLException if the root instance is not a GL implementation
275 */
276 public GL getRootGL() throws GLException;
277
278 /**
279 * Casts this object to the GL interface.
280 * @throws GLException if this object is not a GL implementation
281 */
282 public GL getGL() throws GLException;
283
284 /**
285 * Casts this object to the GL4bc interface.
286 * @throws GLException if this object is not a GL4bc implementation
287 */
288 public GL4bc getGL4bc() throws GLException;
289
290 /**
291 * Casts this object to the GL4 interface.
292 * @throws GLException if this object is not a GL4 implementation
293 */
294 public GL4 getGL4() throws GLException;
295
296 /**
297 * Casts this object to the GL3bc interface.
298 * @throws GLException if this object is not a GL3bc implementation
299 */
300 public GL3bc getGL3bc() throws GLException;
301
302 /**
303 * Casts this object to the GL3 interface.
304 * @throws GLException if this object is not a GL3 implementation
305 */
306 public GL3 getGL3() throws GLException;
307
308 /**
309 * Casts this object to the GL2 interface.
310 * @throws GLException if this object is not a GL2 implementation
311 */
312 public GL2 getGL2() throws GLException;
313
314 /**
315 * Casts this object to the GLES1 interface.
316 * @throws GLException if this object is not a GLES1 implementation
317 */
318 public GLES1 getGLES1() throws GLException;
319
320 /**
321 * Casts this object to the GLES2 interface.
322 * @throws GLException if this object is not a GLES2 implementation
323 */
324 public GLES2 getGLES2() throws GLException;
325
326 /**
327 * Casts this object to the GLES3 interface.
328 * @throws GLException if this object is not a GLES3 implementation
329 */
330 public GLES3 getGLES3() throws GLException;
331
332 /**
333 * Casts this object to the GL2ES1 interface.
334 * @throws GLException if this object is not a GL2ES1 implementation
335 */
336 public GL2ES1 getGL2ES1() throws GLException;
337
338 /**
339 * Casts this object to the GL2ES2 interface.
340 * @throws GLException if this object is not a GL2ES2 implementation
341 */
342 public GL2ES2 getGL2ES2() throws GLException;
343
344 /**
345 * Casts this object to the GL2ES3 interface.
346 * @throws GLException if this object is not a GL2ES3 implementation
347 */
348 public GL2ES3 getGL2ES3() throws GLException;
349
350 /**
351 * Casts this object to the GL3ES3 interface.
352 * @throws GLException if this object is not a GL3ES3 implementation
353 */
354 public GL3ES3 getGL3ES3() throws GLException;
355
356 /**
357 * Casts this object to the GL4ES3 interface.
358 * @throws GLException if this object is not a GL4ES3 implementation
359 */
360 public GL4ES3 getGL4ES3() throws GLException;
361
362 /**
363 * Casts this object to the GL2GL3 interface.
364 * @throws GLException if this object is not a GL2GL3 implementation
365 */
366 public GL2GL3 getGL2GL3() throws GLException;
367
368 /**
369 * Returns the GLProfile associated with this GL object.
370 */
372
373 /**
374 * Returns the GLContext associated which this GL object.
375 */
377
378 /**
379 * Returns true if the specified OpenGL core- or extension-function can be
380 * used successfully through this GL instance given the current host (OpenGL
381 * <i>client</i>) and display (OpenGL <i>server</i>) configuration.<P>
382 * By "successfully" we mean that the function is both <i>callable</i>
383 * on the machine running the program and <i>available</i> on the current
384 * display.<P>
385 *
386 * In order to call a function successfully, the function must be both
387 * <i>callable</i> on the machine running the program and <i>available</i> on
388 * the display device that is rendering the output (note: on non-networked,
389 * single-display machines these two conditions are identical; on networked and/or
390 * multi-display machines this becomes more complicated). These conditions are
391 * met if the function is either part of the core OpenGL version supported by
392 * both the host and display, or it is an OpenGL extension function that both
393 * the host and display support. <P>
394 *
395 * A GL function is <i>callable</i> if it is successfully linked at runtime,
396 * hence the GLContext must be made current at least once.
397 *
398 * @param glFunctionName the name of the OpenGL function (e.g., use
399 * "glBindRenderbufferEXT" or "glBindRenderbuffer" to check if {@link
400 * GL#glBindRenderbuffer(int,int)} is available).
401 */
402 public boolean isFunctionAvailable(String glFunctionName);
403
404 /**
405 * Returns true if the specified OpenGL extension can be
406 * used successfully through this GL instance given the current host (OpenGL
407 * <i>client</i>) and display (OpenGL <i>server</i>) configuration.<P>
408 *
409 * @param glExtensionName the name of the OpenGL extension (e.g.,
410 * "GL_ARB_vertex_program").
411 */
412 public boolean isExtensionAvailable(String glExtensionName);
413
414 /**
415 * Returns <code>true</code> if basic FBO support is available, otherwise <code>false</code>.
416 * <p>
417 * Basic FBO is supported if the context is either GL-ES >= 2.0, GL >= 3.0 [core, compat] or implements the extensions
418 * <code>GL_ARB_ES2_compatibility</code>, <code>GL_ARB_framebuffer_object</code>, <code>GL_EXT_framebuffer_object</code> or <code>GL_OES_framebuffer_object</code>.
419 * </p>
420 * <p>
421 * Basic FBO support may only include one color attachment and no multisampling,
422 * as well as limited internal formats for renderbuffer.
423 * </p>
424 * @see GLContext#hasBasicFBOSupport()
425 */
426 public boolean hasBasicFBOSupport();
427
428 /**
429 * Returns <code>true</code> if full FBO support is available, otherwise <code>false</code>.
430 * <p>
431 * Full FBO is supported if the context is either GL >= core 3.0 [ES, core, compat] or implements the extensions
432 * <code>ARB_framebuffer_object</code>, or all of
433 * <code>EXT_framebuffer_object</code>, <code>EXT_framebuffer_multisample</code>,
434 * <code>EXT_framebuffer_blit</code>, <code>GL_EXT_packed_depth_stencil</code>.
435 * </p>
436 * <p>
437 * Full FBO support includes multiple color attachments and multisampling.
438 * </p>
439 * @see GLContext#hasFullFBOSupport()
440 */
441 public boolean hasFullFBOSupport();
442
443 /**
444 * Returns the maximum number of FBO RENDERBUFFER samples
445 * if {@link #hasFullFBOSupport() full FBO is supported}, otherwise false.
446 * @see GLContext#getMaxRenderbufferSamples()
447 */
449
450 /**
451 * Returns true if the GL context supports non power of two (NPOT) textures,
452 * otherwise false.
453 * <p>
454 * NPOT textures are supported in OpenGL >= 3, GLES2 or if the
455 * 'GL_ARB_texture_non_power_of_two' extension is available.
456 * </p>
457 */
458 public boolean isNPOTTextureAvailable();
459
461
462 /**
463 * Set the swap interval of the current context and attached <i>onscreen {@link GLDrawable}</i>.
464 * <p>
465 * <i>offscreen {@link GLDrawable}</i> are ignored and {@code false} is returned.
466 * </p>
467 * <p>
468 * The {@code interval} semantics:
469 * <ul>
470 * <li><i>0</i> disables the vertical synchronization</li>
471 * <li><i>&ge;1</i> is the number of vertical refreshes before a swap buffer occurs</li>
472 * <li><i>&lt;0</i> enables <i>late swaps to occur without synchronization to the video frame</i>, a.k.a <i>EXT_swap_control_tear</i>.
473 * If supported, the absolute value is the minimum number of
474 * video frames between buffer swaps. If not supported, the absolute value is being used, see above.
475 * </li>
476 * </ul>
477 * </p>
478 * @param interval see above
479 * @return true if the operation was successful, otherwise false
480 * @throws GLException if the context is not current.
481 * @see GLContext#setSwapInterval(int)
482 * @see #getSwapInterval()
483 */
484 public void setSwapInterval(int interval) throws GLException;
485
486 /**
487 * Return the current swap interval.
488 * <p>
489 * If the context has not been made current at all,
490 * the default value {@code 0} is returned.
491 * </p>
492 * <p>
493 * For a valid context w/ an <o>onscreen {@link GLDrawable}</i> the default value is {@code 1},
494 * otherwise the default value is {@code 0}.
495 * </p>
496 * @see GLContext#getSwapInterval()
497 * @see #setSwapInterval(int)
498 */
499 public int getSwapInterval();
500
501 /**
502 * Returns an object through which platform-specific OpenGL extensions
503 * (EGL, GLX, WGL, etc.) may be accessed. The data type of the returned
504 * object and its associated capabilities are undefined. Most
505 * applications will never need to call this method. It is highly
506 * recommended that any applications which do call this method perform
507 * all accesses on the returned object reflectively to guard
508 * themselves against changes to the implementation.
509 */
510 public Object getPlatformGLExtensions();
511
512 /**
513 * Returns an object providing access to the specified OpenGL
514 * extension. This is intended to provide a mechanism for vendors who
515 * wish to provide access to new OpenGL extensions without changing
516 * the public API of the core package. For example, a user may request
517 * access to extension "GL_VENDOR_foo" and receive back an object
518 * which implements a vendor-specified interface which can call the
519 * OpenGL extension functions corresponding to that extension. It is
520 * up to the vendor to specify both the extension name and Java API
521 * for accessing it, including which class or interface contains the
522 * functions.
523 *
524 * <p>
525 * Note: it is the intent to add new extensions as quickly as possible
526 * to the core GL API. Therefore it is unlikely that most vendors will
527 * use this extension mechanism, but it is being provided for
528 * completeness.
529 * </p>
530 */
531 public Object getExtension(String extensionName);
532
533 /** Aliased entrypoint of <code> void {@native glClearDepth}(GLclampd depth); </code> and <code> void {@native glClearDepthf}(GLclampf depth); </code>. */
534 public void glClearDepth( double depth );
535
536 /** Aliased entrypoint of <code> void {@native glDepthRange}(GLclampd depth); </code> and <code> void {@native glDepthRangef}(GLclampf depth); </code>. */
537 public void glDepthRange(double zNear, double zFar);
538
539 /**
540 * @param target a GL buffer (VBO) target as used in {@link GL#glBindBuffer(int, int)}, ie {@link GL#GL_ELEMENT_ARRAY_BUFFER}, {@link GL#GL_ARRAY_BUFFER}, ..
541 * @return the GL buffer name bound to a target via {@link GL#glBindBuffer(int, int)} or 0 if unbound.
542 * @see #getBufferStorage(int)
543 */
544 public int getBoundBuffer(int target);
545
546 /**
547 * @param bufferName a GL buffer name, generated with e.g. {@link GL#glGenBuffers(int, int[], int)} and used in {@link GL#glBindBuffer(int, int)}, {@link GL#glBufferData(int, long, java.nio.Buffer, int)} or {@link GL2#glNamedBufferDataEXT(int, long, java.nio.Buffer, int)}.
548 * @return the size of the given GL buffer storage, see {@link GLBufferStorage}
549 * @see #getBoundBuffer(int)
550 */
551 public GLBufferStorage getBufferStorage(int bufferName);
552
553 /**
554 * Returns the {@link GLBufferStorage} instance as mapped via OpenGL's native {@link GL#glMapBuffer(int, int) glMapBuffer(..)} implementation.
555 * <p>
556 * Throws a {@link GLException} if GL-function constraints are not met.
557 * </p>
558 * <p>
559 * {@link GL#glMapBuffer(int, int)} wrapper calls this method and returns {@link GLBufferStorage#getMappedBuffer()}.
560 * </p>
561 * <p>
562 * A zero {@link GLBufferStorage#getSize()} will avoid a native call and returns the unmapped {@link GLBufferStorage}.
563 * </p>
564 * <p>
565 * A null native mapping result indicating an error will
566 * not cause a GLException but returns the unmapped {@link GLBufferStorage}.
567 * This allows the user to handle this case.
568 * </p>
569 * @param target denotes the buffer via it's bound target
570 * @param access the mapping access mode
571 * @throws GLException if buffer is not bound to target
572 * @throws GLException if buffer is not tracked
573 * @throws GLException if buffer is already mapped
574 * @throws GLException if buffer has invalid store size, i.e. less-than zero
575 */
576 public GLBufferStorage mapBuffer(int target, int access) throws GLException;
577
578 /**
579 * Returns the {@link GLBufferStorage} instance as mapped via OpenGL's native {@link GL#glMapBufferRange(int, long, long, int) glMapBufferRange(..)} implementation.
580 * <p>
581 * Throws a {@link GLException} if GL-function constraints are not met.
582 * </p>
583 * <p>
584 * {@link GL#glMapBufferRange(int, long, long, int)} wrapper calls this method and returns {@link GLBufferStorage#getMappedBuffer()}.
585 * </p>
586 * <p>
587 * A zero {@link GLBufferStorage#getSize()} will avoid a native call and returns the unmapped {@link GLBufferStorage}.
588 * </p>
589 * <p>
590 * A null native mapping result indicating an error will
591 * not cause a GLException but returns the unmapped {@link GLBufferStorage}.
592 * This allows the user to handle this case.
593 * </p>
594 * @param target denotes the buffer via it's bound target
595 * @param offset offset of the mapped buffer's storage
596 * @param length length of the mapped buffer's storage
597 * @param access the mapping access mode
598 * @throws GLException if buffer is not bound to target
599 * @throws GLException if buffer is not tracked
600 * @throws GLException if buffer is already mapped
601 * @throws GLException if buffer has invalid store size, i.e. less-than zero
602 * @throws GLException if buffer mapping range does not fit, incl. offset
603 */
604 public GLBufferStorage mapBufferRange(final int target, final long offset, final long length, final int access) throws GLException;
605
606 /**
607 * @return true if a VBO is bound to {@link GL#GL_ARRAY_BUFFER} via {@link GL#glBindBuffer(int, int)}, otherwise false
608 */
609 public boolean isVBOArrayBound();
610
611 /**
612 * @return true if a VBO is bound to {@link GL#GL_ELEMENT_ARRAY_BUFFER} via {@link GL#glBindBuffer(int, int)}, otherwise false
613 */
614 public boolean isVBOElementArrayBound();
615
616 /**
617 * Return the framebuffer name bound to this context,
618 * see {@link GL#glBindFramebuffer(int, int)}.
619 * <p>
620 * Calls {@link GLContext#getBoundFramebuffer(int)}.
621 * </p>
622 */
623 public int getBoundFramebuffer(int target);
624
625 /**
626 * Return the default draw framebuffer name.
627 * <p>
628 * May differ from it's default <code>zero</code>
629 * in case an framebuffer object ({@link com.jogamp.opengl.FBObject}) based drawable
630 * is being used.
631 * </p>
632 * <p>
633 * Calls {@link GLContext#getDefaultDrawFramebuffer()}.
634 * </p>
635 */
637
638 /**
639 * Return the default read framebuffer name.
640 * <p>
641 * May differ from it's default <code>zero</code>
642 * in case an framebuffer object ({@link com.jogamp.opengl.FBObject}) based drawable
643 * is being used.
644 * </p>
645 * <p>
646 * Calls {@link GLContext#getDefaultReadFramebuffer()}.
647 * </p>
648 */
650
651 /**
652 * Returns the default color buffer within the current bound
653 * {@link #getDefaultReadFramebuffer()}, i.e. GL_READ_FRAMEBUFFER​,
654 * which will be used as the target (output) for (fragment shader) draw commands,
655 * settable via {@link GL2ES2#glDrawBuffers(int, int[], int)} or {@link GL2#glDrawBuffer(int)}.
656 * <p>
657 * For offscreen framebuffer objects this is {@link GL#GL_COLOR_ATTACHMENT0},
658 * otherwise this is {@link GL#GL_FRONT} for non-ES profile and single buffer configurations
659 * and {@link GL#GL_BACK} for double buffer configurations or ES profiles.
660 * </p>
661 * <p>
662 * Note-1: Neither ES1 nor ES2 supports selecting the draw buffer at all
663 * and {@link GL#GL_BACK} is the default.
664 * </p>
665 * <p>
666 * Note-2: ES3 only supports {@link GL#GL_BACK}, {@link GL#GL_NONE} or {@link GL#GL_COLOR_ATTACHMENT0}+i
667 * via {@link GL2ES2#glDrawBuffers(int, int[], int)}.
668 * </p>
669 * <p>
670 * Method is only thread-safe while context is {@link #makeCurrent() made current}.
671 * </p>
672 */
674
675 /**
676 * Returns the default color buffer within the current bound
677 * {@link #getDefaultReadFramebuffer()}, i.e. GL_READ_FRAMEBUFFER​,
678 * which will be used as the source for pixel reading commands,
679 * like {@link GL#glReadPixels(int, int, int, int, int, int, java.nio.Buffer) glReadPixels} etc.
680 * <p>
681 * For offscreen framebuffer objects this is {@link GL#GL_COLOR_ATTACHMENT0},
682 * otherwise this is {@link GL#GL_FRONT} for non-ES profile and single buffer configurations
683 * and {@link GL#GL_BACK} for double buffer configurations or ES profiles.
684 * </p>
685 * <p>
686 * Note-1: Neither ES1 nor ES2 supports selecting the read buffer via glReadBuffer
687 * and {@link GL#GL_BACK} is the default.
688 * </p>
689 * <p>
690 * Note-2: ES3 only supports {@link GL#GL_BACK}, {@link GL#GL_NONE} or {@link GL#GL_COLOR_ATTACHMENT0}+i
691 * </p>
692 * <p>
693 * Note-3: See {@link com.jogamp.opengl.util.GLDrawableUtil#swapBuffersBeforeRead(GLCapabilitiesImmutable) swapBuffersBeforeRead}
694 * for read-pixels and swap-buffers implications.
695 * </p>
696 * <p>
697 * Method is only thread-safe while context is {@link #makeCurrent() made current}.
698 * </p>
699 */
701}
702
OpenGL buffer storage object reflecting it's.
Abstraction for an OpenGL rendering context.
Definition: GLContext.java:74
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
Specifies the the OpenGL profile.
Definition: GLProfile.java:77
GLES1 getGLES1()
Casts this object to the GLES1 interface.
boolean isGL2GL3()
Indicates whether this GL object conforms to a GL2GL3 compatible profile.
boolean isGLES2Compatible()
Indicates whether this GL object is compatible with the core OpenGL ES2 functionality.
boolean isVBOElementArrayBound()
boolean isGL2ES1()
Indicates whether this GL object conforms to a GL2ES1 compatible profile.
GL4ES3 getGL4ES3()
Casts this object to the GL4ES3 interface.
boolean hasGLSL()
Indicates whether this GL object supports GLSL.
boolean hasBasicFBOSupport()
Returns true if basic FBO support is available, otherwise false.
GL getGL()
Casts this object to the GL interface.
boolean isTextureFormatBGRA8888Available()
boolean isGLES()
Indicates whether this GL object conforms to one of the OpenGL ES profiles, see isGLES1(),...
GL2ES1 getGL2ES1()
Casts this object to the GL2ES1 interface.
boolean isGL4bc()
Indicates whether this GL object conforms to the OpenGL ≥ 4.0 compatibility profile.
boolean isGL3ES3()
Indicates whether this GL object conforms to a GL3ES3 compatible profile.
int getMaxRenderbufferSamples()
Returns the maximum number of FBO RENDERBUFFER samples if full FBO is supported, otherwise false.
int getBoundFramebuffer(int target)
Return the framebuffer name bound to this context, see GL#glBindFramebuffer(int, int).
int getBoundBuffer(int target)
int getDefaultDrawFramebuffer()
Return the default draw framebuffer name.
boolean isGL2ES3()
Indicates whether this GL object conforms to a either a GL2GL3 or GL3ES3 compatible profile.
boolean isGLES32Compatible()
Indicates whether this GL object is compatible with the core OpenGL ES3.2 functionality.
GL2ES2 getGL2ES2()
Casts this object to the GL2ES2 interface.
GL4 getGL4()
Casts this object to the GL4 interface.
boolean isNPOTTextureAvailable()
Returns true if the GL context supports non power of two (NPOT) textures, otherwise false.
GLProfile getGLProfile()
Returns the GLProfile associated with this GL object.
GL3 getGL3()
Casts this object to the GL3 interface.
void setSwapInterval(int interval)
Set the swap interval of the current context and attached onscreen GLDrawable.
boolean isGL3()
Indicates whether this GL object conforms to the OpenGL ≥ 3.1 core profile.
void glDepthRange(double zNear, double zFar)
Aliased entrypoint of void {@native glDepthRange}(GLclampd depth); and void {@native glDepthRangef...
boolean isGL2()
Indicates whether this GL object conforms to the OpenGL ≤ 3.0 profile.
boolean isGL2ES2()
Indicates whether this GL object conforms to a GL2ES2 compatible profile.
GLBufferStorage mapBufferRange(final int target, final long offset, final long length, final int access)
Returns the GLBufferStorage instance as mapped via OpenGL's native glMapBufferRange(....
GL3bc getGL3bc()
Casts this object to the GL3bc interface.
boolean isExtensionAvailable(String glExtensionName)
Returns true if the specified OpenGL extension can be used successfully through this GL instance give...
boolean isGLES1()
Indicates whether this GL object conforms to the OpenGL ES ≥ 1.0 profile.
GLContext getContext()
Returns the GLContext associated which this GL object.
GLBufferStorage getBufferStorage(int bufferName)
boolean isFunctionAvailable(String glFunctionName)
Returns true if the specified OpenGL core- or extension-function can be used successfully through thi...
boolean isGLcore()
Indicates whether this GL object uses a GL core profile.
boolean isGL4core()
Indicates whether this GL object uses a GL4 core profile.
void glClearDepth(double depth)
Aliased entrypoint of void {@native glClearDepth}(GLclampd depth); and void {@native glClearDepthf...
GLES2 getGLES2()
Casts this object to the GLES2 interface.
boolean isGLES3()
Indicates whether this GL object conforms to the OpenGL ES ≥ 3.0 profile.
GL2ES3 getGL2ES3()
Casts this object to the GL2ES3 interface.
boolean isGL4ES3()
Returns true if this GL object conforms to a GL4ES3 compatible profile, i.e.
GL2 getGL2()
Casts this object to the GL2 interface.
boolean isGL3core()
Indicates whether this GL object uses a GL3 core profile.
int getDefaultDrawBuffer()
Returns the default color buffer within the current bound getDefaultReadFramebuffer(),...
int getDefaultReadBuffer()
Returns the default color buffer within the current bound getDefaultReadFramebuffer(),...
GL getRootGL()
Returns the implementing root instance, considering a wrapped pipelined hierarchy,...
GLBufferStorage mapBuffer(int target, int access)
Returns the GLBufferStorage instance as mapped via OpenGL's native glMapBuffer(..) implementation.
Object getExtension(String extensionName)
Returns an object providing access to the specified OpenGL extension.
GLES3 getGLES3()
Casts this object to the GLES3 interface.
int getSwapInterval()
Return the current swap interval.
GL3ES3 getGL3ES3()
Casts this object to the GL3ES3 interface.
GL4bc getGL4bc()
Casts this object to the GL4bc interface.
boolean isGL3bc()
Indicates whether this GL object conforms to the OpenGL ≥ 3.1 compatibility profile.
boolean isGLES31Compatible()
Indicates whether this GL object is compatible with the core OpenGL ES3.1 functionality.
boolean isGL4()
Indicates whether this GL object conforms to the OpenGL ≥ 4.0 core profile.
boolean isGLES3Compatible()
Indicates whether this GL object is compatible with the core OpenGL ES3 functionality.
boolean isGL()
Indicates whether this GL object conforms to any of the OpenGL profiles.
GL2GL3 getGL2GL3()
Casts this object to the GL2GL3 interface.
boolean hasFullFBOSupport()
Returns true if full FBO support is available, otherwise false.
GL getDownstreamGL()
Returns the downstream GL instance in case this is a wrapping pipeline, otherwise null.
Object getPlatformGLExtensions()
Returns an object through which platform-specific OpenGL extensions (EGL, GLX, WGL,...
int getDefaultReadFramebuffer()
Return the default read framebuffer name.
boolean isGLES2()
Indicates whether this GL object conforms to the OpenGL ES ≥ 2.0 profile.