List of usage examples for org.lwjgl.opengl GL12 glDrawRangeElements
public static void glDrawRangeElements(@NativeType("GLenum") int mode, @NativeType("GLuint") int start, @NativeType("GLuint") int end, @NativeType("GLsizei") int count, @NativeType("GLenum") int type, @NativeType("void const *") long indices)
From source file:com.badlogic.gdx.backends.jglfw.JglfwGL30.java
License:Apache License
@Override public void glDrawRangeElements(int mode, int start, int end, int count, int type, int offset) { GL12.glDrawRangeElements(mode, start, end, count, type, offset); }
From source file:io.root.gfx.glutils.GL.java
License:Apache License
public static void glDrawRangeElements(int mode, int start, int end, int count, int type, int offset) { GL12.glDrawRangeElements(mode, start, end, count, type, offset); }
From source file:net.adam_keenan.voxel.world.BlockVBO.java
License:Creative Commons License
public void render(BlockType type, float x, float y, float z) { TextureLoader.bind(Textures.SHEET);/*w w w .j a v a 2s . c o m*/ int vertID = this.blockVertexBufferID, texID; switch (type) { case DIRT: texID = dirtTextureID; break; case STONE: texID = stoneTextureID; break; case GRASS: texID = grassTextureID; break; case AIR: texID = 0; break; case FIRE: texID = grassTextureID; vertID = this.projectileVBOID; break; default: texID = stoneTextureID; break; } if (texID == 0) return; GL11.glPushMatrix(); GL11.glTranslatef(x, y, z); GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); // Vertex array ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, vertID); GL11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0); // Texture array ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, texID); GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 0, 0); // Index array ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_ARB, indexBufferID); // Draw 'em up GL12.glDrawRangeElements(GL11.GL_QUADS, 0, 6 * 4, 6 * 4, GL11.GL_UNSIGNED_INT, 0); GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); GL11.glPopMatrix(); TextureLoader.unbind(); }
From source file:net.smert.frameworkgl.opengl.helpers.VertexBufferObjectHelper.java
License:Apache License
public void drawRangeElements(int mode, int minIndex, int maxIndex, int count, int type, long byteOffset) { GL12.glDrawRangeElements(mode, minIndex, maxIndex, count, type, byteOffset); }
From source file:tk.ivybits.engine.gl.GL.java
License:Open Source License
public static void glDrawRangeElements(int a, int b, int c, int d, int e, long f) { GL12.glDrawRangeElements(a, b, c, d, e, f); }
From source file:voxicity.ChunkNode.java
License:Open Source License
public void render(Frustum camera) { if (empty)/*w w w . j a v a2s. c om*/ return; AABB chunk_box = new AABB(Constants.Chunk.side_length, Constants.Chunk.side_length, Constants.Chunk.side_length); chunk_box.center_on(chunk.get_x() + chunk_box.dimensions().x, chunk.get_y() + chunk_box.dimensions().y, chunk.get_z() + chunk_box.dimensions().z); if (!camera.collides(chunk_box)) return; Renderer.draw_calls++; if (shader_prog != 0) GL20.glUseProgram(shader_prog); // Bind VBO to vertex pointer GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vert_buf); GL11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0); // Bind the texture coord VBO to texture pointer GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, tex_buf); GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 0, 0); int tex_bak = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D); for (Batch batch : batches) { // Bind the texture for this batch GL11.glBindTexture(GL11.GL_TEXTURE_2D, batch.tex); // Bind index array GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, batch.indices); // Draw the block GL12.glDrawRangeElements(GL11.GL_QUADS, 0, Constants.Chunk.block_number * 24 - 1, batch.num_elements, GL11.GL_UNSIGNED_INT, 0); Renderer.batch_draw_calls++; Renderer.quads += batch.num_elements; } // Unbind the texture GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex_bak); // Unbind all buffers GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0); GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0); // Disable the shader once more if (shader_prog != 0) GL20.glUseProgram(0); }
From source file:voxicity.Renderer.java
License:Open Source License
private void render_batch(ChunkNode.Batch batch) { if (!camera.collides(batch.box)) return;/*from w w w . j a v a 2s.com*/ Renderer.draw_calls++; // Use the shader the batch needs GL20.glUseProgram(batch.shader); // Bind VBO to vertex pointer GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, batch.vert_buf); GL11.glVertexPointer(3, GL11.GL_FLOAT, 0, 0); // Bind the texture coord VBO to texture pointer GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, batch.tex_buf); GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 0, 0); // Bind the texture for this batch GL11.glBindTexture(GL11.GL_TEXTURE_2D, batch.tex); // Bind index array GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, batch.indices); // Draw the block GL12.glDrawRangeElements(GL11.GL_QUADS, 0, Constants.Chunk.block_number * 24 - 1, batch.num_elements, GL11.GL_UNSIGNED_INT, 0); Renderer.batch_draw_calls++; Renderer.quads += batch.num_elements; // Unbind the texture GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0); // Unbind all buffers GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0); GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0); GL20.glUseProgram(0); }