本文整理匯總了Java中android.opengl.GLES20.glDisable方法的典型用法代碼示例。如果您正苦於以下問題:Java GLES20.glDisable方法的具體用法?Java GLES20.glDisable怎麽用?Java GLES20.glDisable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.opengl.GLES20
的用法示例。
在下文中一共展示了GLES20.glDisable方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: draw
import android.opengl.GLES20; //導入方法依賴的package包/類
private void draw(float[] matrix, FloatBuffer vertexBuffer, FloatBuffer uvBuffer, ShortBuffer drawListBuffer, short[] indices) {
texture.bindTexture(0);
GLES20.glEnable(GLES20.GL_BLEND_COLOR);
GLES20.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GLES20.glDepthMask(false);
int mPositionHandle = GLES20.glGetAttribLocation(SpriteKitGraphicTools.imageShaderProgram, "vPosition");
GLES20.glEnableVertexAttribArray(mPositionHandle);
GLES20.glVertexAttribPointer(mPositionHandle, 3,
GLES20.GL_FLOAT, false,
0, vertexBuffer);
int mTexCoordLoc = GLES20.glGetAttribLocation(SpriteKitGraphicTools.imageShaderProgram, "a_texCoord");
GLES20.glEnableVertexAttribArray(mTexCoordLoc);
GLES20.glVertexAttribPointer(mTexCoordLoc, 2, GLES20.GL_FLOAT,
false,
0, uvBuffer);
int mtrxhandle = GLES20.glGetUniformLocation(SpriteKitGraphicTools.imageShaderProgram, "uMVPMatrix");
GLES20.glUniformMatrix4fv(mtrxhandle, 1, false, matrix, 0);
int mSamplerLoc = GLES20.glGetUniformLocation(SpriteKitGraphicTools.imageShaderProgram, "s_texture");
GLES20.glUniform1i(mSamplerLoc, 0);
GLES20.glDrawElements(GLES20.GL_TRIANGLES, indices.length,
GLES20.GL_UNSIGNED_SHORT, drawListBuffer);
GLES20.glDisableVertexAttribArray(mPositionHandle);
GLES20.glDisableVertexAttribArray(mTexCoordLoc);
GLES20.glDisable(GLES20.GL_BLEND_COLOR);
}
示例2: draw
import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
public void draw(GL10 gl){
gl.glRotatef(45f,0,0,0);
GLES20.glFrontFace(GL10.GL_CCW);
GLES20.glEnable(GL10.GL_CULL_FACE);
GLES20.glCullFace(GL10.GL_BACK);
gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glVertexPointer(3, GL10.GL_FLOAT,0,mVertexBuffer);
gl.glColorPointer(4,GL10.GL_FIXED,0,mColorBuffer);
// gl.glDrawArrays(GL10.GL_TRIANGLES,0,3);
GLES20.glDrawElements(GL10.GL_TRIANGLES,indices.length,GL10.GL_UNSIGNED_SHORT,mIndexBuffer);
// gl.glDrawElements(GL10.GL_COLOR_ARRAY,colors.length,GL10.GL_FLOAT,mColorBuffer);
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
GLES20.glDisable(GL10.GL_CULL_FACE);
}
示例3: onDraw
import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
protected void onDraw() {
//todo change blend and viewport
super.onDraw();
if(markTextureId!=-1){
GLES20.glGetIntegerv(GLES20.GL_VIEWPORT,viewPort,0);
GLES20.glViewport(markPort[0],mHeight-markPort[3]-markPort[1],markPort[2],markPort[3]);
GLES20.glEnable(GLES20.GL_BLEND);
GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA,GLES20.GL_ONE_MINUS_SRC_ALPHA);
GLES20.glBlendEquation(GLES20.GL_FUNC_ADD);
mark.draw(markTextureId);
GLES20.glDisable(GLES20.GL_BLEND);
GLES20.glViewport(viewPort[0],viewPort[1],viewPort[2],viewPort[3]);
}
//todo reset blend and view port
}
示例4: onSurfaceCreated
import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
GLES20.glDisable(GL10.GL_DITHER);
GLES20.glClearColor(0,0,0,0);
GLES20.glEnable(GL10.GL_CULL_FACE);
GLES20.glEnable(GL10.GL_DEPTH_TEST);
MagicFilterParam.initMagicFilterParam(gl);
mImageInput.init();
}
示例5: onSurfaceCreated
import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
GLES20.glClearColor(0.5f, 0.5f, 0.5f, 1.0f);
mImageLR = new ImageLR(getContext());
GLES20.glEnable(GLES20.GL_DEPTH_TEST);
initTexture();
GLES20.glDisable(GLES20.GL_CULL_FACE);
}
示例6: glDisable
import android.opengl.GLES20; //導入方法依賴的package包/類
public static void glDisable(final int aCapability)
{
//.if DESKTOP
//|gl.glDisable(aCapability);
//.elseif ANDROID
GLES20.glDisable(aCapability);
//.endif
}
示例7: onSurfaceCreated
import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
GLES20.glDisable(GL10.GL_DITHER);
GLES20.glClearColor(0,0,0,0);
GLES20.glEnable(GL10.GL_CULL_FACE);
GLES20.glEnable(GL10.GL_DEPTH_TEST);
MagicFilterParam.initMagicFilterParam(gl);
mCameraInputFilter.init();
}
示例8: draw
import android.opengl.GLES20; //導入方法依賴的package包/類
void draw(MatrixManager matrixManager) {
if (checkRunOnDraw(matrixManager)) {
if (isVisible()) {
mIsCurrent.value(true);
GLES20.glDisable(GLES20.GL_CULL_FACE);
GLES20.glFrontFace(GLES20.GL_CCW);
if (mEnableDepthTest) {
GLES20.glEnable(GLES20.GL_DEPTH_TEST);
GLES20.glDepthFunc(GLES20.GL_LEQUAL);
GLES20.glDepthMask(true);
} else {
GLES20.glDisable(GLES20.GL_DEPTH_TEST);
}
if (mEnableBlend) {
GLES20.glEnable(GLES20.GL_BLEND);
GLES20.glBlendFunc(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
} else {
GLES20.glDisable(GLES20.GL_BLEND);
}
drawModel(matrixManager);
GLES20.glDisable(GLES20.GL_DEPTH_TEST);
GLES20.glDisable(GLES20.GL_BLEND);
mIsCurrent.value(false);
}
doUpdaterStartedAndStopped();
}
}
示例9: switchMode
import android.opengl.GLES20; //導入方法依賴的package包/類
public void switchMode()
{
mBlending = !mBlending;
if (mBlending)
{
// No culling of back faces
GLES20.glDisable(GLES20.GL_CULL_FACE);
// No depth testing
GLES20.glDisable(GLES20.GL_DEPTH_TEST);
// Enable blending
GLES20.glEnable(GLES20.GL_BLEND);
GLES20.glBlendFunc(GLES20.GL_ONE, GLES20.GL_ONE);
}
else
{
// Cull back faces
GLES20.glEnable(GLES20.GL_CULL_FACE);
// Enable depth testing
GLES20.glEnable(GLES20.GL_DEPTH_TEST);
// Disable blending
GLES20.glDisable(GLES20.GL_BLEND);
}
}
示例10: drawBox
import android.opengl.GLES20; //導入方法依賴的package包/類
/**
* Draws a box, with position offset.
*/
private void drawBox(int posn) {
final int width = mInputWindowSurface.getWidth();
int xpos = (posn * 4) % (width - 50);
GLES20.glEnable(GLES20.GL_SCISSOR_TEST);
GLES20.glScissor(xpos, 0, 100, 100);
GLES20.glClearColor(1.0f, 0.0f, 1.0f, 1.0f);
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
GLES20.glDisable(GLES20.GL_SCISSOR_TEST);
}
示例11: render
import android.opengl.GLES20; //導入方法依賴的package包/類
/**
* draws Quad shape object.
* @param aMVPMatrix
* @param texture
*/
public void render(float[] aMVPMatrix, final int texture) {
// // Use culling to remove back faces.
GLES20.glDisable(GLES20.GL_CULL_FACE);
// Set our per-vertex lighting program.
GLES20.glUseProgram(aQuadProgramHandle);
// Set program handles for cube drawing.
aMVPMatrixHandle = GLES20.glGetUniformLocation(aQuadProgramHandle, "u_MVPMatrix");
aPositionHandle = GLES20.glGetAttribLocation(aQuadProgramHandle, "a_Position");
aColorHandle = GLES20.glGetAttribLocation(aQuadProgramHandle, "a_Color");
aTextureCoordinateHandle = GLES20.glGetAttribLocation(aQuadProgramHandle, "a_TexCoordinate");
aTextureUniformHandle = GLES20.glGetUniformLocation(aQuadProgramHandle, "u_Texture");
// Pass in the combined matrix.
GLES20.glUniformMatrix4fv(aMVPMatrixHandle, 1, false, aMVPMatrix, 0);
if (qvbo[0] > 0 && qibo[0] > 0) {
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, qvbo[0]);
// Bind Attributes
GLES20.glVertexAttribPointer(aPositionHandle, POSITION_DATA_SIZE, GLES20.GL_FLOAT, false,
STRIDE, 0);
GLES20.glEnableVertexAttribArray(aPositionHandle);
GLES20.glVertexAttribPointer(aColorHandle, COLOR_DATA_SIZE, GLES20.GL_FLOAT, false,
STRIDE, (POSITION_DATA_SIZE) * BYTES_PER_FLOAT);
GLES20.glEnableVertexAttribArray(aColorHandle);
GLES20.glVertexAttribPointer(aTextureCoordinateHandle, UV_DATA_SIZE, GLES20.GL_FLOAT, false,
STRIDE, (POSITION_DATA_SIZE + COLOR_DATA_SIZE) * BYTES_PER_FLOAT);
GLES20.glEnableVertexAttribArray(aTextureCoordinateHandle);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texture);
GLES20.glUniform1f(aTextureUniformHandle, 0);
// Draw
GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, qibo[0]);
GLES20.glDrawElements(GLES20.GL_TRIANGLE_STRIP, indexCount, GLES20.GL_UNSIGNED_SHORT, 0);
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);
GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, 0);
}
// // Use culling to remove back faces.
// GLES20.glEnable(GLES20.GL_CULL_FACE);
}
示例12: draw
import android.opengl.GLES20; //導入方法依賴的package包/類
/**
* Draws the AR background image. The image will be drawn such that virtual content rendered
* with the matrices provided by {@link Frame#getViewMatrix(float[], int)} and
* {@link Session#getProjectionMatrix(float[], int, float, float)} will accurately follow
* static physical objects. This must be called <b>before</b> drawing virtual content.
*
* @param frame The last {@code Frame} returned by {@link Session#update()}.
*/
public void draw(Frame frame) {
// If display rotation changed (also includes view size change), we need to re-query the uv
// coordinates for the screen rect, as they may have changed as well.
if (frame.isDisplayRotationChanged()) {
frame.transformDisplayUvCoords(mQuadTexCoord, mQuadTexCoordTransformed);
}
// No need to test or write depth, the screen quad has arbitrary depth, and is expected
// to be drawn first.
GLES20.glDisable(GLES20.GL_DEPTH_TEST);
GLES20.glDepthMask(false);
GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, mTextureId);
GLES20.glUseProgram(mQuadProgram);
// Set the vertex positions.
GLES20.glVertexAttribPointer(
mQuadPositionParam, COORDS_PER_VERTEX, GLES20.GL_FLOAT, false, 0, mQuadVertices);
// Set the texture coordinates.
GLES20.glVertexAttribPointer(mQuadTexCoordParam, TEXCOORDS_PER_VERTEX,
GLES20.GL_FLOAT, false, 0, mQuadTexCoordTransformed);
// Enable vertex arrays
GLES20.glEnableVertexAttribArray(mQuadPositionParam);
GLES20.glEnableVertexAttribArray(mQuadTexCoordParam);
GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
// Disable vertex arrays
GLES20.glDisableVertexAttribArray(mQuadPositionParam);
GLES20.glDisableVertexAttribArray(mQuadTexCoordParam);
// Restore the depth state for further drawing.
GLES20.glDepthMask(true);
GLES20.glEnable(GLES20.GL_DEPTH_TEST);
ShaderUtil.checkGLError(TAG, "Draw");
}
示例13: render
import android.opengl.GLES20; //導入方法依賴的package包/類
public void render(float[] aMVPMatrix) {
// Use culling to remove back faces.
GLES20.glDisable(GLES20.GL_CULL_FACE);
// Set our per-vertex lighting program.
GLES20.glUseProgram(aProgramHandle);
// Set program handles for cube drawing.
aMVPMatrixHandle = GLES20.glGetUniformLocation(aProgramHandle, "u_MVPMatrix");
aMVMatrixHandle = GLES20.glGetUniformLocation(aProgramHandle, "u_MVMatrix");
aLightPosUniform = GLES20.glGetUniformLocation(aProgramHandle, "u_LightPos");
aPositionHandle = GLES20.glGetAttribLocation(aProgramHandle, "a_Position");
aNormalHandle = GLES20.glGetAttribLocation(aProgramHandle, "a_Normal");
aColorHandle = GLES20.glGetAttribLocation(aProgramHandle, "a_Color");
// Pass in the combined matrix.
GLES20.glUniformMatrix4fv(aMVPMatrixHandle, 1, false, aMVPMatrix, 0);
if (vbo[0] > 0 && ibo[0] > 0) {
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, vbo[0]);
// Bind Attributes
GLES20.glVertexAttribPointer(aPositionHandle, POSITION_DATA_SIZE, GLES20.GL_FLOAT, false,
STRIDE, 0);
GLES20.glEnableVertexAttribArray(aPositionHandle);
GLES20.glVertexAttribPointer(aNormalHandle, NORMAL_DATA_SIZE, GLES20.GL_FLOAT, false,
STRIDE, POSITION_DATA_SIZE * BYTES_PER_FLOAT);
GLES20.glEnableVertexAttribArray(aNormalHandle);
GLES20.glVertexAttribPointer(aColorHandle, COLOR_DATA_SIZE, GLES20.GL_FLOAT, false,
STRIDE, (POSITION_DATA_SIZE + NORMAL_DATA_SIZE) * BYTES_PER_FLOAT);
GLES20.glEnableVertexAttribArray(aColorHandle);
// Draw
GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, ibo[0]);
GLES20.glDrawElements(GLES20.GL_TRIANGLE_STRIP, indexCount, GLES20.GL_UNSIGNED_SHORT, 0);
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);
GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, 0);
}
// Use culling to remove back faces.
GLES20.glEnable(GLES20.GL_CULL_FACE);
}
示例14: render
import android.opengl.GLES20; //導入方法依賴的package包/類
/**
* draws Sphere objects
* @param aMVPMatrix
*/
public void render(float[] aMVPMatrix) {
if(BLENDING) {
// Enable blending
GLES20.glEnable(GLES20.GL_BLEND);
// GLES20.glBlendFuncSeparate(GLES20.GL_ONE_MINUS_SRC_COLOR, GLES20.GL_ONE_MINUS_DST_COLOR, GLES20.GL_ONE_MINUS_SRC_ALPHA, GLES20.GL_ONE_MINUS_DST_ALPHA);
GLES20.glBlendFunc( GLES20.GL_ONE_MINUS_SRC_ALPHA, GLES20.GL_ONE_MINUS_DST_ALPHA);
// GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
}
// Set our per-vertex lighting program.
GLES20.glUseProgram(aSphereProgramHandle);
int aSphereMVPMatrixHandle = GLES20.glGetUniformLocation(aSphereProgramHandle, "u_MVPMatrix");
int aSpherePositionHandle = GLES20.glGetAttribLocation(aSphereProgramHandle, "a_Position");
int aSphereColorHandle = GLES20.glGetAttribLocation(aSphereProgramHandle, "a_Color");
// Pass in the combined matrix.
//GLES20.glUniformMatrix4fv(aMVPMatrixHandle, 1, false, aMVPMatrix, 0);
GLES20.glUniformMatrix4fv(aSphereMVPMatrixHandle, 1, false, aMVPMatrix, 0);
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, aSpheresVerticesBufferIdx);
GLES20.glEnableVertexAttribArray(aSpherePositionHandle);
GLES20.glVertexAttribPointer(aSpherePositionHandle, POSITION_DATA_SIZE, GLES20.GL_FLOAT, false, 0, 0);
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, aSpheresColorsBufferIdx);
GLES20.glEnableVertexAttribArray(aSphereColorHandle);
GLES20.glVertexAttribPointer(aSphereColorHandle, COLOR_DATA_SIZE , GLES20.GL_FLOAT, false, 0, 0);
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);
// Draw the vertices.
GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, vertexCount);
// draw the vertices using indices
// GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, aSphereIndicesBufferIdx);
// GLES20.glDrawElements(GLES20.GL_TRIANGLE_STRIP, indexCount, GLES20.GL_UNSIGNED_SHORT, 0);
// Clear the currently bound buffer (so future OpenGL calls do not use this buffer).
// GLES20.glBindBuffer(GLES20.GL_ELEMENT_ARRAY_BUFFER, 0);
if(BLENDING) {
// Enable blending
GLES20.glDisable(GLES20.GL_BLEND);
// GLES20.glBlendFuncSeparate(GLES20.GL_ONE_MINUS_SRC_COLOR, GLES20.GL_ONE_MINUS_DST_COLOR, GLES20.GL_ONE_MINUS_SRC_ALPHA, GLES20.GL_ONE_MINUS_DST_ALPHA);
// GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
}
}
示例15: onDrawFrame
import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
public void onDrawFrame(GL10 unused) {
scroller.computeScrollOffset();
if (scroller.isFinished()) {
int lastX = scroller.getCurrX();
int modulo = lastX % 90;
int snapX = (lastX / 90) * 90;
if (modulo >= 45) snapX += 90;
if (modulo <- 45) snapX -= 90;
if (lastX != snapX) {
scroller.startScroll(lastX, 0, snapX - lastX, 0);
}
}
GLES20.glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
Matrix.setLookAtM(mViewMatrix, 0,
0, 0, -3,
0f, 0f, 0f,
0f, 1.0f, 0.0f);
Matrix.multiplyMM(mMVPMatrix, 0, mProjectionMatrix, 0, mViewMatrix, 0);
Matrix.rotateM(mMVPMatrix, 0, scroller.getCurrX(), 0.f, 1.f, 0.f);
Matrix.rotateM(mMVPMatrix, 0, 5.f, 1.f, 0.f, 0.f);
GLES20.glUseProgram(shaderProgram);
int positionHandle = GLES20.glGetAttribLocation(shaderProgram, "vPosition");
GLES20.glVertexAttribPointer(positionHandle, 3,
GLES20.GL_FLOAT, false,
0, vertexBuffer);
int colorHandle = GLES20.glGetAttribLocation(shaderProgram, "aColor");
GLES20.glVertexAttribPointer(colorHandle, 4,
GLES20.GL_FLOAT, false,
4 * 4, colorBuffer);
int mMVPMatrixHandle = GLES20.glGetUniformLocation(shaderProgram, "uMVPMatrix");
GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mMVPMatrix, 0);
GLES20.glEnable(GLES20.GL_DEPTH_TEST);
GLES20.glEnableVertexAttribArray(colorHandle);
GLES20.glEnableVertexAttribArray(positionHandle);
GLES20.glDrawElements(
GLES20.GL_TRIANGLES, index.length,
GLES20.GL_UNSIGNED_SHORT, indexBuffer);
GLES20.glDisableVertexAttribArray(positionHandle);
GLES20.glDisable(GLES20.GL_DEPTH_TEST);
}