diff options
author | Kenneth Russel <[email protected]> | 2008-10-30 00:36:37 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2008-10-30 00:36:37 +0000 |
commit | 1d4b8640e128143707e6c19f6249d6b4dba0d2a0 (patch) | |
tree | 6e84ac75c88aee73b60255048a00cfd301f8db3f /src/demos/texture | |
parent | 0df738664c9ade75e38c3982560b5cf3e4cdf3df (diff) |
Incorporated patch from Michael Bien fixing roughly 80% of compilation errors
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/jogl-demos/branches/JOGL_2_SANDBOX@287 3298f667-5e0e-4b4a-8ed4-a3559d26a5f4
Diffstat (limited to 'src/demos/texture')
-rwxr-xr-x | src/demos/texture/TestSubImage.java | 43 | ||||
-rwxr-xr-x | src/demos/texture/TestTexture.java | 45 | ||||
-rwxr-xr-x | src/demos/texture/TextureConvert.java | 16 |
3 files changed, 76 insertions, 28 deletions
diff --git a/src/demos/texture/TestSubImage.java b/src/demos/texture/TestSubImage.java index b4e395e..f7ddde4 100755 --- a/src/demos/texture/TestSubImage.java +++ b/src/demos/texture/TestSubImage.java @@ -39,20 +39,41 @@ package demos.texture; +import com.sun.opengl.util.texture.Texture; +import com.sun.opengl.util.texture.TextureCoords; +import com.sun.opengl.util.texture.TextureData; +import com.sun.opengl.util.texture.TextureIO; import java.awt.AlphaComposite; import java.awt.Color; import java.awt.GradientPaint; -import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; -import java.awt.event.*; -import java.awt.image.*; -import javax.swing.*; -import java.util.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionAdapter; +import java.awt.image.BufferedImage; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import javax.media.opengl.GL; +import javax.media.opengl.GL2; +import javax.media.opengl.GLAutoDrawable; +import javax.media.opengl.GLEventListener; +import javax.media.opengl.awt.GLCanvas; +import javax.media.opengl.glu.GLU; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; +import javax.swing.KeyStroke; + -import javax.media.opengl.*; -import javax.media.opengl.glu.*; -import com.sun.opengl.util.texture.*; /** Demonstrates and tests updates of sub-rectangles of a Texture generated from a BufferedImage. Draws a cursor in texel space @@ -87,7 +108,7 @@ public class TestSubImage { } public void display(GLAutoDrawable drawable) { - GL gl = drawable.getGL(); + GL2 gl = drawable.getGL().getGL2(); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); if (convertedImage == null) { @@ -165,9 +186,9 @@ public class TestSubImage { // Now draw one quad with the texture texture.enable(); texture.bind(); - gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE); + gl.glTexEnvi(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_REPLACE); TextureCoords coords = texture.getImageTexCoords(); - gl.glBegin(GL.GL_QUADS); + gl.glBegin(GL2.GL_QUADS); gl.glTexCoord2f(coords.left(), coords.bottom()); gl.glVertex3f(0, 0, 0); gl.glTexCoord2f(coords.right(), coords.bottom()); diff --git a/src/demos/texture/TestTexture.java b/src/demos/texture/TestTexture.java index ff0ff14..c32fc8c 100755 --- a/src/demos/texture/TestTexture.java +++ b/src/demos/texture/TestTexture.java @@ -39,14 +39,34 @@ package demos.texture; -import java.awt.geom.*; -import java.awt.event.*; -import java.io.*; -import javax.swing.*; +import com.sun.opengl.util.texture.Texture; +import com.sun.opengl.util.texture.TextureCoords; +import com.sun.opengl.util.texture.TextureIO; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.PrintStream; +import javax.media.opengl.DebugGL2; +import javax.media.opengl.GL; +import javax.media.opengl.GL2; +import javax.media.opengl.GLAutoDrawable; +import javax.media.opengl.GLEventListener; +import javax.media.opengl.awt.GLCanvas; +import javax.media.opengl.glu.GLU; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPopupMenu; +import javax.swing.KeyStroke; + -import javax.media.opengl.*; -import javax.media.opengl.glu.*; -import com.sun.opengl.util.texture.*; /** Demonstrates simple use of the TextureIO texture loader. */ @@ -109,7 +129,7 @@ public class TestTexture implements GLEventListener { frame.getContentPane().add(canvas); frame.setJMenuBar(menuBar); frame.setSize(800, 600); - frame.show(); + frame.setVisible(true); } private boolean newTexture; @@ -128,9 +148,10 @@ public class TestTexture implements GLEventListener { } public void init(GLAutoDrawable drawable) { - drawable.setGL(new DebugGL(drawable.getGL())); GL gl = drawable.getGL(); + drawable.setGL(new DebugGL2(gl.getGL2())); + gl.glClearColor(0, 0, 0, 0); gl.glEnable(GL.GL_DEPTH_TEST); } @@ -145,7 +166,7 @@ public class TestTexture implements GLEventListener { } public void display(GLAutoDrawable drawable) { - GL gl = drawable.getGL(); + GL2 gl = drawable.getGL().getGL2(); gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); if (flushTexture) { @@ -183,10 +204,10 @@ public class TestTexture implements GLEventListener { if (texture != null) { texture.enable(); texture.bind(); - gl.glTexEnvi(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE); + gl.glTexEnvi(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL.GL_REPLACE); TextureCoords coords = texture.getImageTexCoords(); - gl.glBegin(GL.GL_QUADS); + gl.glBegin(GL2.GL_QUADS); gl.glTexCoord2f(coords.left(), coords.bottom()); gl.glVertex3f(0, 0, 0); gl.glTexCoord2f(coords.right(), coords.bottom()); diff --git a/src/demos/texture/TextureConvert.java b/src/demos/texture/TextureConvert.java index 728aa9c..cd0a033 100755 --- a/src/demos/texture/TextureConvert.java +++ b/src/demos/texture/TextureConvert.java @@ -39,12 +39,18 @@ package demos.texture; -import java.io.*; +import com.sun.opengl.impl.io.FileUtil; +import com.sun.opengl.util.texture.Texture; +import com.sun.opengl.util.texture.TextureData; +import com.sun.opengl.util.texture.TextureIO; +import java.io.File; +import java.io.IOException; +import javax.media.opengl.GL; +import javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLDrawableFactory; +import javax.media.opengl.GLPbuffer; + -import javax.media.opengl.*; -import javax.media.opengl.glu.*; -import com.sun.opengl.util.*; -import com.sun.opengl.util.texture.*; /** Demonstrates how the TextureIO subsystem may be used to convert textures between multiple file formats, including texture |