Bugzilla – Attachment 224 Details for
Bug 466
glBufferData does not copy the buffer
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
Log In
[x]
|
Forgot Password
Login:
[x]
a startable java program. the two buffers should contain the same values. but they does not
Bugtest.java (text/x-java), 2.59 KB, created by
devluz
on 2011-01-30 23:32:11 CET
(
hide
)
Description:
a startable java program. the two buffers should contain the same values. but they does not
Filename:
MIME Type:
Creator:
devluz
Created:
2011-01-30 23:32:11 CET
Size:
2.59 KB
patch
obsolete
>/* > * To change this template, choose Tools | Templates > * and open the template in the editor. > */ > >package joglrandom; > >import com.jogamp.newt.event.WindowEvent; >import java.awt.Frame; >import java.awt.event.WindowAdapter; >import java.nio.ByteBuffer; >import javax.media.opengl.GL2; >import javax.media.opengl.GL3; >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; > >/** > * > * @author Luz > */ >public class Bugtest implements GLEventListener >{ > > > > > static public void main(String[] args) > { > GLProfile glp = GLProfile.get(GLProfile.GL3); > > > GLCapabilities caps = new GLCapabilities(glp); > GLCanvas canvas = new GLCanvas(caps); > > Frame frame = new Frame("AWT Window Test"); > frame.setSize(800, 600); > frame.add(canvas); > frame.setVisible(true); > > frame.addWindowListener(new WindowAdapter() { > public void windowClosing(WindowEvent e) { > System.exit(0); > } > }); > > canvas.addGLEventListener(new Bugtest()); > > } > > public void init(GLAutoDrawable glad) > { > GL3 gl = glad.getGL().getGL3(); > > ByteBuffer verticiesBB = ByteBuffer.allocate(4*9); > int[] vertexBuffer = new int[1]; > > verticiesBB.putFloat(0); > verticiesBB.putFloat(0.5f); > verticiesBB.putFloat(0); > > verticiesBB.putFloat(0.5f); > verticiesBB.putFloat(-0.5f); > verticiesBB.putFloat(0); > > verticiesBB.putFloat(-0.5f); > verticiesBB.putFloat(-0.5f); > verticiesBB.putFloat(0); > verticiesBB.rewind(); > for(int i=0; i < verticiesBB.capacity(); i+=4) > System.out.println(verticiesBB.getFloat(i)); > gl.glGenBuffers(1, vertexBuffer, 0); > > gl.glBindBuffer(GL3.GL_ARRAY_BUFFER, vertexBuffer[0]); > > gl.glBufferData(GL3.GL_ARRAY_BUFFER, verticiesBB.capacity(), verticiesBB, GL3.GL_STATIC_DRAW); > > ByteBuffer bb = gl.glMapBuffer(GL3.GL_ARRAY_BUFFER, GL3.GL_READ_WRITE); > for(int i=0; i < bb.capacity(); i+=4) > System.err.println(bb.getFloat(i)); > } > > public void display(GLAutoDrawable glad) { > throw new UnsupportedOperationException("Not supported yet."); > } > > public void dispose(GLAutoDrawable glad) { > throw new UnsupportedOperationException("Not supported yet."); > } > > public void reshape(GLAutoDrawable glad, int i, int i1, int i2, int i3) { > throw new UnsupportedOperationException("Not supported yet."); > } > > > > >}
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 466
: 224