Note that there are some explanatory texts on larger screens.

plurals
  1. POTry to add VBO in Slick2D
    primarykey
    data
    text
    <p>I'm trying to add VBO in slick2D. All I find on the web is how to initialize VBO in a 3D context. Anyone knows how to do it in 2D ?</p> <p>My actual test (make 4 square in slick context) make this (i add corrds in black) : <a href="http://tof.canardpc.com/view/1594ca1b-645c-4736-99e6-0507a0b3777a.jpg" rel="nofollow noreferrer">vbo in slick2D http://tof.canardpc.com/view/1594ca1b-645c-4736-99e6-0507a0b3777a.jpg</a>.</p> <p>Below my init (in the init method of my GameState) :</p> <pre><code>// set up OpenGL GL11.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); GL11.glMaterial(GL11.GL_FRONT, GL11.GL_SPECULAR, floatBuffer(1.0f, 1.0f, 1.0f, 1.0f)); GL11.glMaterialf(GL11.GL_FRONT, GL11.GL_SHININESS, 25.0f); // set up the camera GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); // create our vertex buffer objects IntBuffer buffer = BufferUtils.createIntBuffer(1); GL15.glGenBuffers(buffer); int vertex_buffer_id = buffer.get(0); FloatBuffer vertex_buffer_data = BufferUtils.createFloatBuffer(vertex_data_array.length); vertex_buffer_data.put(vertex_data_array); vertex_buffer_data.rewind(); GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vertex_buffer_id); GL15.glBufferData(GL15.GL_ARRAY_BUFFER, vertex_buffer_data, GL15.GL_STATIC_DRAW); </code></pre> <p>And the render (in the render method of game state) :</p> <pre><code>g.setDrawMode(Graphics.MODE_ALPHA_BLEND) ; // perform rotation transformations GL11.glPushMatrix(); // render the cube GL11.glVertexPointer(3, GL11.GL_FLOAT, 28, 0); GL11.glColorPointer(4, GL11.GL_FLOAT, 28, 12); GL11.glDrawArrays(GL11.GL_QUADS, 0, vertex_data_array.length / 7); // restore the matrix to pre-transformation values GL11.glPopMatrix(); </code></pre> <p>I think something wrong because all other render disappear (text and sprites) and coords are not window size anymore.</p> <p>edit : I try something like this <code>GL11.glOrtho(0,800,600,0,-1,1);</code> with strange result</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload