JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
TestGLProfile03NEWTOffscreen.java
Go to the documentation of this file.
1/**
2 * Copyright 2010 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 */
28
29package com.jogamp.opengl.test.junit.jogl.acore;
30
31import java.io.IOException;
32
33import com.jogamp.opengl.GLCapabilities;
34import com.jogamp.opengl.GLCapabilitiesImmutable;
35import com.jogamp.opengl.GLProfile;
36
37import org.junit.FixMethodOrder;
38import org.junit.Test;
39import org.junit.runners.MethodSorters;
40
41@FixMethodOrder(MethodSorters.NAME_ASCENDING)
43
44 @Test
45 public void test01GLProfileDefaultFBO() throws InterruptedException {
46 System.out.println("GLProfile "+GLProfile.glAvailabilityToString());
47 System.out.println("GLProfile.getDefaultDevice(): "+GLProfile.getDefaultDevice());
48 final GLProfile glp = GLProfile.getDefault();
49 System.out.println("GLProfile.getDefault(): "+glp);
50 final GLCapabilities caps = new GLCapabilities(glp);
51 caps.setFBO(true);
52 validateOnlineOffscreen("default", caps);
53 }
54 @Test
55 public void test02GLProfileDefaultPBuffer() throws InterruptedException {
56 System.out.println("GLProfile "+GLProfile.glAvailabilityToString());
57 System.out.println("GLProfile.getDefaultDevice(): "+GLProfile.getDefaultDevice());
58 final GLProfile glp = GLProfile.getDefault();
59 System.out.println("GLProfile.getDefault(): "+glp);
60 final GLCapabilities caps = new GLCapabilities(glp);
61 caps.setPBuffer(true);
62 validateOnlineOffscreen("default", caps);
63 }
64 @Test
65 public void test03GLProfileDefaultBitmap() throws InterruptedException {
66 System.out.println("GLProfile "+GLProfile.glAvailabilityToString());
67 System.out.println("GLProfile.getDefaultDevice(): "+GLProfile.getDefaultDevice());
68 final GLProfile glp = GLProfile.getDefault();
69 System.out.println("GLProfile.getDefault(): "+glp);
70 final GLCapabilities caps = new GLCapabilities(glp);
71 caps.setBitmap(true);
72 validateOnlineOffscreen("default", caps);
73 }
74
75 @Test
76 public void test11GLProfileMaxProgrammableFBO() throws InterruptedException {
77 // Assuming at least one programmable profile is available
78 final GLProfile glp = GLProfile.getMaxProgrammable(true);
79 System.out.println("GLProfile.getMaxProgrammable(): "+glp);
80 final GLCapabilities caps = new GLCapabilities(glp);
81 caps.setFBO(true);
82 validateOnlineOffscreen("maxProgrammable", caps);
83 }
84 @Test
85 public void test12GLProfileMaxProgrammablePBuffer() throws InterruptedException {
86 // Assuming at least one programmable profile is available
87 final GLProfile glp = GLProfile.getMaxProgrammable(true);
88 System.out.println("GLProfile.getMaxProgrammable(): "+glp);
89 final GLCapabilities caps = new GLCapabilities(glp);
90 caps.setPBuffer(true);
91 validateOnlineOffscreen("maxProgrammable", caps);
92 }
93 // @Test // might not be available
94 public void test13GLProfileMaxProgrammableBitmap() throws InterruptedException {
95 // Assuming at least one programmable profile is available
96 final GLProfile glp = GLProfile.getMaxProgrammable(true);
97 System.out.println("GLProfile.getMaxProgrammable(): "+glp);
98 final GLCapabilities caps = new GLCapabilities(glp);
99 caps.setBitmap(true);
100 validateOnlineOffscreen("maxProgrammable", caps);
101 }
102
103 @Test
104 public void test21GLProfileMaxFixedFuncFBO() throws InterruptedException {
105 // Assuming at least one fixed function profile is available
106 final GLProfile glp = GLProfile.getMaxFixedFunc(true);
107 System.out.println("GLProfile.getMaxFixedFunc(): "+glp);
108 final GLCapabilities caps = new GLCapabilities(glp);
109 caps.setFBO(true);
110 validateOnlineOffscreen("maxFixedFunc", caps);
111 }
112 @Test
113 public void test22GLProfileMaxFixedFuncPBuffer() throws InterruptedException {
114 // Assuming at least one fixed function profile is available
115 final GLProfile glp = GLProfile.getMaxFixedFunc(true);
116 System.out.println("GLProfile.getMaxFixedFunc(): "+glp);
117 final GLCapabilities caps = new GLCapabilities(glp);
118 caps.setPBuffer(true);
119 validateOnlineOffscreen("maxFixedFunc", caps);
120 }
121 @Test
122 public void test23GLProfileMaxFixedFuncBitmap() throws InterruptedException {
123 // Assuming at least one fixed function profile is available
124 final GLProfile glp = GLProfile.getMaxFixedFunc(true);
125 System.out.println("GLProfile.getMaxFixedFunc(): "+glp);
126 final GLCapabilities caps = new GLCapabilities(glp);
127 caps.setBitmap(true);
128 validateOnlineOffscreen("maxFixedFunc", caps);
129 }
130
131 @Test
132 public void test31GLProfileGL2ES1() throws InterruptedException {
134 System.out.println("GLProfile GL2ES1 n/a");
135 return;
136 }
137 final GLProfile glp = GLProfile.getGL2ES1();
138 final GLCapabilitiesImmutable caps = new GLCapabilities(glp);
139 validateOnlineOffscreen(GLProfile.GL2ES1, caps);
140 }
141
142 @Test
143 public void test32GLProfileGL2ES2() throws InterruptedException {
145 System.out.println("GLProfile GL2ES2 n/a");
146 return;
147 }
148 final GLProfile glp = GLProfile.getGL2ES2();
149 final GLCapabilitiesImmutable caps = new GLCapabilities(glp);
150 validateOnlineOffscreen(GLProfile.GL2ES2, caps);
151 }
152
153 @Test
154 public void test33GLProfileGL4ES3() throws InterruptedException {
156 System.out.println("GLProfile GL4ES3 n/a");
157 return;
158 }
159 final GLProfile glp = GLProfile.getGL4ES3();
160 final GLCapabilitiesImmutable caps = new GLCapabilities(glp);
161 validateOnlineOffscreen(GLProfile.GL4ES3, caps);
162 }
163
164 @Test
165 public void test34GLProfileGL2GL3() throws InterruptedException {
167 System.out.println("GLProfile GL2GL3 n/a");
168 return;
169 }
170 final GLProfile glp = GLProfile.getGL2GL3();
171 final GLCapabilitiesImmutable caps = new GLCapabilities(glp);
172 validateOnlineOffscreen(GLProfile.GL2GL3, caps);
173 }
174
175 void testSpecificProfile(final String glps) throws InterruptedException {
176 if(GLProfile.isAvailable(glps)) {
177 final GLProfile glp = GLProfile.get(glps);
178 final GLCapabilitiesImmutable caps = new GLCapabilities(glp);
179 validateOnlineOffscreen(glps, caps);
180 } else {
181 System.err.println("Profile "+glps+" n/a");
182 }
183 }
184
185 @Test
186 public void test41_GL4bc() throws InterruptedException {
187 testSpecificProfile(GLProfile.GL4bc);
188 }
189
190 @Test
191 public void test42_GL3bc() throws InterruptedException {
192 testSpecificProfile(GLProfile.GL3bc);
193 }
194
195 @Test
196 public void test43_GL2() throws InterruptedException {
197 testSpecificProfile(GLProfile.GL2);
198 }
199
200 @Test
201 public void test44_GL4() throws InterruptedException {
202 testSpecificProfile(GLProfile.GL4);
203 }
204
205 @Test
206 public void test45_GL3() throws InterruptedException {
207 testSpecificProfile(GLProfile.GL3);
208 }
209
210 @Test
211 public void test46_GLES1() throws InterruptedException {
212 testSpecificProfile(GLProfile.GLES1);
213 }
214
215 @Test
216 public void test47_GLES2() throws InterruptedException {
217 testSpecificProfile(GLProfile.GLES2);
218 }
219
220 @Test
221 public void test48_GLES3() throws InterruptedException {
222 testSpecificProfile(GLProfile.GLES3);
223 }
224
225 public static void main(final String args[]) throws IOException {
226 final String tstname = TestGLProfile03NEWTOffscreen.class.getName();
227 org.junit.runner.JUnitCore.main(tstname);
228 }
229
230}
void setBitmap(final boolean enable)
Requesting offscreen bitmap mode.
Specifies a set of OpenGL capabilities.
void setPBuffer(final boolean enable)
Requesting offscreen pbuffer mode.
void setFBO(final boolean enable)
Requesting offscreen FBO mode.
Specifies the the OpenGL profile.
Definition: GLProfile.java:77
static boolean isAvailable(final AbstractGraphicsDevice device, final String profile)
Returns the availability of a profile on a device.
Definition: GLProfile.java:305
static final String GLES3
The embedded OpenGL profile ES 3.x, with x >= 0.
Definition: GLProfile.java:588
static GLProfile getMaxFixedFunc(final AbstractGraphicsDevice device, final boolean favorHardwareRasterizer)
Returns the highest profile, implementing the fixed function pipeline.
Definition: GLProfile.java:808
static final String GL2ES2
The intersection of the desktop GL3, GL2 and embedded ES2 profile.
Definition: GLProfile.java:594
static GLProfile getGL2GL3(final AbstractGraphicsDevice device)
Returns the GL2GL3 profile implementation, hence compatible w/ GL2GL3.
Definition: GLProfile.java:973
static final String GL3
The desktop OpenGL core profile 3.x, with x >= 1.
Definition: GLProfile.java:576
static final String GLES2
The embedded OpenGL profile ES 2.x, with x >= 0.
Definition: GLProfile.java:585
static GLProfile getMaxProgrammable(final AbstractGraphicsDevice device, final boolean favorHardwareRasterizer)
Returns the highest profile, implementing the programmable shader pipeline.
Definition: GLProfile.java:831
static String glAvailabilityToString(final AbstractGraphicsDevice device)
Definition: GLProfile.java:333
static final String GL4bc
The desktop OpenGL compatibility profile 4.x, with x >= 0, ie GL2 plus GL4.
Definition: GLProfile.java:566
static final String GL2GL3
The intersection of the desktop GL3 and GL2 profile.
Definition: GLProfile.java:597
static GLProfile getDefault(final AbstractGraphicsDevice device)
Returns a default GLProfile object, reflecting the best for the running platform.
Definition: GLProfile.java:739
static AbstractGraphicsDevice getDefaultDevice()
static GLProfile getGL2ES1(final AbstractGraphicsDevice device)
Returns the GL2ES1 profile implementation, hence compatible w/ GL2ES1.
Definition: GLProfile.java:883
static GLProfile getGL4ES3(final AbstractGraphicsDevice device)
Returns the GL4ES3 profile implementation, hence compatible w/ GL4ES3.
Definition: GLProfile.java:943
static GLProfile get(final AbstractGraphicsDevice device, String profile)
Returns a GLProfile object.
static final String GL3bc
The desktop OpenGL compatibility profile 3.x, with x >= 1, ie GL2 plus GL3.
Definition: GLProfile.java:573
static final String GL2
The desktop OpenGL profile 1.x up to 3.0.
Definition: GLProfile.java:579
static GLProfile getGL2ES2(final AbstractGraphicsDevice device)
Returns the GL2ES2 profile implementation, hence compatible w/ GL2ES2.
Definition: GLProfile.java:913
static final String GLES1
The embedded OpenGL profile ES 1.x, with x >= 0.
Definition: GLProfile.java:582
static final String GL4ES3
The intersection of the desktop GL4 and ES3 profile, available only if either ES3 or GL4 w/ GL_ARB_ES...
Definition: GLProfile.java:600
static final String GL4
The desktop OpenGL core profile 4.x, with x >= 0.
Definition: GLProfile.java:569
static final String GL2ES1
The intersection of the desktop GL2 and embedded ES1 profile.
Definition: GLProfile.java:591
Specifies an immutable set of OpenGL capabilities.