Bugzilla – Attachment 222 Details for
Bug 463
GLUgl2.gluScaleImage() consumes all memory
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
Log In
[x]
|
Forgot Password
Login:
[x]
JOGL 2 unit test
GluScaleImage.java (text/plain), 2.23 KB, created by
Wade Walker
on 2011-01-24 23:53:43 CET
(
hide
)
Description:
JOGL 2 unit test
Filename:
MIME Type:
Creator:
Wade Walker
Created:
2011-01-24 23:53:43 CET
Size:
2.23 KB
patch
obsolete
>package name.wadewalker.jogl2tests; > >import java.awt.Frame; >import java.awt.event.WindowAdapter; >import java.awt.event.WindowEvent; >import java.nio.ByteBuffer; > >import javax.media.opengl.GL; >import javax.media.opengl.GLAutoDrawable; >import javax.media.opengl.GLCapabilities; >import javax.media.opengl.GLEventListener; >import javax.media.opengl.GLProfile; >import javax.media.opengl.awt.GLCanvas; >import javax.media.opengl.glu.gl2.GLUgl2; > >import org.junit.Test; > >public class GluScaleImage implements GLEventListener { > > @Override > public void init(GLAutoDrawable drawable) { > } > > @Override > public void display(GLAutoDrawable drawable) { > int widthin = 559; > int heightin = 425; > > int widthout = 1024; > int heightout = 512; > > int textureInLength = widthin * heightin * 4; > int textureOutLength = widthout * heightout * 4; > > byte[] datain = new byte[textureInLength]; > byte[] dataout = new byte[textureOutLength]; > > ByteBuffer bufferIn = ByteBuffer.wrap(datain); > ByteBuffer bufferOut = ByteBuffer.wrap(dataout); > GLUgl2 glu = new GLUgl2(); > glu.gluScaleImage( GL.GL_RGBA, > widthin, heightin, GL.GL_UNSIGNED_BYTE, bufferIn, > widthout, heightout, GL.GL_UNSIGNED_BYTE, bufferOut ); > } > > @Override > public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { > } > > > @Override > public void dispose(GLAutoDrawable drawable) { > } > > @Test > public void test01() { > Frame frame = new Frame("Test"); > GLProfile glprofile = GLProfile.getDefault(); > GLCapabilities glCapabilities = new GLCapabilities(glprofile); > final GLCanvas canvas = new GLCanvas(glCapabilities); > frame.setSize(256, 256); > frame.add(canvas); > frame.setVisible( true ); > canvas.addGLEventListener( this ); > > frame.addWindowListener(new WindowAdapter() { > public void windowClosing( WindowEvent e ) { > System.exit(0); > } > }); > canvas.display(); > } > > public static void main(String args[]) { > org.junit.runner.JUnitCore.main(GluScaleImage.class.getName()); > } >}
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 463
: 222 |
223