javax.microedition.khronos.opengles.GL11Ext Java Examples
The following examples show how to use
javax.microedition.khronos.opengles.GL11Ext.
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 |
@Override public void setTextureParameters(BasicTexture texture) { int width = texture.getWidth(); int height = texture.getHeight(); // Define a vertically flipped crop rectangle for OES_draw_texture. // The four values in sCropRect are: left, bottom, width, and // height. Negative value of width or height means flip. sCropRect[0] = 0; sCropRect[1] = height; sCropRect[2] = width; sCropRect[3] = -height; // Set texture parameters. int target = texture.getTarget(); mGL.glBindTexture(target, texture.getId()); mGL.glTexParameterfv(target, GL11Ext.GL_TEXTURE_CROP_RECT_OES, sCropRect, 0); mGL.glTexParameteri(target, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP_TO_EDGE); mGL.glTexParameteri(target, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP_TO_EDGE); mGL.glTexParameterf(target, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); mGL.glTexParameterf(target, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); }
Example #2
Source File: MatrixTrackingGL.java From PanoramaGL with Apache License 2.0 | 6 votes |
public MatrixTrackingGL(GL gl, GLSurfaceView glSurfaceView) { mgl = (GL10) gl; if (gl instanceof GL10Ext) { mgl10Ext = (GL10Ext) gl; } if (gl instanceof GL11) { mgl11 = (GL11) gl; } if (gl instanceof GL11Ext) { mgl11Ext = (GL11Ext) gl; } mGLSurfaceView = glSurfaceView; mModelView = new MatrixStack(); mProjection = new MatrixStack(); mTexture = new MatrixStack(); mCurrent = mModelView; mMatrixMode = GL10.GL_MODELVIEW; }
Example #3
Source File: GLWrapper.java From PanoramaGL with Apache License 2.0 | 6 votes |
/**init methods*/ public GLWrapper(GL gl, GLSurfaceView glSurfaceView) { mGL = (GL10)gl; if(gl instanceof GL10Ext) { mGL10Ext = (GL10Ext)gl; } if(gl instanceof GL11) { mGL11 = (GL11)gl; } if(gl instanceof GL11Ext) { mGL11Ext = (GL11Ext)gl; } if(gl instanceof GL11ExtensionPack) { mGL11ExtPack = (GL11ExtensionPack)gl; } mGLSurfaceView = glSurfaceView; }
Example #4
Source File: MatrixTrackingGL.java From panoramagl with Apache License 2.0 | 6 votes |
public MatrixTrackingGL(GL gl, GLSurfaceView glSurfaceView) { mgl = (GL10) gl; if (gl instanceof GL10Ext) { mgl10Ext = (GL10Ext) gl; } if (gl instanceof GL11) { mgl11 = (GL11) gl; } if (gl instanceof GL11Ext) { mgl11Ext = (GL11Ext) gl; } mGLSurfaceView = glSurfaceView; mModelView = new MatrixStack(); mProjection = new MatrixStack(); mTexture = new MatrixStack(); mCurrent = mModelView; mMatrixMode = GL10.GL_MODELVIEW; }
Example #5
Source File: GLWrapper.java From panoramagl with Apache License 2.0 | 6 votes |
/** * init methods */ public GLWrapper(GL gl, GLSurfaceView glSurfaceView) { mGL = (GL10) gl; if (gl instanceof GL10Ext) { mGL10Ext = (GL10Ext) gl; } if (gl instanceof GL11) { mGL11 = (GL11) gl; } if (gl instanceof GL11Ext) { mGL11Ext = (GL11Ext) gl; } if (gl instanceof GL11ExtensionPack) { mGL11ExtPack = (GL11ExtensionPack) gl; } mGLSurfaceView = glSurfaceView; }
Example #6
Source File: MatrixTrackingGL.java From codeexamples-android with Eclipse Public License 1.0 | 6 votes |
public MatrixTrackingGL(GL gl) { mgl = (GL10) gl; if (gl instanceof GL10Ext) { mgl10Ext = (GL10Ext) gl; } if (gl instanceof GL11) { mgl11 = (GL11) gl; } if (gl instanceof GL11Ext) { mgl11Ext = (GL11Ext) gl; } mModelView = new MatrixStack(); mProjection = new MatrixStack(); mTexture = new MatrixStack(); mCurrent = mModelView; mMatrixMode = GL10.GL_MODELVIEW; }
Example #7
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 #8
Source File: GLES11Canvas.java From PhotoMovie with Apache License 2.0 | 5 votes |
private void drawBoundTexture( BasicTexture texture, int x, int y, int width, int height) { // Test whether it has been rotated or flipped, if so, glDrawTexiOES // won't work if (isMatrixRotatedOrFlipped(mMatrixValues)) { if (texture.hasBorder()) { setTextureCoords( 1.0f / texture.getTextureWidth(), 1.0f / texture.getTextureHeight(), (texture.getWidth() - 1.0f) / texture.getTextureWidth(), (texture.getHeight() - 1.0f) / texture.getTextureHeight()); } else { setTextureCoords(0, 0, (float) texture.getWidth() / texture.getTextureWidth(), (float) texture.getHeight() / texture.getTextureHeight()); } textureRect(x, y, width, height); } else { // draw the rect from bottom-left to top-right float points[] = mapPoints( mMatrixValues, x, y + height, x + width, y); x = (int) (points[0] + 0.5f); y = (int) (points[1] + 0.5f); width = (int) (points[2] + 0.5f) - x; height = (int) (points[3] + 0.5f) - y; if (width > 0 && height > 0) { ((GL11Ext) mGL).glDrawTexiOES(x, y, 0, width, height); mCountTextureOES++; } } }
Example #9
Source File: LabelMaker.java From codeexamples-android with Eclipse Public License 1.0 | 5 votes |
/** * Draw a given label at a given x,y position, expressed in pixels, with the * lower-left-hand-corner of the view being (0,0). * * @param gl * @param x * @param y * @param labelID */ public void draw(GL10 gl, float x, float y, int labelID) { checkState(STATE_DRAWING, STATE_DRAWING); Label label = mLabels.get(labelID); gl.glEnable(GL10.GL_TEXTURE_2D); ((GL11)gl).glTexParameteriv(GL10.GL_TEXTURE_2D, GL11Ext.GL_TEXTURE_CROP_RECT_OES, label.mCrop, 0); ((GL11Ext)gl).glDrawTexiOES((int) x, (int) y, 0, (int) label.width, (int) label.height); }
Example #10
Source File: MatrixPaletteRenderer.java From codeexamples-android with Eclipse Public License 1.0 | 4 votes |
public void onDrawFrame(GL10 gl) { /* * By default, OpenGL enables features that improve quality * but reduce performance. One might want to tweak that * especially on software renderer. */ gl.glDisable(GL10.GL_DITHER); gl.glTexEnvx(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE, GL10.GL_MODULATE); /* * Usually, the first thing one might want to do is to clear * the screen. The most efficient way of doing this is to use * glClear(). */ gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glEnable(GL10.GL_DEPTH_TEST); gl.glEnable(GL10.GL_CULL_FACE); /* * Now we're ready to draw some 3D objects */ gl.glMatrixMode(GL10.GL_MODELVIEW); gl.glLoadIdentity(); GLU.gluLookAt(gl, 0, 0, -5, 0f, 0f, 0f, 0f, 1.0f, 0.0f); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); gl.glActiveTexture(GL10.GL_TEXTURE0); gl.glBindTexture(GL10.GL_TEXTURE_2D, mTextureID); gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_REPEAT); gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_REPEAT); long time = SystemClock.uptimeMillis() % 4000L; // Rock back and forth double animationUnit = ((double) time) / 4000; float unitAngle = (float) Math.cos(animationUnit * 2 * Math.PI); float angle = unitAngle * 135f; gl.glEnable(GL11Ext.GL_MATRIX_PALETTE_OES); gl.glMatrixMode(GL11Ext.GL_MATRIX_PALETTE_OES); GL11Ext gl11Ext = (GL11Ext) gl; // matrix 0: no transformation gl11Ext.glCurrentPaletteMatrixOES(0); gl11Ext.glLoadPaletteFromModelViewMatrixOES(); // matrix 1: rotate by "angle" gl.glRotatef(angle, 0, 0, 1.0f); gl11Ext.glCurrentPaletteMatrixOES(1); gl11Ext.glLoadPaletteFromModelViewMatrixOES(); mGrid.draw(gl); gl.glDisable(GL11Ext.GL_MATRIX_PALETTE_OES); }