Bugzilla – Attachment 93 Details for
Bug 276
Bug in handling of RGB-like custom BufferedImages in TextureIO
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
Log In
[x]
|
Forgot Password
Login:
[x]
Java source for test case
Lesson06.java (text/plain), 2.48 KB, created by
Sven Gothel
on 2007-02-22 09:07:00 CET
(
hide
)
Description:
Java source for test case
Filename:
MIME Type:
Creator:
Sven Gothel
Created:
2007-02-22 09:07:00 CET
Size:
2.48 KB
patch
obsolete
>import java.awt.event.*; >import java.io.*; >import javax.imageio.*; >import javax.swing.*; >import javax.media.opengl.*; >import javax.media.opengl.glu.*; >import com.sun.opengl.util.*; >import com.sun.opengl.util.texture.*; > >public class Lesson06 { > public static void main(String args[]){ > JFrame frame = new JFrame("Lesson06"); > GLCanvas canvas = new GLCanvas(); > frame.add(canvas); > > final Animator animator = new Animator(canvas); > canvas.addGLEventListener(new Lesson06Renderer()); > frame.addWindowListener(new WindowAdapter(){ > public void windowClosing(WindowEvent e){ > animator.stop(); > System.exit(0); > } > }); > frame.setVisible(true); > frame.setBounds(0, 0, 640+frame.getInsets().left+frame.getInsets().right, 480+frame.getInsets().top+frame.getInsets().bottom); > frame.requestFocus(); > animator.start(); > } >} > >class Lesson06Renderer implements GLEventListener{ > public void init(GLAutoDrawable drawable){ > final GL gl = drawable.getGL(); > gl.glShadeModel(GL.GL_SMOOTH); > gl.glClearColor(0.0f, 0.0f, 0.0f, 0.5f); > gl.glClearDepth(1.0f); > gl.glEnable(GL.GL_DEPTH_TEST); > gl.glDepthFunc(GL.GL_LEQUAL); > gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); > gl.glEnable(GL.GL_TEXTURE_2D); > > Texture tex; > try { > tex = TextureIO.newTexture(TextureIO.newTextureData(ImageIO.read(new File("NeHe.png")), false)); > } catch (IOException ioe) { > //handle error > } > } > > public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height){ > final GL gl = drawable.getGL(); > final GLU glu = new GLU(); > > if(height <= 0)height = 1; > float h = (float)width / (float)height; > gl.glViewport(0, 0, width, height); > gl.glMatrixMode(GL.GL_PROJECTION); > gl.glLoadIdentity(); > glu.gluPerspective(45.0, h, 0.2, 20.0); > gl.glMatrixMode(GL.GL_MODELVIEW); > gl.glLoadIdentity(); > } > > public void display(GLAutoDrawable drawable){ > final GL gl = drawable.getGL(); > > gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); > gl.glLoadIdentity(); > > gl.glTranslatef(0, 0, -6); > > gl.glBegin(GL.GL_QUADS); > gl.glTexCoord2f(0.0f, 0.0f);gl.glVertex3f(-1.0f, -1.0f, 1.0f); > gl.glTexCoord2f(1.0f, 0.0f);gl.glVertex3f(1.0f, -1.0f, 1.0f); > gl.glTexCoord2f(1.0f, 1.0f);gl.glVertex3f(1.0f, 1.0f, 1.0f); > gl.glTexCoord2f(0.0f, 1.0f);gl.glVertex3f(-1.0f, 1.0f, 1.0f); > gl.glEnd(); > > } > > public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged){} >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 276
: 93 |
94