List of usage examples for org.lwjgl.opengl GL11 glDisableClientState
public static native void glDisableClientState(@NativeType("GLenum") int cap);
From source file:kuake2.render.lwjgl.Surf.java
License:Open Source License
/** * R_DrawWorld// w w w.j a va 2 s .co m */ void R_DrawWorld() { if (r_drawworld.value == 0) return; if ((r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) != 0) return; currentmodel = r_worldmodel; Math3D.VectorCopy(r_newrefdef.vieworg, modelorg); entity_t ent = worldEntity; // auto cycle the world frame for texture animation ent.clear(); ent.frame = (int) (r_newrefdef.time * 2); currententity = ent; gl_state.currenttextures[0] = gl_state.currenttextures[1] = -1; GL11.glColor3f(1, 1, 1); // memset (gl_lms.lightmap_surfaces, 0, sizeof(gl_lms.lightmap_surfaces)); // TODO wird bei multitexture nicht gebraucht //gl_lms.clearLightmapSurfaces(); R_ClearSkyBox(); GL_EnableMultitexture(true); GL_SelectTexture(GL_TEXTURE0); GL_TexEnv(GL11.GL_REPLACE); GL11.glInterleavedArrays(GL11.GL_T2F_V3F, Polygon.BYTE_STRIDE, globalPolygonInterleavedBuf); GL_SelectTexture(GL_TEXTURE1); GL11.glTexCoordPointer(2, Polygon.BYTE_STRIDE, globalPolygonTexCoord1Buf); GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); if (gl_lightmap.value != 0) GL_TexEnv(GL11.GL_REPLACE); else GL_TexEnv(GL11.GL_MODULATE); R_RecursiveWorldNode(r_worldmodel.nodes[0]); // root node ARBMultitexture.glClientActiveTextureARB(GL_TEXTURE1); GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); GL_EnableMultitexture(false); DrawTextureChains(); R_DrawSkyBox(); R_DrawTriangleOutlines(); }
From source file:lwjglapp.Renderer.java
void drawVBO() { FloatBuffer cBuffer = BufferUtils.createFloatBuffer(9); cBuffer.put(1).put(0).put(0);//from w ww . j a va 2s . c om cBuffer.put(0).put(1).put(0); cBuffer.put(0).put(0).put(1); cBuffer.flip(); FloatBuffer vBuffer = BufferUtils.createFloatBuffer(9); vBuffer.put(-0.5f).put(-0.5f).put(0.0f); vBuffer.put(+0.5f).put(-0.5f).put(0.0f); vBuffer.put(+0.5f).put(+0.5f).put(0.0f); vBuffer.flip(); IntBuffer ib = BufferUtils.createIntBuffer(2); glGenBuffersARB(ib); int vHandle = ib.get(0); int cHandle = ib.get(1); GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); glBindBufferARB(GL_ARRAY_BUFFER_ARB, vHandle); glBufferDataARB(GL_ARRAY_BUFFER_ARB, vBuffer, GL_STATIC_DRAW_ARB); GL11.glVertexPointer(3, GL11.GL_FLOAT, /* stride */ 3 << 2, 0L); glBindBufferARB(GL_ARRAY_BUFFER_ARB, cHandle); glBufferDataARB(GL_ARRAY_BUFFER_ARB, cBuffer, GL_STATIC_DRAW_ARB); GL11.glColorPointer(3, GL11.GL_FLOAT, /* stride */ 3 << 2, 0L); GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, 3 /* elements */); glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); // cleanup VBO handles ib.put(0, vHandle); ib.put(1, cHandle); glDeleteBuffersARB(ib); }
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);/*from w w w. j a v a 2 s. co 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.kubin.rendering.ChunkMeshRenderer.java
License:Apache License
public static void renderChunkMesh(Chunk chunk, MeshType meshType) { if (chunk.getMesh().getVBO(meshType) <= 0) { return;/*from w w w. j av a 2 s . com*/ } /* Bind the correct texture */ GL11.glEnable(GL11.GL_TEXTURE_2D); TextureStorage.getTexture("blocks").bind(); if (meshType == MeshType.OPAQUE) { GL11.glDisable(GL11.GL_BLEND); } else if (meshType == MeshType.TRANSLUCENT) { 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 mesh = chunk.getMesh(); /* Bind the buffer */ ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, mesh.getVBO(meshType)); /* Enable the different kinds of data in the buffer */ GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); // System.out.println("Chunk Vertices = " + mesh.getVertexCount()); /* 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); GL11.glColorPointer(COLOR_SIZE, GL11.GL_FLOAT, STRIDE * FLOAT_SIZE, COLOR_OFFSET * FLOAT_SIZE); /* Draw the buffer */ GL11.glDrawArrays(GL11.GL_QUADS, 0, mesh.getVertexCount(meshType)); /* Unbind the buffer */ ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, 0); /* Disable the different kindds of data */ GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); if (meshType == MeshType.TRANSLUCENT) { GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_ALPHA_TEST); } }
From source file:net.smert.frameworkgl.opengl.helpers.VertexArrayHelper.java
License:Apache License
public void disableColors() { GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); }
From source file:net.smert.frameworkgl.opengl.helpers.VertexArrayHelper.java
License:Apache License
public void disableNormals() { GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY); }
From source file:net.smert.frameworkgl.opengl.helpers.VertexArrayHelper.java
License:Apache License
public void disableTexCoords() { GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); }
From source file:net.smert.frameworkgl.opengl.helpers.VertexArrayHelper.java
License:Apache License
public void disableVertices() { GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); }
From source file:opengl.Map.java
public void Draw() { float[] vertices = { -1.0f, -1.0f, -1.0f, -0.8f, 0.7f, -0.8f, 0.7f, -1.0f, 1.0f, -1.0f, 1.0f, -0.2f, 10000.7f, -0.97f, 10000.7f, -1.0f }; FloatBuffer triangle = BufferUtils.createFloatBuffer(vertices.length); triangle.put(vertices);//from w w w . j av a 2 s. co m triangle.flip(); GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); // GL11.glColorPointer(3, GL11.GL_FLOAT, 0, triangleVertexBuffer); GL11.glVertexPointer(2, 0, triangle); GL11.glDrawArrays(GL11.GL_QUADS, 0, vertices.length / 2); GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); }
From source file:opengl.Player.java
public void Draw() { float[] vertices = { (0.0f * ScaleX) + x, (0.0f * ScaleY) + y, (0.0f * ScaleX) + x, (1.0f * ScaleY) + y, (1.0f * ScaleX) + x, (1.0f * ScaleY) + y, (1.0f * ScaleX) + x, (0.0f * ScaleY) + y }; FloatBuffer triangle = BufferUtils.createFloatBuffer(vertices.length); triangle.put(vertices);//from w ww. j ava2 s. c o m triangle.flip(); GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); // GL11.glColorPointer(3, GL11.GL_FLOAT, 0, triangleVertexBuffer); GL11.glVertexPointer(2, 0, triangle); GL11.glDrawArrays(GL11.GL_QUADS, 0, vertices.length / 2); GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY); }