28package com.jogamp.opengl.test.junit.jogl.acore;
30import com.jogamp.opengl.GLAutoDrawable;
31import com.jogamp.opengl.GLCapabilities;
32import com.jogamp.opengl.GLContext;
33import com.jogamp.opengl.GLEventListener;
34import com.jogamp.opengl.GLProfile;
36import jogamp.opengl.GLContextImpl;
38import org.junit.Assert;
40import org.junit.FixMethodOrder;
41import org.junit.runners.MethodSorters;
43import com.jogamp.newt.opengl.GLWindow;
44import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
45import com.jogamp.opengl.test.junit.util.UITestCase;
46import com.jogamp.opengl.util.Animator;
58@FixMethodOrder(MethodSorters.NAME_ASCENDING)
62 public
void test01_Plain() {
67 public
void test01_Anim() {
71 private void test01Impl(
final boolean anim) {
77 final GLWindow window = GLWindow.create(caps);
79 final Animator animator =
new Animator(0 );
85 window.setSize(640, 480);
87 private void makeCurrentRecursive(
final GLContextImpl context,
final int lockCount) {
88 Assert.assertEquals(
true, context.isOwner(Thread.currentThread()));
89 Assert.assertEquals(lockCount, context.getLockCount());
90 Assert.assertEquals(
true, context.isCurrent());
94 Assert.assertEquals(
true, context.isOwner(Thread.currentThread()));
95 Assert.assertEquals(lockCount+1, context.getLockCount());
96 Assert.assertEquals(
true, context.isCurrent());
98 private void releaseRecursive(
final GLContextImpl context,
final int lockCount) {
99 Assert.assertEquals(
true, context.isOwner(Thread.currentThread()));
100 Assert.assertEquals(lockCount, context.getLockCount());
101 Assert.assertEquals(
true, context.isCurrent());
105 Assert.assertEquals(
true, context.isOwner(Thread.currentThread()));
106 Assert.assertEquals(lockCount-1, context.getLockCount());
107 Assert.assertEquals(
true, context.isCurrent());
111 public void reshape(
final GLAutoDrawable drawable,
final int x,
final int y,
final int width,
final int height) { }
114 public void init(
final GLAutoDrawable drawable) { }
117 public void dispose(
final GLAutoDrawable drawable) { }
120 public void display(
final GLAutoDrawable drawable) {
121 final GLContextImpl context = (GLContextImpl)drawable.getContext();
122 makeCurrentRecursive(context, 1);
123 releaseRecursive(context, 2);
126 window.addGLEventListener(
new GearsES2());
129 window.setVisible(
true);
137 public static void main(
final String args[]) {
Specifies a set of OpenGL capabilities.
Abstraction for an OpenGL rendering context.
static final int CONTEXT_CURRENT
Indicates that the context was made current during the last call to makeCurrent, value {@value}.
Specifies the the OpenGL profile.
static boolean isAvailable(final AbstractGraphicsDevice device, final String profile)
Returns the availability of a profile on a device.
static final String GL2ES2
The intersection of the desktop GL3, GL2 and embedded ES2 profile.
static GLProfile get(final AbstractGraphicsDevice device, String profile)
Returns a GLProfile object.
Tests simple recursive GLContext behavior.
static void main(final String args[])
A higher-level abstraction than GLDrawable which supplies an event based mechanism (GLEventListener) ...
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.