當前位置: 首頁>>代碼示例>>Java>>正文


Java GLES20.glFlush方法代碼示例

本文整理匯總了Java中android.opengl.GLES20.glFlush方法的典型用法代碼示例。如果您正苦於以下問題:Java GLES20.glFlush方法的具體用法?Java GLES20.glFlush怎麽用?Java GLES20.glFlush使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.opengl.GLES20的用法示例。


在下文中一共展示了GLES20.glFlush方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onDraw

import android.opengl.GLES20; //導入方法依賴的package包/類
public void onDraw(final int textureId, final FloatBuffer cubeBuffer, final FloatBuffer textureBuffer) {
    if (!mIsInitialized) {
        return;
    }

    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
    GLES20.glUseProgram(mGLProgId);

    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, textureId);
    GLES20.glUniform1i(mGLUniformTexture, 0);

    GLES20.glVertexAttribPointer(mGLAttribPosition, 2, GLES20.GL_FLOAT, false, 0, cubeBuffer);
    GLES20.glVertexAttribPointer(mGLAttribTextureCoordinate, 2, GLES20.GL_FLOAT, false, 0, textureBuffer);
    GLES20.glEnableVertexAttribArray(mGLAttribPosition);
    GLES20.glEnableVertexAttribArray(mGLAttribTextureCoordinate);

    GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
    GLES20.glFlush();
}
 
開發者ID:vipycm,項目名稱:mao-android,代碼行數:21,代碼來源:CameraFilter.java

示例2: drawTex

import android.opengl.GLES20; //導入方法依賴的package包/類
private void drawTex(int tex, boolean isOES, int fbo)
{
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fbo);

    if(fbo == 0)
        GLES20.glViewport(0, 0, mView.getWidth(), mView.getHeight());
    else
        GLES20.glViewport(0, 0, mFBOWidth, mFBOHeight);

    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);

    if(isOES) {
        GLES20.glUseProgram(progOES);
        GLES20.glVertexAttribPointer(vPosOES, 2, GLES20.GL_FLOAT, false, 4*2, vert);
        GLES20.glVertexAttribPointer(vTCOES,  2, GLES20.GL_FLOAT, false, 4*2, texOES);
    } else {
        GLES20.glUseProgram(prog2D);
        GLES20.glVertexAttribPointer(vPos2D, 2, GLES20.GL_FLOAT, false, 4*2, vert);
        GLES20.glVertexAttribPointer(vTC2D,  2, GLES20.GL_FLOAT, false, 4*2, tex2D);
    }

    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);

    if(isOES) {
        GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, tex);
        GLES20.glUniform1i(GLES20.glGetUniformLocation(progOES, "sTexture"), 0);
    } else {
        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, tex);
        GLES20.glUniform1i(GLES20.glGetUniformLocation(prog2D, "sTexture"), 0);
    }

    GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);
    GLES20.glFlush();
}
 
開發者ID:yippeesoft,項目名稱:NotifyTools,代碼行數:35,代碼來源:CameraGLRendererBase.java

示例3: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
public void draw(final int textureId, final FloatBuffer cubeBuffer,
                   final FloatBuffer textureBuffer) {
    GLES20.glUseProgram(mGLProgId);
    runPendingOnDrawTasks();
    if (!mIsInitialized) {
        return;
    }
    cubeBuffer.position(0);
    GLES20.glVertexAttribPointer(mGLAttribPosition, 3, GLES20.GL_FLOAT, false, 0, cubeBuffer);
    GLES20.glEnableVertexAttribArray(mGLAttribPosition);

    textureBuffer.position(0);
    GLES20.glVertexAttribPointer(mGLAttribTextureCoordinate, 2, GLES20.GL_FLOAT, false, 0,
            textureBuffer);
    GLES20.glEnableVertexAttribArray(mGLAttribTextureCoordinate);

    if (textureId != OpenGlUtils.NO_TEXTURE) {
        GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
        GLES20.glBindTexture(mTextureTarget, textureId);
        GLES20.glUniform1i(mGLUniformTexture, 0);
    }
    onDrawArraysPre();
    GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 6);
    GLES20.glDisableVertexAttribArray(mGLAttribPosition);
    GLES20.glDisableVertexAttribArray(mGLAttribTextureCoordinate);
    GLES20.glBindTexture(mTextureTarget, 0);

    Log.i(TAG,"java filter draw textureId = " + textureId);

    if(mInputSurface != null){
        mInputSurface.swapBuffers();
        GLES20.glFlush();
    }

}
 
開發者ID:lzmlsfe,項目名稱:19porn,代碼行數:36,代碼來源:GPUImageFilter.java

示例4: run

import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
			public void run() {
//				if (DEBUG) Log.v(TAG, "draw:");
				boolean local_request_draw;
				synchronized (mSync) {
					local_request_draw = requestDraw;
					if (!requestDraw) {
						try {
							mSync.wait(intervals);
							local_request_draw = requestDraw;
							requestDraw = false;
						} catch (final InterruptedException e) {
							return;
						}
					}
				}
				if (mIsRecording) {
					if (local_request_draw) {
						mSourceTexture.updateTexImage();
						mSourceTexture.getTransformMatrix(mTexMatrix);
					}
					// SurfaceTextureで受け取った畫像をMediaCodecの入力用Surfaceへ描畫する
					mEncoderSurface.makeCurrent();
					mDrawer.draw(mTexId, mTexMatrix, 0);
			    	mEncoderSurface.swap();
			    	// EGL保持用のオフスクリーンに描畫しないとハングアップする機種の為のworkaround
					makeCurrent();
					GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
					GLES20.glFlush();
					frameAvailableSoon();
					queueEvent(this);
				} else {
					releaseSelf();
				}
//				if (DEBUG) Log.v(TAG, "draw:finished");
			}
 
開發者ID:itsnothingg,項目名稱:EasyScreenRecorder,代碼行數:37,代碼來源:MediaScreenEncoder.java

示例5: run

import android.opengl.GLES20; //導入方法依賴的package包/類
@Override
    public void run() {
        initGL(surfaceTexture);

        // Setup camera filters map
        cameraFilterMap.append(R.string.filter0, new OriginalFilter(context));
        cameraFilterMap.append(R.string.filter1, new AsciiArtFilter(context));
        cameraFilterMap.append(R.string.filter2, new BasicDeformFilter(context));
        cameraFilterMap.append(R.string.filter3, new BlueorangeFilter(context));
        cameraFilterMap.append(R.string.filter4, new ChromaticAberrationFilter(context));
        cameraFilterMap.append(R.string.filter5, new ContrastFilter(context));
        cameraFilterMap.append(R.string.filter6, new CrackedFilter(context));
        cameraFilterMap.append(R.string.filter7, new CrosshatchFilter(context));
        cameraFilterMap.append(R.string.filter8, new EdgeDetectionFilter(context));
        cameraFilterMap.append(R.string.filter9, new EMInterferenceFilter(context));
        cameraFilterMap.append(R.string.filter10, new LegofiedFilter(context));
        cameraFilterMap.append(R.string.filter11, new LichtensteinEsqueFilter(context));
        cameraFilterMap.append(R.string.filter12, new MappingFilter(context));
        cameraFilterMap.append(R.string.filter13, new MoneyFilter(context));
        cameraFilterMap.append(R.string.filter14, new NoiseWarpFilter(context));
        cameraFilterMap.append(R.string.filter15, new PixelizeFilter(context));
        cameraFilterMap.append(R.string.filter16, new PolygonizationFilter(context));
        cameraFilterMap.append(R.string.filter17, new RefractionFilter(context));
        cameraFilterMap.append(R.string.filter18, new TileMosaicFilter(context));
        cameraFilterMap.append(R.string.filter19, new TrianglesMosaicFilter(context));
        cameraFilterMap.append(R.string.filter20, new BeautyFilter(context));
        setSelectedFilter(selectedFilterId);

        // Create texture for camera preview
//        cameraTextureId = MyGLUtils.genTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES);
//        cameraSurfaceTexture = new SurfaceTexture(cameraTextureId);

        // Start camera preview
//        try {
//            camera.setPreviewTexture(cameraSurfaceTexture);
//            camera.startPreview();
//        } catch (IOException ioe) {
//            // Something bad happened
//        }

        // Render loop
        while (!Thread.currentThread().isInterrupted()) {
            try {
                if (gwidth < 0 && gheight < 0)
                    GLES20.glViewport(0, 0, gwidth = -gwidth, gheight = -gheight);

                GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);

                // Update the camera preview texture
                synchronized (this) {
                    cameraSurfaceTexture.updateTexImage();
                }

                // Draw camera preview
                selectedFilter.draw(cameraTextureId, gwidth, gheight);

                // Flush
                GLES20.glFlush();
                egl10.eglSwapBuffers(eglDisplay, eglSurface);

                Thread.sleep(DRAW_INTERVAL);

            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
            }
        }

        cameraSurfaceTexture.release();
        GLES20.glDeleteTextures(1, new int[]{cameraTextureId}, 0);
    }
 
開發者ID:SimonCherryGZ,項目名稱:face-landmark-android,代碼行數:71,代碼來源:MyCameraRenderer.java

示例6: draw

import android.opengl.GLES20; //導入方法依賴的package包/類
public boolean draw(final FloatBuffer cubeBuffer,
                   final FloatBuffer textureBuffer) {
    GLES20.glUseProgram(mGLProgId);

    if (!mIsInitialized) {
        return false;
    }
    if(mSurfaceTexture1 == null)
        return  false;

    synchronized (lock){
        if(mFrameAvailable1){
            try {
                mSurfaceTexture1.updateTexImage();
            }catch (Exception ex){
                ex.printStackTrace();
            }

            mFrameAvailable1 = false;
        }else{
            return  false;
        }
    }

    cubeBuffer.position(0);
    GLES20.glVertexAttribPointer(mGLAttribPosition, 3, GLES20.GL_FLOAT, false, 0, cubeBuffer);
    GLES20.glEnableVertexAttribArray(mGLAttribPosition);

    textureBuffer.position(0);
    GLES20.glVertexAttribPointer(mGLAttribTextureCoordinate, 2, GLES20.GL_FLOAT, false, 0, textureBuffer);
    GLES20.glEnableVertexAttribArray(mGLAttribTextureCoordinate);


    GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
    GLES20.glBindTexture(mTextureTarget, mOESTextures[0]);
    GLES20.glUniform1i(mGLUniformTexture1, 0);


    GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 6);

    GLES20.glDisableVertexAttribArray(mGLAttribPosition);
    GLES20.glDisableVertexAttribArray(mGLAttribTextureCoordinate);
    GLES20.glBindTexture(mTextureTarget, 0);

    //mInputSurface.swapBuffers();
    GLES20.glFlush();
    return  true;
}
 
開發者ID:lzmlsfe,項目名稱:19porn,代碼行數:49,代碼來源:GPUImageExtFilter.java


注:本文中的android.opengl.GLES20.glFlush方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。