JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java™ (public API).
TestGLProfile01NEWT.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.GLDrawableFactory;
34import com.jogamp.opengl.GLProfile;
35
36import org.junit.FixMethodOrder;
37import org.junit.Test;
38import org.junit.runners.MethodSorters;
39
40import com.jogamp.common.GlueGenVersion;
41import com.jogamp.common.util.VersionUtil;
42import com.jogamp.nativewindow.NativeWindowVersion;
43import com.jogamp.newt.NewtVersion;
44import com.jogamp.opengl.JoglVersion;
45
46@FixMethodOrder(MethodSorters.NAME_ASCENDING)
48
49 @Test
50 public void test00Version() throws InterruptedException {
51 System.err.println(VersionUtil.getPlatformInfo());
52 System.err.println(GlueGenVersion.getInstance());
53 System.err.println(NativeWindowVersion.getInstance());
54 System.err.println(JoglVersion.getInstance());
55 System.err.println(NewtVersion.getInstance());
56
57 final GLDrawableFactory deskFactory = GLDrawableFactory.getFactory(false);
58 if( null != deskFactory ) {
59 System.err.println(JoglVersion.getDefaultOpenGLInfo(deskFactory.getDefaultDevice(), null, true).toString());
60 }
61 final GLDrawableFactory eglFactory = GLDrawableFactory.getFactory(true);
62 if( null != eglFactory ) {
63 System.err.println(JoglVersion.getDefaultOpenGLInfo(eglFactory.getDefaultDevice(), null, true).toString());
64 }
65 }
66
67 @Test
68 public void test01GLProfileDefault() throws InterruptedException {
69 System.out.println("GLProfile "+GLProfile.glAvailabilityToString());
70 System.out.println("GLProfile.getDefaultDevice(): "+GLProfile.getDefaultDevice());
71 final GLProfile glp = GLProfile.getDefault();
72 System.out.println("GLProfile.getDefault(): "+glp);
73 validateOffline("default", glp);
74 validateOnlineOnscreen("default", glp);
75 }
76
77 @Test
78 public void test11GLProfileMaxProgrammable() throws InterruptedException {
79 // Assuming at least one programmable profile is available
80 final GLProfile glp = GLProfile.getMaxProgrammable(true);
81 System.out.println("GLProfile.getMaxProgrammable(): "+glp);
82 validateOffline("maxProgrammable", glp);
83 validateOnlineOnscreen("maxProgrammable", glp);
84 }
85
86 @Test
87 public void test22GLProfileMaxFixedFunc() throws InterruptedException {
88 // Assuming at least one fixed function profile is available
89 final GLProfile glp = GLProfile.getMaxFixedFunc(true);
90 System.out.println("GLProfile.getMaxFixedFunc(): "+glp);
91 validateOffline("maxFixedFunc", glp);
92 validateOnlineOnscreen("maxFixedFunc", glp);
93 }
94
95 @Test
96 public void test31GLProfileGL2ES1() throws InterruptedException {
98 System.out.println("GLProfile GL2ES1 n/a");
99 return;
100 }
101 final GLProfile glp = GLProfile.getGL2ES1();
102 validateOffline(GLProfile.GL2ES1, glp);
103 validateOnlineOnscreen(GLProfile.GL2ES1, glp);
104 }
105
106 @Test
107 public void test32GLProfileGL2ES2() throws InterruptedException {
109 System.out.println("GLProfile GL2ES2 n/a");
110 return;
111 }
112 final GLProfile glp = GLProfile.getGL2ES2();
113 validateOffline(GLProfile.GL2ES2, glp);
114 validateOnlineOnscreen(GLProfile.GL2ES2, glp);
115 }
116
117 @Test
118 public void test33GLProfileGL4ES3() throws InterruptedException {
120 System.out.println("GLProfile GL4ES3 n/a");
121 return;
122 }
123 final GLProfile glp = GLProfile.getGL4ES3();
124 validateOffline(GLProfile.GL4ES3, glp);
125 validateOnlineOnscreen(GLProfile.GL4ES3, glp);
126 }
127
128 @Test
129 public void test34GLProfileGL2GL3() throws InterruptedException {
131 System.out.println("GLProfile GL2GL3 n/a");
132 return;
133 }
134 final GLProfile glp = GLProfile.getGL2GL3();
135 validateOffline(GLProfile.GL2GL3, glp);
136 validateOnlineOnscreen(GLProfile.GL2GL3, glp);
137 }
138
139 void testSpecificProfile(final String glps) throws InterruptedException {
140 if(GLProfile.isAvailable(glps)) {
141 final GLProfile glp = GLProfile.get(glps);
142 validateOffline(glps, glp);
143 validateOnlineOnscreen(glps, glp);
144 } else {
145 System.err.println("Profile "+glps+" n/a");
146 }
147 }
148
149 @Test
150 public void test41_GL4bc() throws InterruptedException {
151 testSpecificProfile(GLProfile.GL4bc);
152 }
153
154 @Test
155 public void test42_GL3bc() throws InterruptedException {
156 testSpecificProfile(GLProfile.GL3bc);
157 }
158
159 @Test
160 public void test43_GL2() throws InterruptedException {
161 testSpecificProfile(GLProfile.GL2);
162 }
163
164 @Test
165 public void test44_GL4() throws InterruptedException {
166 testSpecificProfile(GLProfile.GL4);
167 }
168
169 @Test
170 public void test45_GL3() throws InterruptedException {
171 testSpecificProfile(GLProfile.GL3);
172 }
173
174 @Test
175 public void test46_GLES1() throws InterruptedException {
176 testSpecificProfile(GLProfile.GLES1);
177 }
178
179 @Test
180 public void test47_GLES2() throws InterruptedException {
181 testSpecificProfile(GLProfile.GLES2);
182 }
183
184 @Test
185 public void test48_GLES3() throws InterruptedException {
186 testSpecificProfile(GLProfile.GLES3);
187 }
188
189 public static void main(final String args[]) throws IOException {
190 final String tstname = TestGLProfile01NEWT.class.getName();
191 org.junit.runner.JUnitCore.main(tstname);
192 }
193
194}
static NewtVersion getInstance()
abstract AbstractGraphicsDevice getDefaultDevice()
Retrieve the default device connection, unit ID and unique ID name.
static GLDrawableFactory getFactory(final GLProfile glProfile)
Returns the sole GLDrawableFactory instance.
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
static JoglVersion getInstance()
static StringBuilder getDefaultOpenGLInfo(AbstractGraphicsDevice device, StringBuilder sb, final boolean withCapabilitiesInfo)