List of usage examples for android.opengl GLES20 GL_COLOR_BUFFER_BIT
int GL_COLOR_BUFFER_BIT
To view the source code for android.opengl GLES20 GL_COLOR_BUFFER_BIT.
Click Source Link
From source file:helloopengles.example.com.MyGLRenderer.java
@Override public void onDrawFrame(GL10 unused) { float[] scratch = new float[16]; // Draw background color GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT); // Draw square mSquare.draw(mScale);/*from w w w. jav a 2 s .c o m*/ }
From source file:com.google.fpl.liquidfunpaint.renderer.ParticleRenderer.java
/** * Draw all the water particles, and save all the other particle groups * into a list. We draw these to temp mRenderSurface[0]. * @param dps/*w w w . j a v a 2 s .c o m*/ */ private void drawWaterParticles(DrawableParticleSystem dps) { // Draw all water particles to temp render surface 0 mRenderSurface[0].beginRender(GLES20.GL_COLOR_BUFFER_BIT); dps.renderWaterParticles(mWaterParticleMaterial, mPerspectiveTransform); mRenderSurface[0].endRender(); mBlurRenderer.draw(mRenderSurface[0].getTexture(), mRenderSurface[0]); }
From source file:com.google.fpl.liquidfunpaint.renderer.ParticleRenderer.java
/** * Draw all saved ParticleGroups to temp mRenderSurface[1]. * @param dps/*from w ww . j ava 2s .c o m*/ */ private void drawNonWaterParticles(DrawableParticleSystem dps) { // Draw all non-water particles to temp render surface 1 mRenderSurface[1].beginRender(GLES20.GL_COLOR_BUFFER_BIT); dps.renderNonWaterParticles(mParticleMaterial, mPerspectiveTransform); mRenderSurface[1].endRender(); mBlurRenderer.draw(mRenderSurface[1].getTexture(), mRenderSurface[1]); }
From source file:com.dmitrybrant.android.cardboardmpo.MainActivity.java
@Override public void onDrawEye(Eye eye) { GLES20.glDisable(GLES20.GL_DEPTH_TEST); GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT); // Apply the eye transformation to the camera. Matrix.multiplyMM(view, 0, eye.getEyeView(), 0, camera, 0); // TODO: Do something with the head transform (e.g. pan the photo around) // For now, just reset the view matrix, so that the photo is in the center at all times. Matrix.setIdentityM(view, 0);/*from www .ja va 2 s. c om*/ float[] perspective = eye.getPerspective(Z_NEAR, Z_FAR); if (eye.getType() == 1) { Matrix.multiplyMM(modelView, 0, view, 0, rectLeftEye.getModelMatrix(), 0); Matrix.multiplyMM(modelViewProjection, 0, perspective, 0, modelView, 0); rectLeftEye.draw(modelViewProjection); } else { Matrix.multiplyMM(modelView, 0, view, 0, rectRightEye.getModelMatrix(), 0); Matrix.multiplyMM(modelViewProjection, 0, perspective, 0, modelView, 0); rectRightEye.draw(modelViewProjection); } }
From source file:com.google.fpl.liquidfunpaint.renderer.PhysicsLoop.java
@Override public void onDrawFrame(GL10 gl) { if (mSimulation) { setChanged();//from www.jav a2 s . com notifyObservers(); GLES20.glClearColor(1, 1, 1, 1); GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); // Draw particles showFrameRate(); mWorldLock.lock(); try { drawBackgroundTexture(); mWorldLock.stepWorld(); mParticleRenderer.onDrawFrame(gl); mSolidWorld.onDrawFrame(gl); if (DEBUG_DRAW) { mDebugRenderer.onDrawFrame(gl); } } finally { mWorldLock.unlock(); } } }
From source file:com.google.fpl.liquidfunpaint.ParticleRenderer.java
/** * Draw all the water particles, and save all the other particle groups * into a list. We draw these to temp mRenderSurface[0]. *//* w w w. j a v a 2s . c o m*/ private void drawWaterParticles() { // Draw all water particles to temp render surface 0 mRenderSurface[0].beginRender(GLES20.GL_COLOR_BUFFER_BIT); mWaterParticleMaterial.beginRender(); // Set attribute arrays mWaterParticleMaterial.setVertexAttributeBuffer("aPosition", mParticlePositionBuffer, 0); mWaterParticleMaterial.setVertexAttributeBuffer("aColor", mParticleColorBuffer, 0); mWaterParticleMaterial.setVertexAttributeBuffer("aWeight", mParticleWeightBuffer, 0); // Set uniforms GLES20.glUniformMatrix4fv(mWaterParticleMaterial.getUniformLocation("uTransform"), 1, false, mTransformFromWorld, 0); // Go through each particle group ParticleSystem ps = Renderer.getInstance().acquireParticleSystem(); try { ParticleGroup currGroup = ps.getParticleGroupList(); while (currGroup != null) { // Only draw water particles in this pass; queue other groups if (currGroup.getGroupFlags() == Tool.getTool(Tool.ToolType.WATER).getParticleGroupFlags()) { drawParticleGroup(currGroup); } else { mParticleRenderList.add(currGroup); } currGroup = currGroup.getNext(); } } finally { Renderer.getInstance().releaseParticleSystem(); } mWaterParticleMaterial.endRender(); mRenderSurface[0].endRender(); mBlurRenderer.draw(mRenderSurface[0].getTexture(), mRenderSurface[0]); }
From source file:com.google.fpl.liquidfunpaint.ParticleRenderer.java
/** * Draw all saved ParticleGroups to temp mRenderSurface[1]. *//* ww w . j a va2 s.c o m*/ private void drawNonWaterParticles() { // Draw all non-water particles to temp render surface 1 mRenderSurface[1].beginRender(GLES20.GL_COLOR_BUFFER_BIT); mParticleMaterial.beginRender(); // Set attribute arrays mParticleMaterial.setVertexAttributeBuffer("aPosition", mParticlePositionBuffer, 0); mParticleMaterial.setVertexAttributeBuffer("aColor", mParticleColorBuffer, 0); // Set uniforms GLES20.glUniformMatrix4fv(mParticleMaterial.getUniformLocation("uTransform"), 1, false, mTransformFromWorld, 0); ParticleSystem ps = Renderer.getInstance().acquireParticleSystem(); try { // Go through all the particleGroups in the render list for (ParticleGroup currGroup : mParticleRenderList) { drawParticleGroup(currGroup); } } finally { Renderer.getInstance().releaseParticleSystem(); } mParticleMaterial.endRender(); mRenderSurface[1].endRender(); mBlurRenderer.draw(mRenderSurface[1].getTexture(), mRenderSurface[1]); }
From source file:com.wlanjie.streaming.camera.CameraView.java
@Override public void onDrawFrame(GL10 gl) { GLES20.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT); mSurfaceTexture.updateTexImage();/*from ww w .jav a2s . c om*/ mSurfaceTexture.getTransformMatrix(mSurfaceMatrix); Matrix.multiplyMM(mTransformMatrix, 0, mSurfaceMatrix, 0, mProjectionMatrix, 0); mEglCore.setTextureTransformMatrix(mTransformMatrix); mEglCore.onDrawFrame(mTextureId); mHandler.sendEmptyMessage(0); }
From source file:com.watabou.noosa.Game.java
@Override public void onDrawFrame(GL10 gl) { if (instance() == null || width() == 0 || height() == 0) { return;//from w w w . j a v a 2 s .c o m } if (paused) { GLES20.glScissor(0, 0, width(), height()); GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); return; } SystemTime.tick(); long rightNow = SystemTime.now(); step = (now == 0 ? 0 : rightNow - now); now = rightNow; step(); NoosaScript.get().resetCamera(); GLES20.glScissor(0, 0, width(), height()); GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); draw(); }
From source file:com.kentdisplays.synccardboarddemo.MainActivity.java
/** * Draws a frame for an eye. The transformation for that eye (from the camera) is passed in as * a parameter.// ww w . j a v a 2 s .co m * @param transform The transformations to apply to render this eye. */ @Override public void onDrawEye(EyeTransform transform) { GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT); GLES20.glClearColor(0f, 0f, 0f, 1.00f); // Dark background so text shows up well mPositionParam = GLES20.glGetAttribLocation(mGlProgram, "a_Position"); mNormalParam = GLES20.glGetAttribLocation(mGlProgram, "a_Normal"); mColorParam = GLES20.glGetAttribLocation(mGlProgram, "a_Color"); GLES20.glEnableVertexAttribArray(mPositionParam); GLES20.glEnableVertexAttribArray(mNormalParam); GLES20.glEnableVertexAttribArray(mColorParam); checkGLError("mColorParam"); // Apply the eye transformation to the camera. Matrix.multiplyMM(mView, 0, transform.getEyeView(), 0, mCamera, 0); // Set the position of the light Matrix.multiplyMV(mLightPosInEyeSpace, 0, mView, 0, mLightPosInWorldSpace, 0); GLES20.glUniform3f(mLightPosParam, mLightPosInEyeSpace[0], mLightPosInEyeSpace[1], mLightPosInEyeSpace[2]); // Draw the pages. for (Page page : mPages) { page.draw(transform.getPerspective(), mView); checkGLError("Drawing page"); } // Set mModelView for the floor, so we draw floor in the correct location Matrix.multiplyMM(mModelView, 0, mView, 0, mModelFloor, 0); Matrix.multiplyMM(mModelViewProjection, 0, transform.getPerspective(), 0, mModelView, 0); drawFloor(transform.getPerspective()); }