Java Code Examples for android.opengl.GLES30#glClearColor()
The following examples show how to use
android.opengl.GLES30#glClearColor() .
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: VideoSource.java From libcommon with Apache License 2.0 | 5 votes |
/** * 映像入力用Surfaceを再生成する */ @SuppressLint("NewApi") @WorkerThread protected void handleReCreateInputSurface() { if (DEBUG) Log.v(TAG, "handleReCreateInputSurface:"); makeDefault(); handleReleaseInputSurface(); makeDefault(); if (mGLContext.isOES3()) { GLES30.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); mTexId = com.serenegiant.glutils.es3.GLHelper.initTex(GL_TEXTURE_EXTERNAL_OES, GLES30.GL_TEXTURE0, GLES30.GL_NEAREST); } else { GLES20.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); mTexId = com.serenegiant.glutils.es2.GLHelper.initTex(GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE0, GLES20.GL_NEAREST); } mInputTexture = new SurfaceTexture(mTexId); mInputSurface = new Surface(mInputTexture); if (BuildCheck.isAndroid4_1()) { mInputTexture.setDefaultBufferSize(mVideoWidth, mVideoHeight); } if (BuildCheck.isLollipop()) { mInputTexture.setOnFrameAvailableListener(mOnFrameAvailableListener, mGLHandler); // API>=21 } else { mInputTexture.setOnFrameAvailableListener(mOnFrameAvailableListener); } mCallback.onCreate(mInputSurface); }
Example 2
Source File: myRenderer.java From opengl with Apache License 2.0 | 5 votes |
@Override public void onSurfaceCreated(GL10 glUnused, EGLConfig config) { //set the clear buffer color to light gray. //GLES30.glClearColor(0.9f, .9f, 0.9f, 0.9f); //set the clear buffer color to a dark gray GLES30.glClearColor(0.1f, .1f, 0.1f, 1.0f); //initialize the cube code for drawing. mPyramid = new Pyramid(); //if we had other objects setup them up here as well. }
Example 3
Source File: myRenderer.java From opengl with Apache License 2.0 | 5 votes |
public void onSurfaceCreated(GL10 glUnused, EGLConfig config) { //set the clear buffer color to light gray. // GLES30.glClearColor(0.9f, .9f, 0.9f, 0.9f); //set the clear buffer color to a dark grey. GLES30.glClearColor(0.1f, .1f, 0.1f, 0.9f); //initialize the cube code for drawing. mCube = new Cube(); //if we had other objects setup them up here as well. }
Example 4
Source File: MyGLRenderer.java From opengl with Apache License 2.0 | 5 votes |
@Override public void onSurfaceCreated(GL10 unused, EGLConfig config) { // Set the background frame color GLES30.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); mTriangle = new Triangle(); mSquare = new Square(); }
Example 5
Source File: myRenderer.java From opengl with Apache License 2.0 | 5 votes |
public void onSurfaceCreated(GL10 glUnused, EGLConfig config) { //set the clear buffer color to light gray. GLES30.glClearColor(0.9f, .9f, 0.9f, 0.9f); //initialize the cube code for drawing. mCube = new Cube(); //if we had other objects setup them up here as well. }
Example 6
Source File: GLES30WallpaperRenderer.java From alynx-live-wallpaper with Apache License 2.0 | 4 votes |
@Override public void onSurfaceCreated(GL10 gl10, EGLConfig eglConfig) { // No depth test for 2D video. GLES30.glDisable(GLES30.GL_DEPTH_TEST); GLES30.glDepthMask(false); GLES30.glDisable(GLES30.GL_CULL_FACE); GLES30.glDisable(GLES30.GL_BLEND); GLES30.glGenTextures(textures.length, textures, 0); GLES30.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, textures[0]); GLES30.glTexParameteri( GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES30.GL_TEXTURE_MIN_FILTER, GLES30.GL_LINEAR ); GLES30.glTexParameteri( GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES30.GL_TEXTURE_MAG_FILTER, GLES30.GL_LINEAR ); GLES30.glTexParameteri( GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES30.GL_TEXTURE_WRAP_S, GLES30.GL_CLAMP_TO_EDGE ); GLES30.glTexParameteri( GLES11Ext.GL_TEXTURE_EXTERNAL_OES, GLES30.GL_TEXTURE_WRAP_T, GLES30.GL_CLAMP_TO_EDGE ); program = Utils.linkProgramGLES30( Utils.compileShaderResourceGLES30( context, GLES30.GL_VERTEX_SHADER, R.raw.vertex_30 ), Utils.compileShaderResourceGLES30( context, GLES30.GL_FRAGMENT_SHADER, R.raw.fragment_30 ) ); mvpLocation = GLES30.glGetUniformLocation(program, "mvp"); GLES30.glGenBuffers(buffers.length, buffers, 0); GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, buffers[0]); GLES30.glBufferData( GLES30.GL_ARRAY_BUFFER, vertices.capacity() * BYTES_PER_FLOAT, vertices, GLES30.GL_STATIC_DRAW ); GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, 0); GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, buffers[1]); GLES30.glBufferData( GLES30.GL_ARRAY_BUFFER, texCoords.capacity() * BYTES_PER_FLOAT, texCoords, GLES30.GL_STATIC_DRAW ); GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, 0); GLES30.glBindBuffer(GLES30.GL_ELEMENT_ARRAY_BUFFER, buffers[2]); GLES30.glBufferData( GLES30.GL_ELEMENT_ARRAY_BUFFER, indices.capacity() * BYTES_PER_INT, indices, GLES30.GL_STATIC_DRAW ); GLES30.glBindBuffer(GLES30.GL_ELEMENT_ARRAY_BUFFER, 0); // Locations are set in shader sources. GLES30.glGenVertexArrays(vertexArrays.length, vertexArrays, 0); GLES30.glBindVertexArray(vertexArrays[0]); GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, buffers[0]); GLES30.glEnableVertexAttribArray(0); GLES30.glVertexAttribPointer( 0, 2, GLES30.GL_FLOAT, false, 2 * BYTES_PER_FLOAT, 0 ); GLES30.glBindBuffer(GLES30.GL_ARRAY_BUFFER, buffers[1]); GLES30.glEnableVertexAttribArray(1); GLES30.glVertexAttribPointer( 1, 2, GLES30.GL_FLOAT, false, 2 * BYTES_PER_FLOAT, 0 ); GLES30.glBindBuffer(GLES30.GL_ELEMENT_ARRAY_BUFFER, buffers[2]); GLES30.glBindVertexArray(0); GLES30.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); }
Example 7
Source File: HelloTriangleRenderer.java From opengl with Apache License 2.0 | 4 votes |
public void onSurfaceCreated(GL10 glUnused, EGLConfig config) { String vShaderStr = "#version 300 es \n" + "in vec4 vPosition; \n" + "void main() \n" + "{ \n" + " gl_Position = vPosition; \n" + "} \n"; //a red ise 1.0, 0.0, 0.0, 1.0 but I prefer blue. String fShaderStr = "#version 300 es \n" + "precision mediump float; \n" + "out vec4 fragColor; \n" + "void main() \n" + "{ \n" + " fragColor = vec4 ( 0.0, 0.0, 1.0, 1.0 ); \n" + "} \n"; int vertexShader; int fragmentShader; int programObject; int[] linked = new int[1]; // Load the vertex/fragment shaders vertexShader = LoadShader(GLES30.GL_VERTEX_SHADER, vShaderStr); fragmentShader = LoadShader(GLES30.GL_FRAGMENT_SHADER, fShaderStr); // Create the program object programObject = GLES30.glCreateProgram(); if (programObject == 0) { return; } GLES30.glAttachShader(programObject, vertexShader); GLES30.glAttachShader(programObject, fragmentShader); // Bind vPosition to attribute 0 GLES30.glBindAttribLocation(programObject, 0, "vPosition"); // Link the program GLES30.glLinkProgram(programObject); // Check the link status GLES30.glGetProgramiv(programObject, GLES30.GL_LINK_STATUS, linked, 0); if (linked[0] == 0) { Log.e(TAG, "Error linking program:"); Log.e(TAG, GLES30.glGetProgramInfoLog(programObject)); GLES30.glDeleteProgram(programObject); return; } // Store the program object mProgramObject = programObject; //set the clear buffer color to white. GLES30.glClearColor(1.0f, 1.0f, 1.0f, 0.0f); }