From e952e7dbac7a6b746b8465aa63423f1aa138ca27 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 30 Mar 2011 07:28:56 +0200 Subject: Renamed Hw*Renderer -> *Renderer --- .../test/junit/graph/TestHwTextRenderer01.java | 159 --------------------- .../test/junit/graph/TestTextRenderer01.java | 159 +++++++++++++++++++++ 2 files changed, 159 insertions(+), 159 deletions(-) delete mode 100755 src/test/com/jogamp/opengl/test/junit/graph/TestHwTextRenderer01.java create mode 100755 src/test/com/jogamp/opengl/test/junit/graph/TestTextRenderer01.java (limited to 'src/test') diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestHwTextRenderer01.java b/src/test/com/jogamp/opengl/test/junit/graph/TestHwTextRenderer01.java deleted file mode 100755 index 7f5ee9d98..000000000 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestHwTextRenderer01.java +++ /dev/null @@ -1,159 +0,0 @@ -package test.com.jogamp.opengl.test.junit.graph; - -import java.io.IOException; - -import javax.media.nativewindow.NativeWindowFactory; -import javax.media.opengl.GL; -import javax.media.opengl.GL2ES2; -import javax.media.opengl.GLAutoDrawable; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLCapabilitiesImmutable; -import javax.media.opengl.GLException; -import javax.media.opengl.GLProfile; - -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -import com.jogamp.graph.curve.Region; -import com.jogamp.graph.font.FontFactory; -import com.jogamp.graph.geom.opengl.SVertex; -import com.jogamp.newt.opengl.GLWindow; - -import demo.GPUTextGLListenerBase01; - -public class TestHwTextRenderer01 { - - @BeforeClass - public static void initClass() { - GLProfile.initSingleton(true); - NativeWindowFactory.initSingleton(true); - } - - static void destroyWindow(GLWindow window) { - if(null!=window) { - window.destroy(); - } - } - - static GLWindow createWindow(String title, GLCapabilitiesImmutable caps, int width, int height) { - Assert.assertNotNull(caps); - - GLWindow window = GLWindow.create(caps); - window.setSize(width, height); - window.setPosition(10, 10); - window.setTitle(title); - Assert.assertNotNull(window); - window.setVisible(true); - - return window; - } - - @Test - public void testTextRendererR2T01() throws InterruptedException { - GLProfile glp = GLProfile.get(GLProfile.GL3bc); - GLCapabilities caps = new GLCapabilities(glp); - caps.setOnscreen(false); - caps.setAlphaBits(4); - - GLWindow window = createWindow("r2t1-msaa0", caps, 800,400); - TextGLListener textGLListener = new TextGLListener(Region.TWO_PASS); - textGLListener.attachTo(window); - - textGLListener.setFontSet(FontFactory.UBUNTU, 0, 0); - textGLListener.setTech(-400, -30, 0f, -1000, 400); - window.display(); - - textGLListener.setTech(-400, -30, 0, -380, 1100); - window.display(); - - textGLListener.setTech(-400, -20, 0, -80, 2500); - window.display(); - - textGLListener.setFontSet(FontFactory.JAVA, 0, 0); - textGLListener.setTech(-400, -30, 0f, -1000, 400); - window.display(); - - textGLListener.setTech(-400, -30, 0, -380, 1100); - window.display(); - - textGLListener.setTech(-400, -20, 0, -80, 2500); - window.display(); - - destroyWindow(window); - } - - @Test - public void testTextRendererMSAA01() throws InterruptedException { - GLProfile glp = GLProfile.get(GLProfile.GL2ES2); - GLCapabilities caps = new GLCapabilities(glp); - caps.setOnscreen(false); - caps.setAlphaBits(4); - caps.setSampleBuffers(true); - caps.setNumSamples(4); - - GLWindow window = createWindow("r2t0-msaa1", caps, 800, 400); - TextGLListener textGLListener = new TextGLListener(Region.SINGLE_PASS); - textGLListener.attachTo(window); - - textGLListener.setFontSet(FontFactory.UBUNTU, 0, 0); - textGLListener.setTech(-400, -30, 0f, -1000, 0); - window.display(); - - textGLListener.setTech(-400, -30, 0, -380, 0); - window.display(); - - textGLListener.setTech(-400, -20, 0, -80, 0); - window.display(); - - textGLListener.setFontSet(FontFactory.JAVA, 0, 0); - textGLListener.setTech(-400, -30, 0f, -1000, 0); - window.display(); - - textGLListener.setTech(-400, -30, 0, -380, 0); - window.display(); - - textGLListener.setTech(-400, -20, 0, -80, 0); - window.display(); - - destroyWindow(window); - } - - private class TextGLListener extends GPUTextGLListenerBase01 { - String winTitle; - - public TextGLListener(int type) { - super(SVertex.factory(), type, false, false); - } - - public void attachTo(GLWindow window) { - super.attachTo(window); - winTitle = window.getTitle(); - } - public void setTech(float xt, float yt, float angle, int zoom, int fboSize){ - setMatrix(xt, yt, angle, zoom, fboSize); - } - - public void init(GLAutoDrawable drawable) { - GL2ES2 gl = drawable.getGL().getGL2ES2(); - super.init(drawable); - gl.setSwapInterval(1); - gl.glEnable(GL.GL_DEPTH_TEST); - textRenderer.init(gl); - textRenderer.setAlpha(gl, 1.0f); - textRenderer.setColor(gl, 0.0f, 0.0f, 0.0f); - } - - public void display(GLAutoDrawable drawable) { - super.display(drawable); - - try { - printScreen("./", winTitle, drawable.getWidth(), drawable.getHeight(), false); - } catch (GLException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } -} diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRenderer01.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRenderer01.java new file mode 100755 index 000000000..501bdbb75 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRenderer01.java @@ -0,0 +1,159 @@ +package test.com.jogamp.opengl.test.junit.graph; + +import java.io.IOException; + +import javax.media.nativewindow.NativeWindowFactory; +import javax.media.opengl.GL; +import javax.media.opengl.GL2ES2; +import javax.media.opengl.GLAutoDrawable; +import javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLCapabilitiesImmutable; +import javax.media.opengl.GLException; +import javax.media.opengl.GLProfile; + +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.jogamp.graph.curve.Region; +import com.jogamp.graph.font.FontFactory; +import com.jogamp.graph.geom.opengl.SVertex; +import com.jogamp.newt.opengl.GLWindow; + +import demo.GPUTextGLListenerBase01; + +public class TestTextRenderer01 { + + @BeforeClass + public static void initClass() { + GLProfile.initSingleton(true); + NativeWindowFactory.initSingleton(true); + } + + static void destroyWindow(GLWindow window) { + if(null!=window) { + window.destroy(); + } + } + + static GLWindow createWindow(String title, GLCapabilitiesImmutable caps, int width, int height) { + Assert.assertNotNull(caps); + + GLWindow window = GLWindow.create(caps); + window.setSize(width, height); + window.setPosition(10, 10); + window.setTitle(title); + Assert.assertNotNull(window); + window.setVisible(true); + + return window; + } + + @Test + public void testTextRendererR2T01() throws InterruptedException { + GLProfile glp = GLProfile.get(GLProfile.GL3bc); + GLCapabilities caps = new GLCapabilities(glp); + caps.setOnscreen(false); + caps.setAlphaBits(4); + + GLWindow window = createWindow("r2t1-msaa0", caps, 800,400); + TextGLListener textGLListener = new TextGLListener(Region.TWO_PASS); + textGLListener.attachTo(window); + + textGLListener.setFontSet(FontFactory.UBUNTU, 0, 0); + textGLListener.setTech(-400, -30, 0f, -1000, 400); + window.display(); + + textGLListener.setTech(-400, -30, 0, -380, 1100); + window.display(); + + textGLListener.setTech(-400, -20, 0, -80, 2500); + window.display(); + + textGLListener.setFontSet(FontFactory.JAVA, 0, 0); + textGLListener.setTech(-400, -30, 0f, -1000, 400); + window.display(); + + textGLListener.setTech(-400, -30, 0, -380, 1100); + window.display(); + + textGLListener.setTech(-400, -20, 0, -80, 2500); + window.display(); + + destroyWindow(window); + } + + @Test + public void testTextRendererMSAA01() throws InterruptedException { + GLProfile glp = GLProfile.get(GLProfile.GL2ES2); + GLCapabilities caps = new GLCapabilities(glp); + caps.setOnscreen(false); + caps.setAlphaBits(4); + caps.setSampleBuffers(true); + caps.setNumSamples(4); + + GLWindow window = createWindow("r2t0-msaa1", caps, 800, 400); + TextGLListener textGLListener = new TextGLListener(Region.SINGLE_PASS); + textGLListener.attachTo(window); + + textGLListener.setFontSet(FontFactory.UBUNTU, 0, 0); + textGLListener.setTech(-400, -30, 0f, -1000, 0); + window.display(); + + textGLListener.setTech(-400, -30, 0, -380, 0); + window.display(); + + textGLListener.setTech(-400, -20, 0, -80, 0); + window.display(); + + textGLListener.setFontSet(FontFactory.JAVA, 0, 0); + textGLListener.setTech(-400, -30, 0f, -1000, 0); + window.display(); + + textGLListener.setTech(-400, -30, 0, -380, 0); + window.display(); + + textGLListener.setTech(-400, -20, 0, -80, 0); + window.display(); + + destroyWindow(window); + } + + private class TextGLListener extends GPUTextGLListenerBase01 { + String winTitle; + + public TextGLListener(int type) { + super(SVertex.factory(), type, false, false); + } + + public void attachTo(GLWindow window) { + super.attachTo(window); + winTitle = window.getTitle(); + } + public void setTech(float xt, float yt, float angle, int zoom, int fboSize){ + setMatrix(xt, yt, angle, zoom, fboSize); + } + + public void init(GLAutoDrawable drawable) { + GL2ES2 gl = drawable.getGL().getGL2ES2(); + super.init(drawable); + gl.setSwapInterval(1); + gl.glEnable(GL.GL_DEPTH_TEST); + textRenderer.init(gl); + textRenderer.setAlpha(gl, 1.0f); + textRenderer.setColor(gl, 0.0f, 0.0f, 0.0f); + } + + public void display(GLAutoDrawable drawable) { + super.display(drawable); + + try { + printScreen("./", winTitle, drawable.getWidth(), drawable.getHeight(), false); + } catch (GLException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } +} -- cgit v1.2.3