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 
29 package com.jogamp.opengl.test.junit.jogl.acore;
30 
31 import java.io.IOException;
32 
33 import com.jogamp.opengl.GLCapabilities;
34 import com.jogamp.opengl.GLCapabilitiesImmutable;
35 import com.jogamp.opengl.GLProfile;
36 
37 import org.junit.FixMethodOrder;
38 import org.junit.Test;
39 import org.junit.runners.MethodSorters;
40 
41 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
42 public class TestGLProfile03NEWTOffscreen extends GLProfile0XBase {
43 
44     @Test
test01GLProfileDefault()45     public void test01GLProfileDefault() 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 GLCapabilitiesImmutable caps = new GLCapabilities(glp);
51         validateOnlineOffscreen("default", caps);
52     }
53 
54     @Test
test02GLProfileDefaultBitmap()55     public void test02GLProfileDefaultBitmap() 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.setBitmap(true);
62         validateOnlineOffscreen("default", caps);
63     }
64 
65     @Test
test02GLProfileMaxProgrammable()66     public void test02GLProfileMaxProgrammable() throws InterruptedException {
67         // Assuming at least one programmable profile is available
68         final GLProfile glp = GLProfile.getMaxProgrammable(true);
69         System.out.println("GLProfile.getMaxProgrammable(): "+glp);
70         final GLCapabilitiesImmutable caps = new GLCapabilities(glp);
71         validateOnlineOffscreen("maxProgrammable", caps);
72     }
73 
74     @Test
test03GLProfileMaxFixedFunc()75     public void test03GLProfileMaxFixedFunc() throws InterruptedException {
76         // Assuming at least one fixed function profile is available
77         final GLProfile glp = GLProfile.getMaxFixedFunc(true);
78         System.out.println("GLProfile.getMaxFixedFunc(): "+glp);
79         final GLCapabilitiesImmutable caps = new GLCapabilities(glp);
80         validateOnlineOffscreen("maxFixedFunc", caps);
81     }
82 
83     @Test
test04GLProfileGL2ES1()84     public void test04GLProfileGL2ES1() throws InterruptedException {
85         if(!GLProfile.isAvailable(GLProfile.GL2ES1)) {
86             System.out.println("GLProfile GL2ES1 n/a");
87             return;
88         }
89         final GLProfile glp = GLProfile.getGL2ES1();
90         final GLCapabilitiesImmutable caps = new GLCapabilities(glp);
91         validateOnlineOffscreen(GLProfile.GL2ES1, caps);
92     }
93 
94     @Test
test05GLProfileGL2ES2()95     public void test05GLProfileGL2ES2() throws InterruptedException {
96         if(!GLProfile.isAvailable(GLProfile.GL2ES2)) {
97             System.out.println("GLProfile GL2ES2 n/a");
98             return;
99         }
100         final GLProfile glp = GLProfile.getGL2ES2();
101         final GLCapabilitiesImmutable caps = new GLCapabilities(glp);
102         validateOnlineOffscreen(GLProfile.GL2ES2, caps);
103     }
104 
105     @Test
test06GLProfileGL4ES3()106     public void test06GLProfileGL4ES3() throws InterruptedException {
107         if(!GLProfile.isAvailable(GLProfile.GL4ES3)) {
108             System.out.println("GLProfile GL4ES3 n/a");
109             return;
110         }
111         final GLProfile glp = GLProfile.getGL4ES3();
112         final GLCapabilitiesImmutable caps = new GLCapabilities(glp);
113         validateOnlineOffscreen(GLProfile.GL4ES3, caps);
114     }
115 
116     @Test
test07GLProfileGL2GL3()117     public void test07GLProfileGL2GL3() throws InterruptedException {
118         if(!GLProfile.isAvailable(GLProfile.GL2GL3)) {
119             System.out.println("GLProfile GL2GL3 n/a");
120             return;
121         }
122         final GLProfile glp = GLProfile.getGL2GL3();
123         final GLCapabilitiesImmutable caps = new GLCapabilities(glp);
124         validateOnlineOffscreen(GLProfile.GL2GL3, caps);
125     }
126 
testSpecificProfile(final String glps)127     void testSpecificProfile(final String glps) throws InterruptedException {
128         if(GLProfile.isAvailable(glps)) {
129             final GLProfile glp = GLProfile.get(glps);
130             final GLCapabilitiesImmutable caps = new GLCapabilities(glp);
131             validateOnlineOffscreen(glps, caps);
132         } else {
133             System.err.println("Profile "+glps+" n/a");
134         }
135     }
136 
137     @Test
test10_GL4bc()138     public void test10_GL4bc() throws InterruptedException {
139         testSpecificProfile(GLProfile.GL4bc);
140     }
141 
142     @Test
test11_GL3bc()143     public void test11_GL3bc() throws InterruptedException {
144         testSpecificProfile(GLProfile.GL3bc);
145     }
146 
147     @Test
test12_GL2()148     public void test12_GL2() throws InterruptedException {
149         testSpecificProfile(GLProfile.GL2);
150     }
151 
152     @Test
test13_GL4()153     public void test13_GL4() throws InterruptedException {
154         testSpecificProfile(GLProfile.GL4);
155     }
156 
157     @Test
test14_GL3()158     public void test14_GL3() throws InterruptedException {
159         testSpecificProfile(GLProfile.GL3);
160     }
161 
162     @Test
test15_GLES1()163     public void test15_GLES1() throws InterruptedException {
164         testSpecificProfile(GLProfile.GLES1);
165     }
166 
167     @Test
test16_GLES2()168     public void test16_GLES2() throws InterruptedException {
169         testSpecificProfile(GLProfile.GLES2);
170     }
171 
172     @Test
test17_GLES3()173     public void test17_GLES3() throws InterruptedException {
174         testSpecificProfile(GLProfile.GLES3);
175     }
176 
main(final String args[])177     public static void main(final String args[]) throws IOException {
178         final String tstname = TestGLProfile03NEWTOffscreen.class.getName();
179         org.junit.runner.JUnitCore.main(tstname);
180     }
181 
182 }
183