本文整理汇总了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();
}
示例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();
}
示例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();
}
}
示例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");
}
示例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);
}
示例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;
}