Java Code Examples for javax.microedition.khronos.opengles.GL11#glTexCoordPointer()
The following examples show how to use
javax.microedition.khronos.opengles.GL11#glTexCoordPointer() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GLES11Canvas.java From PhotoMovie with Apache License 2.0 | 6 votes |
public GLES11Canvas(GL11 gl) { mGL = gl; mGLState = new GLState(gl); // First create an nio buffer, then create a VBO from it. int size = BOX_COORDINATES.length * Float.SIZE / Byte.SIZE; FloatBuffer xyBuffer = allocateDirectNativeOrderBuffer(size).asFloatBuffer(); xyBuffer.put(BOX_COORDINATES, 0, BOX_COORDINATES.length).position(0); int[] name = new int[1]; mGLId.glGenBuffers(1, name, 0); mBoxCoords = name[0]; gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, mBoxCoords); gl.glBufferData(GL11.GL_ARRAY_BUFFER, xyBuffer.capacity() * (Float.SIZE / Byte.SIZE), xyBuffer, GL11.GL_STATIC_DRAW); gl.glVertexPointer(2, GL11.GL_FLOAT, 0, 0); gl.glTexCoordPointer(2, GL11.GL_FLOAT, 0, 0); // Enable the texture coordinate array for Texture 1 gl.glClientActiveTexture(GL11.GL_TEXTURE1); gl.glTexCoordPointer(2, GL11.GL_FLOAT, 0, 0); gl.glClientActiveTexture(GL11.GL_TEXTURE0); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); // mMatrixValues and mAlpha will be initialized in setSize() }
Example 2
Source File: MatrixPaletteRenderer.java From codeexamples-android with Eclipse Public License 1.0 | 6 votes |
public void draw(GL10 gl) { GL11 gl11 = (GL11) gl; GL11Ext gl11Ext = (GL11Ext) gl; gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, mVertexBufferObjectId); gl11.glVertexPointer(3, GL10.GL_FLOAT, VERTEX_SIZE, 0); gl11.glTexCoordPointer(2, GL10.GL_FLOAT, VERTEX_SIZE, VERTEX_TEXTURE_BUFFER_INDEX_OFFSET * FLOAT_SIZE); gl.glEnableClientState(GL11Ext.GL_MATRIX_INDEX_ARRAY_OES); gl.glEnableClientState(GL11Ext.GL_WEIGHT_ARRAY_OES); gl11Ext.glWeightPointerOES(2, GL10.GL_FLOAT, VERTEX_SIZE, VERTEX_WEIGHT_BUFFER_INDEX_OFFSET * FLOAT_SIZE); gl11Ext.glMatrixIndexPointerOES(2, GL10.GL_UNSIGNED_BYTE, VERTEX_SIZE, VERTEX_PALETTE_INDEX_OFFSET ); gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, mElementBufferObjectId); gl11.glDrawElements(GL10.GL_TRIANGLES, mIndexCount, GL10.GL_UNSIGNED_SHORT, 0); gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisableClientState(GL11Ext.GL_MATRIX_INDEX_ARRAY_OES); gl.glDisableClientState(GL11Ext.GL_WEIGHT_ARRAY_OES); gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, 0); gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, 0); }
Example 3
Source File: GLCanvasImpl.java From document-viewer with GNU General Public License v3.0 | 5 votes |
private void initialize() { final GL11 gl = mGL; // First create an nio buffer, then create a VBO from it. final int size = BOX_COORDINATES.length * Float.SIZE / Byte.SIZE; final FloatBuffer xyBuffer = allocateDirectNativeOrderBuffer(size).asFloatBuffer(); xyBuffer.put(BOX_COORDINATES, 0, BOX_COORDINATES.length).position(0); final int[] name = new int[1]; GLId.glGenBuffers(1, name, 0); mBoxCoords = name[0]; gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, mBoxCoords); gl.glBufferData(GL11.GL_ARRAY_BUFFER, xyBuffer.capacity() * (Float.SIZE / Byte.SIZE), xyBuffer, GL11.GL_STATIC_DRAW); gl.glVertexPointer(2, GL10.GL_FLOAT, 0, 0); gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, 0); // Enable the texture coordinate array for Texture 1 gl.glClientActiveTexture(GL10.GL_TEXTURE1); gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, 0); gl.glClientActiveTexture(GL10.GL_TEXTURE0); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); gl.glHint(GL10.GL_LINE_SMOOTH_HINT, GL10.GL_NICEST); gl.glHint(GL10.GL_POLYGON_SMOOTH_HINT, GL10.GL_NICEST); gl.glEnable(GL10.GL_LINE_SMOOTH); gl.glLineWidth(1.5f); gl.glEnable(GL10.GL_BLEND); gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA); // mMatrixValues and mAlpha will be initialized in setSize() }
Example 4
Source File: GLCanvasImpl.java From document-viewer with GNU General Public License v3.0 | 5 votes |
@Override public void fillPoly(final int color, final PointF... path) { mGLState.setColorMode(color, mAlpha); final GL11 gl = mGL; final int bytes = 2 * path.length * Float.SIZE; final FloatBuffer xyBuffer = allocateDirectNativeOrderBuffer(bytes).asFloatBuffer(); for (int i = 0; i < path.length; i++) { xyBuffer.put(path[i].x / mScreenWidth); xyBuffer.put(path[i].y / mScreenHeight); } xyBuffer.position(0); saveTransform(); translate(0, 0); scale(mScreenWidth, mScreenHeight, 1); gl.glLoadMatrixf(mMatrixValues, 0); final int[] name = new int[1]; GLId.glGenBuffers(1, name, 0); gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, name[0]); gl.glBufferData(GL11.GL_ARRAY_BUFFER, bytes, xyBuffer, GL11.GL_DYNAMIC_DRAW); gl.glVertexPointer(2, GL10.GL_FLOAT, 0, 0); gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, path.length); restoreTransform(); gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, mBoxCoords); gl.glVertexPointer(2, GL10.GL_FLOAT, 0, 0); gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, 0); }
Example 5
Source File: GLCanvasImpl.java From document-viewer with GNU General Public License v3.0 | 5 votes |
@Override public void drawPoly(final int color, final PointF... path) { mGLState.setColorMode(color, mAlpha); mGLState.setLineWidth(1.5f); final GL11 gl = mGL; final int bytes = 2 * path.length * Float.SIZE; final FloatBuffer xyBuffer = allocateDirectNativeOrderBuffer(bytes).asFloatBuffer(); for (int i = 0; i < path.length; i++) { xyBuffer.put(path[i].x / mScreenWidth); xyBuffer.put(path[i].y / mScreenHeight); } xyBuffer.position(0); saveTransform(); translate(0, 0); scale(mScreenWidth, mScreenHeight, 1); gl.glLoadMatrixf(mMatrixValues, 0); final int[] name = new int[1]; GLId.glGenBuffers(1, name, 0); gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, name[0]); gl.glBufferData(GL11.GL_ARRAY_BUFFER, bytes, xyBuffer, GL11.GL_DYNAMIC_DRAW); gl.glVertexPointer(2, GL10.GL_FLOAT, 0, 0); gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, path.length); restoreTransform(); gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, mBoxCoords); gl.glVertexPointer(2, GL10.GL_FLOAT, 0, 0); gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, 0); }