List of usage examples for org.lwjgl.opengl GL20 glDisableVertexAttribArray
public static void glDisableVertexAttribArray(@NativeType("GLuint") int index)
From source file:ar.com.quark.backend.lwjgl.opengl.DesktopGLES20.java
License:Apache License
/** * {@inheritDoc} */ @Override public void glDisableVertexAttribArray(int name) { GL20.glDisableVertexAttribArray(name); }
From source file:bd.ac.seu.lwjgldemo.Renderer.java
private void drawSomething() { GL11.glClearColor(0, 0, 0, 1);//from w w w.j av a 2 s . c o m GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); GL11.glColor3f(1, 1, 0); GL11.glPushMatrix(); GL11.glRotatef(angle, 0, 0, 1); /* GL11.glBegin(GL11.GL_QUADS); for (int row = 0; row < vertices.length; row = row + 3) { double x = vertices[row]; double y = vertices[row + 1]; double z = vertices[row + 2]; GL11.glVertex3d(x, y, z); } GL11.glEnd(); */ GL30.glBindVertexArray(vaoId); GL20.glEnableVertexAttribArray(0); // Draw the vertices GL11.glDrawArrays(GL11.GL_QUADS, 0, vertices.length / 3); // Put everything back to default (deselect) GL20.glDisableVertexAttribArray(0); GL30.glBindVertexArray(0); GL11.glPopMatrix(); angle = angle + .10f; frameCounter++; long currentTime = System.nanoTime(); long timeDifference = currentTime - lastTime; double fps = 1000000000.0 / timeDifference; System.out.printf("FPS: %.3f\n", fps); lastTime = currentTime; }
From source file:br.com.perin.renderEngine.Renderer.java
public void render(RawModel model) { GL30.glBindVertexArray(model.getVaoId()); GL20.glEnableVertexAttribArray(0);/*from ww w . j a va2 s .co m*/ GL11.glDrawElements(GL11.GL_TRIANGLES, model.getVertexCount(), GL11.GL_UNSIGNED_INT, 0); GL20.glDisableVertexAttribArray(0); GL30.glBindVertexArray(0); }
From source file:br.com.perin.renderEngine.Renderer.java
public void render(TexturedModel model) { RawModel raw = model.getRawModel();/*ww w . j a v a2s.com*/ GL30.glBindVertexArray(raw.getVaoId()); GL20.glEnableVertexAttribArray(0); GL20.glEnableVertexAttribArray(1); GL13.glActiveTexture(GL13.GL_TEXTURE0); GL11.glBindTexture(GL11.GL_TEXTURE_2D, model.getTexture().getId()); // Essa linha est com problemas. GL11.glDrawElements(GL11.GL_TRIANGLES, raw.getVertexCount(), GL11.GL_UNSIGNED_INT, 0); GL20.glDisableVertexAttribArray(0); GL20.glDisableVertexAttribArray(1); GL30.glBindVertexArray(0); }
From source file:com.adavr.player.context.QuadContext.java
License:Open Source License
@Override public void destroy() { VertexArray.bind(vao);/*from ww w . j a v a2 s. c o m*/ { GL20.glDisableVertexAttribArray(0); GL20.glDisableVertexAttribArray(1); VertexBuffer.unbind(verticesVBO); verticesVBO.destroy(); VertexBuffer.unbind(indicesVBO); indicesVBO.destroy(); } VertexArray.unbind(); vao.destroy(); }
From source file:com.adavr.player.globjects.VertexArray.java
License:Open Source License
public void disableAttributes() { for (int index = 0; index < currentAttribIndex; index++) { GL20.glDisableVertexAttribArray(index); } }
From source file:com.badlogic.gdx.backends.jglfw.JglfwGL20.java
License:Apache License
public void glDisableVertexAttribArray(int index) { GL20.glDisableVertexAttribArray(index); }
From source file:com.colonycraft.rendering.world.ChunkMeshRenderer.java
License:Apache License
public static void renderChunkMesh(World world, Chunk chunk, int meshType) { /* Bind the correct texture */ GL11.glEnable(GL11.GL_TEXTURE_2D);//from ww w .j a v a 2 s . co m TextureStorage.getTexture("terrain").bind(); if (meshType == ChunkMesh.MESH_OPAQUE) { GL11.glDisable(GL11.GL_BLEND); } else if (meshType == ChunkMesh.MESH_TRANSLUCENT || meshType == ChunkMesh.MESH_GRASS) { GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, 0.0f); } ChunkMesh cmesh = chunk.getMesh(); Mesh mesh = cmesh.getMesh(meshType); if (mesh == null) return; /* Bind the buffer */ GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, mesh.getVertexBufferHandle()); /* Enable the different kinds of data in the buffer */ GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); if (meshType == ChunkMesh.MESH_GRASS) { GL20.glEnableVertexAttribArray(GRASS_ATTRIBUTE_LIGHT); } else { GL20.glEnableVertexAttribArray(CHUNK_ATTRIBUTE_LIGHT); } /* Define the starting positions */ GL11.glVertexPointer(POSITION_SIZE, GL11.GL_FLOAT, STRIDE * FLOAT_SIZE, POSITION_OFFSET * FLOAT_SIZE); GL11.glTexCoordPointer(TEX_COORD_SIZE, GL11.GL_FLOAT, STRIDE * FLOAT_SIZE, TEX_COORD_OFFSET * FLOAT_SIZE); GL20.glVertexAttribPointer(CHUNK_ATTRIBUTE_LIGHT, 2, GL11.GL_FLOAT, false, STRIDE * FLOAT_SIZE, LIGHT_OFFSET * FLOAT_SIZE); /* Draw the buffer */ GL11.glDrawArrays(GL11.GL_QUADS, 0, mesh.vertices()); /* Unbind the buffer */ GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0); /* Disable the different kinds of data */ GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); if (meshType == ChunkMesh.MESH_GRASS) { GL20.glDisableVertexAttribArray(GRASS_ATTRIBUTE_LIGHT); } else { GL20.glDisableVertexAttribArray(CHUNK_ATTRIBUTE_LIGHT); } if (meshType == ChunkMesh.MESH_TRANSLUCENT || meshType == ChunkMesh.MESH_GRASS) { GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_ALPHA_TEST); } }
From source file:com.github.kajdreef.mazerunnermvn.Object.GameObject.java
/** * Render the Object.//from w ww. ja v a 2 s . c o m */ public void render() { FloatBuffer matrix44Buffer = BufferUtils.createFloatBuffer(16); modelMatrix.store(matrix44Buffer); matrix44Buffer.flip(); GL20.glUniformMatrix4(ShaderProgram.getMML(), false, matrix44Buffer); // Bind the texture GL13.glActiveTexture(GL13.GL_TEXTURE0); GL11.glBindTexture(GL11.GL_TEXTURE_2D, texId); // Bind to the VAO that has all the information about the quad vertices GL30.glBindVertexArray(vaoId); GL20.glEnableVertexAttribArray(0); GL20.glEnableVertexAttribArray(1); GL20.glEnableVertexAttribArray(2); // Bind to the index VBO that has all the information about the order of the vertices GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, vboIndicesId); // Draw the vertices GL11.glDrawElements(GL11.GL_TRIANGLES, indicesData.length, GL11.GL_UNSIGNED_BYTE, 0); // Put everything back to default (deselect) GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0); GL20.glDisableVertexAttribArray(2); GL20.glDisableVertexAttribArray(1); GL20.glDisableVertexAttribArray(0); GL30.glBindVertexArray(0); }
From source file:com.github.kajdreef.mazerunnermvn.Object.GameObject.java
public void destroy() { // Disable the VBO index from the VAO attributes list GL20.glDisableVertexAttribArray(0); // Delete the vertex VBO GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0); GL15.glDeleteBuffers(vboVerticesId); GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0); GL15.glDeleteBuffers(vboIndicesId);/*w w w . jav a2 s . c o m*/ // Delete the VAO GL30.glBindVertexArray(0); GL30.glDeleteVertexArrays(vaoId); }