Java Code Examples for javax.microedition.khronos.opengles.GL10#glDisableClientState()
The following examples show how to use
javax.microedition.khronos.opengles.GL10#glDisableClientState() .
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: CubeMapActivity.java From codeexamples-android with Eclipse Public License 1.0 | 6 votes |
public void draw(GL10 gl) { checkGLError(gl); GL11 gl11 = (GL11) gl; gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, mVertexBufferObjectId); gl11.glVertexPointer(3, GL10.GL_FLOAT, VERTEX_SIZE, 0); gl.glEnableClientState(GL10.GL_NORMAL_ARRAY); gl11.glNormalPointer(GL10.GL_FLOAT, VERTEX_SIZE, VERTEX_NORMAL_BUFFER_INDEX_OFFSET * FLOAT_SIZE); 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(GL10.GL_NORMAL_ARRAY); gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, 0); gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, 0); checkGLError(gl); }
Example 2
Source File: FftVisualizerSurfaceView.java From android-openslmediaplayer with Apache License 2.0 | 6 votes |
private static void drawFFT( GL10 gl, int width, int height, FloatBuffer vertices, int n, float yrange, FloatColor color) { gl.glPushMatrix(); // viewport gl.glViewport(0, 0, width, height); // X: [0:1], Y: [0:yrange] gl.glOrthof(0.0f, 1.0f, 0.0f, yrange, -1.0f, 1.0f); gl.glColor4f(color.red, color.green, color.blue, color.alpha); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glVertexPointer(2, GL10.GL_FLOAT, (2 * Float.SIZE / 8), vertices); gl.glDrawArrays(GL10.GL_LINE_STRIP, 0, n); gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glPopMatrix(); }
Example 3
Source File: HQWaveformVisualizerSurfaceView.java From android-openslmediaplayer with Apache License 2.0 | 6 votes |
private static void drawWaveForm( GL10 gl, int width, int height, FloatBuffer vertices, int n, int vposition, float yrange, FloatColor color) { gl.glPushMatrix(); // viewport gl.glViewport(0, (height / 2) * (1 - vposition), width, (height / 2)); // X: [0:1], Y: [-1:+1] (scaled) gl.glOrthof(0.0f, 1.0f, -yrange, yrange, -1.0f, 1.0f); gl.glColor4f(color.red, color.green, color.blue, color.alpha); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glVertexPointer(2, GL10.GL_FLOAT, (2 * Float.SIZE / 8), vertices); gl.glDrawArrays(GL10.GL_LINE_STRIP, 0, n); gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glPopMatrix(); }
Example 4
Source File: HQFftVisualizerSurfaceView.java From android-openslmediaplayer with Apache License 2.0 | 6 votes |
private static void drawFFT( GL10 gl, int width, int height, FloatBuffer vertices, int n, int vposition, float yrange, FloatColor color) { gl.glPushMatrix(); // viewport gl.glViewport(0, (height / 2) * (1 - vposition), width, (height / 2)); // X: [0:1], Y: [0:1] gl.glOrthof(0.0f, 1.0f, 0.0f, yrange, -1.0f, 1.0f); gl.glColor4f(color.red, color.green, color.blue, color.alpha); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glVertexPointer(2, GL10.GL_FLOAT, (2 * Float.SIZE / 8), vertices); gl.glDrawArrays(GL10.GL_LINE_STRIP, 0, n); gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glPopMatrix(); }
Example 5
Source File: WaveformVisualizerSurfaceView.java From android-openslmediaplayer with Apache License 2.0 | 6 votes |
private static void drawWaveForm( GL10 gl, int width, int height, FloatBuffer vertices, int n, float ymin, float ymax, FloatColor color) { gl.glPushMatrix(); // viewport gl.glViewport(0, 0, width, height); // X: [0:1], Y: [ymin:ymax] gl.glOrthof(0.0f, 1.0f, ymin, ymax, -1.0f, 1.0f); gl.glColor4f(color.red, color.green, color.blue, color.alpha); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glVertexPointer(2, GL10.GL_FLOAT, (2 * Float.SIZE / 8), vertices); gl.glDrawArrays(GL10.GL_LINE_STRIP, 0, n); gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glPopMatrix(); }
Example 6
Source File: TexCubeSmallGLUT.java From opengl with Apache License 2.0 | 5 votes |
void draw(GL10 gl) { if (texEnabled) { gl.glEnable(GL10.GL_TEXTURE_2D); gl.glBindTexture(GL10.GL_TEXTURE_2D, mTextureID); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, mCoordBuffer); } super.draw(gl); if (texEnabled) { gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); gl.glDisable(GL10.GL_TEXTURE_2D); } }
Example 7
Source File: FrameBufferObjectActivity.java From codeexamples-android with Eclipse Public License 1.0 | 5 votes |
private void drawOffscreenImage(GL10 gl, int width, int height) { gl.glViewport(0, 0, width, height); float ratio = (float) width / height; gl.glMatrixMode(GL10.GL_PROJECTION); gl.glLoadIdentity(); gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10); gl.glEnable(GL10.GL_CULL_FACE); gl.glEnable(GL10.GL_DEPTH_TEST); gl.glClearColor(0,0.5f,1,0); gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glMatrixMode(GL10.GL_MODELVIEW); gl.glLoadIdentity(); gl.glTranslatef(0, 0, -3.0f); gl.glRotatef(mAngle, 0, 1, 0); gl.glRotatef(mAngle*0.25f, 1, 0, 0); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_COLOR_ARRAY); mCube.draw(gl); gl.glRotatef(mAngle*2.0f, 0, 1, 1); gl.glTranslatef(0.5f, 0.5f, 0.5f); mCube.draw(gl); mAngle += 1.2f; // Restore default state so the other renderer is not affected. gl.glDisable(GL10.GL_CULL_FACE); gl.glDisable(GL10.GL_DEPTH_TEST); gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisableClientState(GL10.GL_COLOR_ARRAY); }
Example 8
Source File: TexCubeSmallGLUT.java From opengl with Apache License 2.0 | 5 votes |
void draw(GL10 gl) { if (texEnabled) { gl.glEnable(GL10.GL_TEXTURE_2D); gl.glBindTexture(GL10.GL_TEXTURE_2D, mTextureID); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, mCoordBuffer); } super.draw(gl); if (texEnabled) { gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); gl.glDisable(GL10.GL_TEXTURE_2D); } }
Example 9
Source File: Square.java From opengl with Apache License 2.0 | 5 votes |
/** * This function draws our square on screen. * @param gl */ public void draw(GL10 gl) { //set a color other then white, which is blue/purple gl.glColor4f(0.5f, 0.5f, 1.0f, 1.0f); // 0x8080FFFF // Counter-clockwise winding. gl.glFrontFace(GL10.GL_CCW); // OpenGL docs // Enable face culling. gl.glEnable(GL10.GL_CULL_FACE); // OpenGL docs // What faces to remove with the face culling. gl.glCullFace(GL10.GL_BACK); // OpenGL docs // Enabled the vertices buffer for writing and to be used during // rendering. gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);// OpenGL docs. // Specifies the location and data format of an array of vertex // coordinates to use when rendering. gl.glVertexPointer(3, GL10.GL_FLOAT, 0, // OpenGL docs vertexBuffer); gl.glDrawElements(GL10.GL_TRIANGLES, indices.length,// OpenGL docs GL10.GL_UNSIGNED_SHORT, indexBuffer); // Disable the vertices buffer. gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); // OpenGL docs // Disable face culling. gl.glDisable(GL10.GL_CULL_FACE); // OpenGL docs }
Example 10
Source File: PLHotspot.java From PanoramaGL with Apache License 2.0 | 5 votes |
/**render methods*/ @Override protected void internalRender(GL10 gl, PLIRenderer renderer) { this.calculateCoords(gl); List<PLITexture> textures = this.getTextures(); int textureId = (textures.size() > 0 ? textures.get(0).getTextureId(gl) : 0); if(textureId == 0 || mVertexsBuffer == null || mTextureCoordsBuffer == null) return; gl.glEnable(GL10.GL_TEXTURE_2D); PLIView view = renderer.getInternalView(); gl.glColor4f(1.0f, 1.0f, 1.0f, (view != null && view.isValidForTransition()) || this.getTouchStatus() == PLSceneElementTouchStatus.PLSceneElementTouchStatusOut ? this.getAlpha() : mOverAlpha); gl.glVertexPointer(3, GL10.GL_FLOAT, 0, mVertexsBuffer); gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, mTextureCoordsBuffer); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); gl.glEnable(GL10.GL_CULL_FACE); gl.glCullFace(GL10.GL_FRONT); gl.glShadeModel(GL10.GL_SMOOTH); gl.glBindTexture(GL10.GL_TEXTURE_2D, textureId); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4); gl.glDisable(GL10.GL_TEXTURE_2D); gl.glDisable(GL10.GL_BLEND); gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); }
Example 11
Source File: FrameBufferObjectActivity.java From codeexamples-android with Eclipse Public License 1.0 | 5 votes |
private void drawOnscreen(GL10 gl, int width, int height) { gl.glViewport(0, 0, width, height); float ratio = (float) width / height; gl.glMatrixMode(GL10.GL_PROJECTION); gl.glLoadIdentity(); gl.glFrustumf(-ratio, ratio, -1, 1, 3, 7); gl.glClearColor(0,0,1,0); gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glBindTexture(GL10.GL_TEXTURE_2D, mTargetTexture); gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE, GL10.GL_REPLACE); 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); long time = SystemClock.uptimeMillis() % 4000L; float angle = 0.090f * ((int) time); gl.glRotatef(angle, 0, 0, 1.0f); mTriangle.draw(gl); // Restore default state so the other renderer is not affected. gl.glBindTexture(GL10.GL_TEXTURE_2D, 0); gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); }
Example 12
Source File: Utils.java From RobotCA with GNU General Public License v3.0 | 5 votes |
/** * Draws the contents of the specified buffer. * * @param gl GL10 object for drawing * @param vertices FloatBuffer of vertices to draw * @param size Size of draw points * @param fan If true, draws the buffer as a triangle fan, otherwise draws it as a point cloud */ public static void drawPoints(GL10 gl, FloatBuffer vertices, float size, boolean fan) { vertices.mark(); if (!fan) gl.glPointSize(size); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_COLOR_ARRAY); gl.glVertexPointer(3, GL10.GL_FLOAT, (3 + 4) * 4, vertices); FloatBuffer colors = vertices.duplicate(); colors.position(fan ? 3 : 10); gl.glColorPointer(4, GL10.GL_FLOAT, (3 + 4) * 4, colors); gl.glDrawArrays(fan ? GL10.GL_TRIANGLE_FAN : GL10.GL_POINTS, 0, countVertices(vertices, 3 + 4)); if (!fan) { gl.glDrawArrays(GL10.GL_POINTS, 0, countVertices(vertices, 3 + 4)); } gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisableClientState(GL10.GL_COLOR_ARRAY); vertices.reset(); }
Example 13
Source File: Utils.java From RobotCA with GNU General Public License v3.0 | 5 votes |
/** * Draws a point. * @param gl The GL10 object for drawing * @param x The point's x coordinate * @param y The point's y coordinate * @param color The color in the form 0xAARRGGBB */ public static void drawPoint(GL10 gl, float x, float y, float size, int color) { fb.rewind(); fb.put(x); // x fb.put(y); // y fb.put(0.0f); // z fb.put(Color.red(color) / 255.0f); // r fb.put(Color.green(color) / 255.0f); // g fb.put(Color.blue(color) / 255.0f); // b fb.put(Color.alpha(color) / 255.0f); // a fb.rewind(); gl.glPointSize(size); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_COLOR_ARRAY); gl.glVertexPointer(3, GL10.GL_FLOAT, (3 + 4) * 4, fb); FloatBuffer colors = fb.duplicate(); colors.position(3); gl.glColorPointer(4, GL10.GL_FLOAT, (3 + 4) * 4, colors); gl.glDrawArrays(GL10.GL_POINTS, 0, 1); gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisableClientState(GL10.GL_COLOR_ARRAY); }
Example 14
Source File: Page.java From PlayLikeCurl with MIT License | 4 votes |
public void draw(GL10 gl,Context context) { if(needtextureupdate) { needtextureupdate=false; loadGLTexture(gl, context); } calculateVerticesCoords(); gl.glBindTexture(GL10.GL_TEXTURE_2D, textures[0]); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); gl.glFrontFace(GL10.GL_CCW); gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer); gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, textureBuffer); gl.glDrawElements(GL10.GL_TRIANGLES, indices.length, GL10.GL_UNSIGNED_SHORT, indexBuffer); gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); }
Example 15
Source File: GLRender.java From LiveBlurListView with Apache License 2.0 | 4 votes |
private void process(Bitmap bitmap, boolean fast) { final GL10 gl = mGL; gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); gl.glShadeModel(GL10.GL_SMOOTH); gl.glEnable(GL10.GL_DEPTH_TEST); gl.glClearDepthf(1.0f); gl.glDepthFunc(GL10.GL_LEQUAL); gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST); gl.glEnable(GL10.GL_TEXTURE_2D); gl.glEnable(GL10.GL_LEQUAL); float[] color = new float[16]; FloatBuffer colorBuffer; float[] texVertex = new float[12]; FloatBuffer vertexBuffer; ByteBuffer texByteBuffer = ByteBuffer.allocateDirect(texVertex.length * 4); texByteBuffer.order(ByteOrder.nativeOrder()); vertexBuffer = texByteBuffer.asFloatBuffer(); vertexBuffer.put(texVertex); vertexBuffer.position(0); ByteBuffer colorByteBuffer = ByteBuffer.allocateDirect(color.length * 4); colorByteBuffer.order(ByteOrder.nativeOrder()); colorBuffer = colorByteBuffer.asFloatBuffer(); colorBuffer.put(color); colorBuffer.position(0); gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glPushMatrix(); gl.glTranslatef(0.0f, 0.0f, 0.0f); colorBuffer.clear(); colorBuffer.put(1.0f); colorBuffer.put(0.0f); colorBuffer.put(0.0f); colorBuffer.put(1.0f); colorBuffer.put(1.0f); colorBuffer.put(0.0f); colorBuffer.put(0.0f); colorBuffer.put(1.0f); colorBuffer.put(1.0f); colorBuffer.put(0.0f); colorBuffer.put(0.0f); colorBuffer.put(1.0f); colorBuffer.put(1.0f); colorBuffer.put(0.0f); colorBuffer.put(0.0f); colorBuffer.put(1.0f); vertexBuffer.clear(); vertexBuffer.put(0); vertexBuffer.put(0); vertexBuffer.put(0); vertexBuffer.put(5f); vertexBuffer.put(0); vertexBuffer.put(0); vertexBuffer.put(5f); vertexBuffer.put(5f); vertexBuffer.put(0); vertexBuffer.put(0); vertexBuffer.put(5f); vertexBuffer.put(0); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_COLOR_ARRAY); gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer); gl.glColorPointer(4, GL10.GL_FLOAT, 0, colorBuffer); gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, 4); gl.glDisableClientState(GL10.GL_COLOR_ARRAY); gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glPopMatrix(); }
Example 16
Source File: PLCubicPanorama.java From panoramagl with Apache License 2.0 | 4 votes |
/** * render methods */ @Override protected void internalRender(GL10 gl, PLIRenderer renderer) { gl.glEnable(GL10.GL_TEXTURE_2D); gl.glEnable(GL10.GL_CULL_FACE); gl.glCullFace(GL10.GL_FRONT); gl.glShadeModel(GL10.GL_SMOOTH); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); gl.glVertexPointer(3, GL10.GL_FLOAT, 0, sCubeBuffer); gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, sTextureCoordsBuffer); // Front Face if (this.bindTextureByIndex(gl, PLConstants.kCubeFrontFaceIndex)) { gl.glNormal3f(0.0f, 0.0f, 1.0f); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4); } // Back Face if (this.bindTextureByIndex(gl, PLConstants.kCubeBackFaceIndex)) { gl.glNormal3f(0.0f, 0.0f, -1.0f); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 4, 4); } // Left Face if (this.bindTextureByIndex(gl, PLConstants.kCubeLeftFaceIndex)) { gl.glNormal3f(1.0f, 0.0f, 0.0f); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 8, 4); } // Right Face if (this.bindTextureByIndex(gl, PLConstants.kCubeRightFaceIndex)) { gl.glNormal3f(-1.0f, 0.0f, 0.0f); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 12, 4); } // Up Face if (this.bindTextureByIndex(gl, PLConstants.kCubeUpFaceIndex)) { gl.glNormal3f(0.0f, 1.0f, 0.0f); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 16, 4); } // Down Face if (this.bindTextureByIndex(gl, PLConstants.kCubeDownFaceIndex)) { gl.glNormal3f(0.0f, -1.0f, 0.0f); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 20, 4); } gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); gl.glDisable(GL10.GL_CULL_FACE); gl.glDisable(GL10.GL_TEXTURE_2D); }
Example 17
Source File: PLCubicPanorama.java From PanoramaGL with Apache License 2.0 | 4 votes |
/**render methods*/ @Override protected void internalRender(GL10 gl, PLIRenderer renderer) { gl.glEnable(GL10.GL_TEXTURE_2D); gl.glEnable(GL10.GL_CULL_FACE); gl.glCullFace(GL10.GL_FRONT); gl.glShadeModel(GL10.GL_SMOOTH); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY); gl.glVertexPointer(3, GL10.GL_FLOAT, 0, sCubeBuffer); gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, sTextureCoordsBuffer); // Front Face if(this.bindTextureByIndex(gl, PLConstants.kCubeFrontFaceIndex)) { gl.glNormal3f(0.0f, 0.0f, 1.0f); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, 4); } // Back Face if(this.bindTextureByIndex(gl, PLConstants.kCubeBackFaceIndex)) { gl.glNormal3f(0.0f, 0.0f, -1.0f); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 4, 4); } // Left Face if(this.bindTextureByIndex(gl, PLConstants.kCubeLeftFaceIndex)) { gl.glNormal3f(1.0f, 0.0f, 0.0f); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 8, 4); } // Right Face if(this.bindTextureByIndex(gl, PLConstants.kCubeRightFaceIndex)) { gl.glNormal3f(-1.0f, 0.0f, 0.0f); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 12, 4); } // Up Face if(this.bindTextureByIndex(gl, PLConstants.kCubeUpFaceIndex)) { gl.glNormal3f(0.0f, 1.0f, 0.0f); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 16, 4); } // Down Face if(this.bindTextureByIndex(gl, PLConstants.kCubeDownFaceIndex)) { gl.glNormal3f(0.0f, -1.0f, 0.0f); gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 20, 4); } gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY); gl.glDisable(GL10.GL_CULL_FACE); gl.glDisable(GL10.GL_TEXTURE_2D); }
Example 18
Source File: TriangleSmallGLUT.java From opengl with Apache License 2.0 | 4 votes |
void drawColorful(GL10 gl) { gl.glEnableClientState(GL10.GL_COLOR_ARRAY); gl.glColorPointer(4,GL10.GL_FLOAT, 0, mColorBuffer); draw(gl); gl.glDisableClientState(GL10.GL_COLOR_ARRAY); }
Example 19
Source File: Graph3DRenderer.java From ncalc with GNU General Public License v3.0 | 4 votes |
@Override public void onDrawFrame(GL10 gl) { gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); gl.glMatrixMode(GL10.GL_MODELVIEW); gl.glLoadIdentity(); gl.glTranslatef(0, 0, -3.0f); gl.glRotatef(gamma, 0, 1f, 0); gl.glRotatef(alpha, 1f, 1f, 0); gl.glRotatef(beta, 0, 0, 1f); gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); if (dirty) { setUpArray(); dirty = false; } gl.glLineWidth(1.0f); for (int k = 0; k < functions.size(); k++) { int colors[] = Graph2DView.colors[k]; gl.glColor4f((float) colors[0] / 255, (float) colors[1] / 255, (float) colors[2], 1); for (int i = 0; i <= 30; i++) { vertexBuffer[k][i][1].position(0); gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer[k][i][0]); gl.glDrawArrays(GL10.GL_LINE_STRIP, 0, 31); vertexBuffer[k][i][1].position(0); gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer[k][i][1]); gl.glDrawArrays(GL10.GL_LINE_STRIP, 0, 31); } } gl.glLineWidth(3.0f); gl.glColor4f(1, 1, 1, 1); axisBuffer.position(0); gl.glVertexPointer(3, GL10.GL_FLOAT, 0, axisBuffer); gl.glDrawArrays(GL10.GL_LINE_STRIP, 0, axis.length); gl.glRotatef(gamma * 2.0f, 0, 0, 1); gl.glTranslatef(0.5f, 0.5f, 0.5f); gl.glDisableClientState(GL10.GL_VERTEX_ARRAY); long newSeconds = System.currentTimeMillis(); if (!userRotate) { gamma += .04f * (newSeconds - milliseconds); } milliseconds = newSeconds; }
Example 20
Source File: TriangleSmallGLUT.java From opengl with Apache License 2.0 | 4 votes |
void drawColorful(GL10 gl) { gl.glEnableClientState(GL10.GL_COLOR_ARRAY); gl.glColorPointer(4,GL10.GL_FLOAT, 0, mColorBuffer); draw(gl); gl.glDisableClientState(GL10.GL_COLOR_ARRAY); }