List of usage examples for com.badlogic.gdx.graphics GL10 GL_SPECULAR
int GL_SPECULAR
To view the source code for com.badlogic.gdx.graphics GL10 GL_SPECULAR.
Click Source Link
From source file:com.badlogic.gdx.physics.bullet.demo.screens.DemoScreen.java
public DemoScreen(Game game) { // Physics is configured when super() finishes super();/*from w w w . j a va2s . co m*/ this.game = game; this.input = new DemoScreenInput(this, Gdx.input); Gdx.app.getInput().setInputProcessor(input); // Ambient light Gdx.gl10.glLightModelfv(GL10.GL_LIGHT_MODEL_AMBIENT, new float[] { .2f, .2f, .2f, 1 }, 0); // One directional light Gdx.gl10.glLightfv(GL10.GL_LIGHT0, GL10.GL_AMBIENT, new float[] { .2f, .2f, .2f, 1 }, 0); Gdx.gl10.glLightfv(GL10.GL_LIGHT0, GL10.GL_DIFFUSE, new float[] { 1, 1, 1, 1 }, 0); Gdx.gl10.glLightfv(GL10.GL_LIGHT0, GL10.GL_SPECULAR, new float[] { 1, 1, 1, 1 }, 0); Gdx.gl10.glLightf(GL10.GL_LIGHT0, GL10.GL_CONSTANT_ATTENUATION, 1); Gdx.gl10.glLightf(GL10.GL_LIGHT0, GL10.GL_LINEAR_ATTENUATION, 0); Gdx.gl10.glLightf(GL10.GL_LIGHT0, GL10.GL_QUADRATIC_ATTENUATION, 0); Gdx.gl10.glLightfv(GL10.GL_LIGHT0, GL10.GL_POSITION, new float[] { -10, -10, 10, 1 }, 0); Gdx.gl10.glEnable(GL10.GL_LIGHT0); PerspectiveCamera camera = getPerspectiveCamera(); camera.position.set(-25, 0, 20); camera.lookAt(0, 0, 0); camera.up.set(0, 0, 1); camera.fieldOfView = 60; camera.update(); // Load meshes cubeMesh = ObjLoader.loadObj(Gdx.app.getFiles().classpath("models/cube.obj").read(), false); icosphereMesh = ObjLoader.loadObj(Gdx.app.getFiles().classpath("models/icosphere.obj").read(), false); terrainMesh = ObjLoader.loadObj(Gdx.app.getFiles().classpath("models/terrain.obj").read(), false); // Load textures cubeTexture = new Texture(Gdx.files.classpath("textures/weird.png"), true); cubeTexture.setFilter(TextureFilter.MipMapLinearNearest, TextureFilter.Nearest); icosphereTexture = new Texture(Gdx.files.classpath("textures/blue.png"), true); icosphereTexture.setFilter(TextureFilter.MipMapLinearNearest, TextureFilter.Nearest); terrainTexture = new Texture(Gdx.files.classpath("textures/grass.png"), true); terrainTexture.setFilter(TextureFilter.MipMapLinearNearest, TextureFilter.Nearest); terrainTexture.setWrap(TextureWrap.Repeat, TextureWrap.Repeat); }
From source file:com.digitale.mygdxgame.Renderer.java
License:Open Source License
private void setLighting(GL10 gl) { gl.glEnable(GL10.GL_LIGHTING);//from w w w. j av a 2 s .com gl.glEnable(GL10.GL_LIGHT0); // gl.glEnable(GL10.GL_LIGHT2); // gl.glEnable(GL10.GL_LIGHT3); // gl.glEnable(GL10.GL_LIGHT1); // gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_POSITION, direction, 1); gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_AMBIENT, new float[] { 0.25f, 0.25f, 0.29f, 1f }, 0); gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_DIFFUSE, new float[] { 0.99f, 0.99f, 0.79f, 1f }, 0); // bright yellow light gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_SPECULAR, new float[] { .9f, .9f, 1f, 1f }, 0); gl.glEnable(GL10.GL_COLOR_MATERIAL); }
From source file:com.digitale.mygdxgame.SplashRenderer.java
License:Open Source License
private void setLighting(GL10 gl) { gl.glEnable(GL10.GL_LIGHTING);//w w w.ja v a 2 s .c o m gl.glEnable(GL10.GL_LIGHT0); gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_AMBIENT, new float[] { 0.25f, 0.25f, 0.29f, 1f }, 0); gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_DIFFUSE, new float[] { 0.99f, 0.99f, 0.79f, 1f }, 0); //bright yellow light gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_SPECULAR, new float[] { .9f, .9f, 1f, 1f }, 0); gl.glEnable(GL10.GL_COLOR_MATERIAL); }