JOGL v2.6.0-rc-20250712
JOGL, High-Performance Graphics Binding for Java™ (public API).
ExclusiveContextBase00NEWT.java
Go to the documentation of this file.
1/**
2 * Copyright 2013 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.ect;
30
31import com.jogamp.newt.Display;
32import com.jogamp.newt.NewtFactory;
33import com.jogamp.newt.Screen;
34import com.jogamp.newt.opengl.GLWindow;
35
36import com.jogamp.opengl.GLAutoDrawable;
37import com.jogamp.opengl.GLCapabilitiesImmutable;
38
39import org.junit.Assert;
40import org.junit.BeforeClass;
41import org.junit.AfterClass;
42import org.junit.FixMethodOrder;
43import org.junit.runners.MethodSorters;
44
45/**
46 * ExclusiveContextThread base implementation to test correctness of the ExclusiveContext feature _and_ AnimatorBase with NEWT.
47 */
48@FixMethodOrder(MethodSorters.NAME_ASCENDING)
50
51 static Display dpy;
52 static Screen screen;
53
54 @BeforeClass
55 public static void initClass00NEWT() {
56 dpy = NewtFactory.createDisplay(null);
57 screen = NewtFactory.createScreen(dpy, 0);
58 }
59
60 @AfterClass
61 public static void releaseClass00NEWT() {
62 screen = null;
63 dpy = null;
64 }
65
66 @Override
67 protected boolean isAWTTestCase() { return false; }
68
69 @Override
70 protected Thread getAWTRenderThread() {
71 return null;
72 }
73
74 @Override
75 protected GLAutoDrawable createGLAutoDrawable(final String title, final int x, final int y, final int width, final int height, final GLCapabilitiesImmutable caps) {
76 final GLWindow glWindow = GLWindow.create(screen, caps);
77 Assert.assertNotNull(glWindow);
78 glWindow.setTitle(title);
79 glWindow.setSize(width, height);
80 glWindow.setPosition(x, y);
81 return glWindow;
82 }
83
84 @Override
85 protected void setGLAutoDrawableVisible(final GLAutoDrawable[] glads) {
86 final int count = glads.length;
87 for(int i=0; i<count; i++) {
88 final GLAutoDrawable glad = glads[i];
89 ((GLWindow)glad).setVisible(true);
90 }
91 }
92
93 @Override
94 protected void destroyGLAutoDrawableVisible(final GLAutoDrawable glad) {
95 ((GLWindow)glad).destroy();
96 }
97}
static Display createDisplay(final String name)
Create a Display entity.
static Screen createScreen(final Display display, final int index)
Create a Screen entity.
A screen may span multiple MonitorDevices representing their combined virtual size.
Definition: Screen.java:58
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
Definition: GLWindow.java:121
final void setPosition(final int x, final int y)
Sets the location of the window's client area excluding insets (window decorations) in window units.
Definition: GLWindow.java:525
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
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
ExclusiveContextThread base implementation to test correctness of the ExclusiveContext feature and An...
GLAutoDrawable createGLAutoDrawable(final String title, final int x, final int y, final int width, final int height, final GLCapabilitiesImmutable caps)
ExclusiveContextThread base implementation to test correctness of the ExclusiveContext feature and An...
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
Specifies an immutable set of OpenGL capabilities.