com.badlogic.gdx.graphics.GL10 Java Examples

The following examples show how to use com.badlogic.gdx.graphics.GL10. 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: RuinsOfRevenge.java    From RuinsOfRevenge with MIT License 5 votes vote down vote up
@Override
public void render() {
	Gdx.gl.glClearColor(0.5f, 0.5f, 0.5f, 0f);
	Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

	prepareDrawStack();
	updateDrawStack(Gdx.graphics.getDeltaTime());
}
 
Example #2
Source File: TextureUtilGdx.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static int convertTextureFormat(Format fmt){
    switch (fmt){
        case Alpha16:
        case Alpha8:
            return GL10.GL_ALPHA;
        case Luminance8Alpha8:
        case Luminance16Alpha16:
            return GL10.GL_LUMINANCE_ALPHA;
        case Luminance8:
        case Luminance16:
            return GL10.GL_LUMINANCE;
        case RGB10:
        case RGB16:
        case BGR8:
        case RGB8:
        case RGB565:
            return GL10.GL_RGB;
        case RGB5A1:
        case RGBA16:
        case RGBA8:
            return GL10.GL_RGBA;
            
        case Depth:
            return Gdx.gl20.GL_DEPTH_COMPONENT;
        case Depth16:
            return Gdx.gl20.GL_DEPTH_COMPONENT16;
        case Depth24:
        case Depth32:
        case Depth32F:
            throw new UnsupportedOperationException("Unsupported depth format: " + fmt);   
            
        case DXT1A:
            throw new UnsupportedOperationException("Unsupported format: " + fmt);
        default:
            throw new UnsupportedOperationException("Unrecognized format: " + fmt);
    }
}
 
Example #3
Source File: Scene3dDemo.java    From Scene3d with Apache License 2.0 4 votes vote down vote up
@Override
  public void render () {
      Gdx.gl.glClearColor(1, 1, 1, 1);
      Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
      stage3d.act();
  	stage3d.draw();
  	stage2d.act();
   	stage2d.draw();
  	camController.update();
  	fpsLabel.setText("Fps: " + Gdx.graphics.getFramesPerSecond());
  	visibleLabel.setText("Visible: " + stage3d.getRoot().visibleCount);
  	positionLabel.setText("Knight X:" + knight.getX()+" Y:"+knight.getY()+" Z:"+knight.getZ());
  	rotationLabel.setText("Knight Yaw:" + knight.getYaw()+" Pitch:"+knight.getPitch()+" "
  			+ "Roll:"+knight.getRoll());
  	positionCameraLabel.setText("Camera X:" + stage3d.getCamera().position.x
  			+" Y:"+stage3d.getCamera().position.y+" Z:"+stage3d.getCamera().position.z);
  	rotationCameraLabel.setText("Camera Yaw:" + stage3d.getCamera().direction.x
  			+" Pitch:"+stage3d.getCamera().direction.y+" "+ "Roll:"+stage3d.getCamera().direction.z);
  	
  	angle = MathUtils.cosDeg(knight.getYaw() - 90); //90 degrees is correction factor
  	angle2 = -MathUtils.sinDeg(knight.getYaw() - 90);
if (upKey) {
	knight.addAction3d(Actions3d.moveBy(angle, 0f, angle2));
	stage3d.getCamera().translate(angle, 0f, angle2);
} 
else if (downKey) {
	knight.addAction3d(Actions3d.moveBy(-angle, 0f, -angle2));
	stage3d.getCamera().translate(-angle, 0f, -angle2);
}
else if (rightKey) {
	knight.rotateYaw(-2f);
	if(stage3d.getCamera().direction.z > -0.76f)
		Camera3d.rotateBy(-2f, 0f, 0f, 0f);
	//stage3d.getCamera().translate(angle, 0f, angle2); //get the angle calculations rite to make
	// the camera truly follow knight
} 
else if (leftKey) {
	knight.rotateYaw(2f);
	if(stage3d.getCamera().direction.z < -0.63f)
		Camera3d.rotateBy(2f, 0f, 0f, 0f);
	
} 
/* private float stateTime;
    float angleDegrees;
    stateTime+= delta;
	angleDegrees = stateTime * 10.0f;
	camera.position.set(200f * MathUtils.sinDeg(angleDegrees),
		20, -200.0f * MathUtils.cosDeg(angleDegrees));
	camera.rotate(Vector3.Y, angleDegrees/10f*delta);*/
  }
 
Example #4
Source File: SimUi.java    From ingress-apk-mod with Apache License 2.0 4 votes vote down vote up
@Override
public void render() {
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    stage.act(Gdx.graphics.getDeltaTime());
    stage.draw();
}
 
Example #5
Source File: CrtMonitor.java    From RuinsOfRevenge with MIT License 4 votes vote down vote up
@Override
public void render( FrameBuffer src, FrameBuffer dest ) {
	// the original scene
	Texture in = src.getColorBufferTexture();

	boolean blendingWasEnabled = PostProcessor.isStateEnabled( GL20.GL_BLEND );
	Gdx.gl.glDisable( GL10.GL_BLEND );

	Texture out = null;

	if( doblur ) {

		pingPongBuffer.begin();
		{
			// crt pass
			crt.setInput( in ).setOutput( pingPongBuffer.getSourceBuffer() ).render();

			// blur pass
			blur.render( pingPongBuffer );
		}
		pingPongBuffer.end();

		out = pingPongBuffer.getResultTexture();
	} else {
		// crt pass
		crt.setInput( in ).setOutput( buffer ).render();

		out = buffer.getColorBufferTexture();
	}

	if( blending || blendingWasEnabled ) {
		Gdx.gl.glEnable( GL20.GL_BLEND );
	}

	if( blending ) {
		Gdx.gl.glBlendFunc( sfactor, dfactor );
	}

	// do combine pass
	combine.setOutput( dest ).setInput( in, out ).render();
}