List of usage examples for org.lwjgl.opengl GL11 glTexCoordPointer
public static void glTexCoordPointer(@NativeType("GLint") int size, @NativeType("GLenum") int type, @NativeType("GLsizei") int stride, @NativeType("void const *") FloatBuffer pointer)
From source file:go.graphics.swing.opengl.LWJGLDrawContext.java
License:Open Source License
@Override public void drawQuadWithTexture(TextureHandle texture, GeometryHandle geometry) throws IllegalBufferException { if (geometry == null) { throw new NullPointerException("Cannot draw a null geometry"); }/*from www. ja v a 2 s . com*/ if (canUseVBOs) { bindTexture(texture); bindArrayBuffer(geometry); GL11.glVertexPointer(3, GL11.GL_FLOAT, 5 * 4, 0); GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 5 * 4, 3 * 4); GL11.glDrawArrays(GL11.GL_QUADS, 0, 4); bindArrayBuffer(null); } else { drawQuadWithTexture(texture, getGeometryBuffer(geometry), 4); } }
From source file:go.graphics.swing.opengl.LWJGLDrawContext.java
License:Open Source License
@Override public void drawTrianglesWithTexture(TextureHandle texture, GeometryHandle geometry, int triangleCount) throws IllegalBufferException { if (canUseVBOs) { bindTexture(texture);// w w w . j a v a 2 s. c o m bindArrayBuffer(geometry); GL11.glVertexPointer(3, GL11.GL_FLOAT, 5 * 4, 0); GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 5 * 4, 3 * 4); GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, triangleCount * 3); bindArrayBuffer(null); } else { ByteBuffer buffer = getGeometryBuffer(geometry); buffer.rewind(); drawTrianglesWithTexture(texture, buffer, buffer.remaining() / 5 / 4); } }
From source file:go.graphics.swing.opengl.LWJGLDrawContext.java
License:Open Source License
@Override public void drawTrianglesWithTextureColored(TextureHandle texture, GeometryHandle geometry, int triangleCount) throws IllegalBufferException { if (canUseVBOs) { bindTexture(texture);/*w w w. j a v a 2 s .c o m*/ bindArrayBuffer(geometry); GL11.glVertexPointer(3, GL11.GL_FLOAT, 6 * 4, 0); GL11.glTexCoordPointer(2, GL11.GL_FLOAT, 6 * 4, 3 * 4); GL11.glColorPointer(4, GL11.GL_UNSIGNED_BYTE, 6 * 4, 5 * 4); GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, triangleCount * 3); GL11.glDisableClientState(GL11.GL_COLOR_ARRAY); bindArrayBuffer(null); } else { ByteBuffer buffer = getGeometryBuffer(geometry); drawTrianglesWithTextureColored(texture, buffer, buffer.remaining() / 4 / 5); } }
From source file:jpcsp.graphics.RE.RenderingEngineLwjgl.java
License:Open Source License
@Override public void setTexCoordPointer(int size, int type, int stride, long offset) { GL11.glTexCoordPointer(size, pointerTypeToGL[type], stride, 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);//from w ww . j a va2 s. 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.kubin.rendering.ChunkMeshRenderer.java
License:Apache License
public static void renderChunkMesh(Chunk chunk, MeshType meshType) { if (chunk.getMesh().getVBO(meshType) <= 0) { return;//ww w .j a v a 2s . c o m } /* 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 bindTexCoords(int size, int type, ByteBuffer byteBuffer) { GL11.glTexCoordPointer(size, type, 0, byteBuffer); }
From source file:net.smert.frameworkgl.opengl.helpers.VertexBufferObjectHelper.java
License:Apache License
public void bindTexCoords(int vboID, int size, int type, int strideBytes, int offsetBytes) { GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vboID); GL11.glTexCoordPointer(size, type, strideBytes, offsetBytes); }
From source file:org.ajgl.graphics.VertexBufferedObject.java
License:Open Source License
/** * Binds the local texture vertices. You need to enable * {@link org.lwjgl.opengl.GL11#GL_TEXTURE_COORD_ARRAY GL_TEXTURE_COORD_ARRAY} before * you can use this method./*from w w w . j a v a 2s.co m*/ * @param textureHandler - The vertex buffered object texture handler * @param texturePointData - The number of points per texture data (i.e. 1-1D, 2-2D, 3-3D) * @param stride - The stride offset; used for interleaving data * @param offSet - initial offset for the data * @param dataType - The OpenGL dataType */ public static void texturePointer(int textureHandler, int texturePointData, int stride, int offSet, @GLDataType int dataType) { // bind color data GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, textureHandler); GL11.glTexCoordPointer(texturePointData, dataType, stride, offSet); }
From source file:org.craftmania.rendering.ChunkMeshRenderer.java
License:Apache License
public static void renderChunkMesh(Chunk chunk, MeshType meshType) { if (chunk.getMesh().getVBO(meshType) <= 0) { return;/*from ww w. j av a 2s .c o m*/ } /* Bind the correct texture */ GL11.glEnable(GL11.GL_TEXTURE_2D); TextureStorage.getTexture("terrain").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); } }