Java Code Examples for javax.microedition.khronos.opengles.GL10#glClearDepthf()

The following examples show how to use javax.microedition.khronos.opengles.GL10#glClearDepthf() . 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: FlipRenderer.java    From UltimateAndroid with Apache License 2.0 6 votes vote down vote up
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
  gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
  gl.glShadeModel(GL_SMOOTH);
  gl.glClearDepthf(1.0f);
  gl.glEnable(GL_DEPTH_TEST);
  gl.glDepthFunc(GL_LEQUAL);
  gl.glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

  created = true;

  cards.invalidateTexture();
  flipViewController.sendMessage(FlipViewController.MSG_SURFACE_CREATED);

  if (AphidLog.ENABLE_DEBUG) {
    AphidLog.d("onSurfaceCreated");
  }
}
 
Example 2
Source File: FlipRenderer.java    From UltimateAndroid with Apache License 2.0 6 votes vote down vote up
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
  gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
  gl.glShadeModel(GL_SMOOTH);
  gl.glClearDepthf(1.0f);
  gl.glEnable(GL_DEPTH_TEST);
  gl.glDepthFunc(GL_LEQUAL);
  gl.glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

  created = true;

  cards.invalidateTexture();
  flipViewController.sendMessage(FlipViewController.MSG_SURFACE_CREATED);

  if (AphidLog.ENABLE_DEBUG) {
    AphidLog.d("onSurfaceCreated");
  }
}
 
Example 3
Source File: MyGLRenderer.java    From TikTok with Apache License 2.0 5 votes vote down vote up
@Override
public void onSurfaceCreated(GL10 gl,
                             javax.microedition.khronos.egl.EGLConfig arg1) {
    glBitmap.loadGLTexture(gl, this.context);

    gl.glEnable(GL10.GL_TEXTURE_2D); // Enable Texture Mapping ( NEW )
    gl.glShadeModel(GL10.GL_SMOOTH); // Enable Smooth Shading
    gl.glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Black Background
    gl.glClearDepthf(1.0f); // Depth Buffer Setup
    gl.glEnable(GL10.GL_DEPTH_TEST); // Enables Depth Testing
    gl.glDepthFunc(GL10.GL_LEQUAL); // The Type Of Depth Testing To Do

    gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST);
}
 
Example 4
Source File: PageRenderer.java    From PlayLikeCurl with MIT License 5 votes vote down vote up
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
	frontPage.loadGLTexture(gl, this.context);
	rightPage.loadGLTexture(gl, this.context);
	leftPage.loadGLTexture(gl, this.context);


	gl.glEnable(GL10.GL_TEXTURE_2D);
	gl.glShadeModel(GL10.GL_SMOOTH);
	gl.glClearColor(0.0f, 0.0f, 0.0f, 0.5f);
	gl.glClearDepthf(1.0f);
	gl.glEnable(GL10.GL_DEPTH_TEST); 		
	gl.glDepthFunc(GL10.GL_LEQUAL); 	
	
	gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST); 
}
 
Example 5
Source File: OpenGLRenderer.java    From smartGL with Apache License 2.0 5 votes vote down vote up
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {

    mPreviousTime = 0;

    gl.glClearDepthf(1.0f);
    gl.glEnable(GL10.GL_DEPTH_TEST);
    gl.glDepthFunc(GL10.GL_LEQUAL);

    checkDoubleSided(gl);
}
 
Example 6
Source File: Renderer.java    From augmentedreality with Apache License 2.0 5 votes vote down vote up
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
	gl.glClearColor(1,1,1,1);
	
	gl.glClearDepthf(1.0f);
	gl.glEnable(GL10.GL_DEPTH_TEST);
	gl.glDepthFunc(GL10.GL_LEQUAL);
	
	gl.glEnable(GL10.GL_TEXTURE_2D);

	gl.glShadeModel(GL10.GL_SMOOTH);
	gl.glDisable(GL10.GL_COLOR_MATERIAL);
	gl.glEnable(GL10.GL_BLEND);
	gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
	gl.glEnable(GL10.GL_LIGHTING);
	float[] ambientlight = {.6f, .6f, .6f, 1f};
	float[] diffuselight = {1f, 1f, 1f, 1f};
	float[] specularlight = {1f, 1f, 1f, 1f};
	gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_AMBIENT, MemUtil.makeFloatBuffer(ambientlight));
	gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_DIFFUSE, MemUtil.makeFloatBuffer(diffuselight));
	gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_SPECULAR, MemUtil.makeFloatBuffer(specularlight));
	gl.glEnable(GL10.GL_LIGHT0);
	
	for (Iterator<Model3D> iterator = models.iterator(); iterator.hasNext();) {
		Model3D model = iterator.next();
		model.init(gl);
	}
	
}
 
Example 7
Source File: OpenGLRenderer.java    From opengl with Apache License 2.0 5 votes vote down vote up
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
	// Set the background color to black ( rgba ).
	gl.glClearColor(0.0f, 0.0f, 0.0f, 0.5f);  // OpenGL docs.
	// Enable Smooth Shading, default not really needed.
	gl.glShadeModel(GL10.GL_SMOOTH);// OpenGL docs.
	// Depth buffer setup.
	gl.glClearDepthf(1.0f);// OpenGL docs.
	// Enables depth testing.
	gl.glEnable(GL10.GL_DEPTH_TEST);// OpenGL docs.
	// The type of depth testing to do.
	gl.glDepthFunc(GL10.GL_LEQUAL);// OpenGL docs.
	// Really nice perspective calculations.
	gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, // OpenGL docs.
                         GL10.GL_NICEST);
}
 
Example 8
Source File: OpenGLRenderer.java    From opengl with Apache License 2.0 5 votes vote down vote up
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
	// Set the background color to black ( rgba ).
	gl.glClearColor(0.0f, 0.0f, 0.0f, 0.5f);  // OpenGL docs.
	// Enable Smooth Shading, default not really needed.
	gl.glShadeModel(GL10.GL_SMOOTH);// OpenGL docs.
	// Depth buffer setup.
	gl.glClearDepthf(1.0f);// OpenGL docs.
	// Enables depth testing.
	gl.glEnable(GL10.GL_DEPTH_TEST);// OpenGL docs.
	// The type of depth testing to do.
	gl.glDepthFunc(GL10.GL_LEQUAL);// OpenGL docs.
	// Really nice perspective calculations.
	gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, // OpenGL docs.
                         GL10.GL_NICEST);
}
 
Example 9
Source File: GLRender.java    From LiveBlurListView with Apache License 2.0 4 votes vote down vote up
private void process(Bitmap bitmap, boolean fast) {
	final GL10 gl = mGL;
	
	gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
	gl.glShadeModel(GL10.GL_SMOOTH);
	gl.glEnable(GL10.GL_DEPTH_TEST);
	gl.glClearDepthf(1.0f);
	gl.glDepthFunc(GL10.GL_LEQUAL);
	gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST);
	gl.glEnable(GL10.GL_TEXTURE_2D);
	gl.glEnable(GL10.GL_LEQUAL);
	
	float[] color = new float[16];
	FloatBuffer colorBuffer;
	float[] texVertex = new float[12];
	FloatBuffer vertexBuffer;
	
	ByteBuffer texByteBuffer = ByteBuffer.allocateDirect(texVertex.length * 4);
	texByteBuffer.order(ByteOrder.nativeOrder());
	vertexBuffer = texByteBuffer.asFloatBuffer();
	vertexBuffer.put(texVertex);
	vertexBuffer.position(0);
	
	ByteBuffer colorByteBuffer = ByteBuffer.allocateDirect(color.length * 4);
	colorByteBuffer.order(ByteOrder.nativeOrder());
	colorBuffer = colorByteBuffer.asFloatBuffer();
	colorBuffer.put(color);
	colorBuffer.position(0);
	
	gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
	gl.glPushMatrix();
	gl.glTranslatef(0.0f, 0.0f, 0.0f);
	

	
	colorBuffer.clear();
	colorBuffer.put(1.0f);
	colorBuffer.put(0.0f);
	colorBuffer.put(0.0f);
	colorBuffer.put(1.0f);
	
	colorBuffer.put(1.0f);
	colorBuffer.put(0.0f);
	colorBuffer.put(0.0f);
	colorBuffer.put(1.0f);
	
	colorBuffer.put(1.0f);
	colorBuffer.put(0.0f);
	colorBuffer.put(0.0f);
	colorBuffer.put(1.0f);
	
	colorBuffer.put(1.0f);
	colorBuffer.put(0.0f);
	colorBuffer.put(0.0f);
	colorBuffer.put(1.0f);
	
	vertexBuffer.clear();
	vertexBuffer.put(0);
	vertexBuffer.put(0);
	vertexBuffer.put(0);
	vertexBuffer.put(5f);
	vertexBuffer.put(0);
	vertexBuffer.put(0);
	vertexBuffer.put(5f);
	vertexBuffer.put(5f);
	vertexBuffer.put(0);
	vertexBuffer.put(0);
	vertexBuffer.put(5f);
	vertexBuffer.put(0);
	
	gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
	gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
	gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertexBuffer);
	

	
	gl.glColorPointer(4, GL10.GL_FLOAT, 0, colorBuffer);
	
	gl.glDrawArrays(GL10.GL_LINE_LOOP, 0, 4);
	gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
	
	gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
	gl.glPopMatrix();
}