List of usage examples for com.badlogic.gdx.graphics GL20 GL_NEAREST
int GL_NEAREST
To view the source code for com.badlogic.gdx.graphics GL20 GL_NEAREST.
Click Source Link
From source file:com.badlogic.gdx.tests.gles2.MipMap2D.java
License:Apache License
public void render() { Gdx.gl20.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); Gdx.gl20.glClear(GL20.GL_COLOR_BUFFER_BIT); Gdx.gl20.glActiveTexture(GL20.GL_TEXTURE0); texture.bind();// ww w . ja va 2 s . c om shader.begin(); shader.setUniformf("s_texture", 0); Gdx.gl20.glTexParameteri(GL20.GL_TEXTURE_2D, GL20.GL_TEXTURE_MIN_FILTER, GL20.GL_NEAREST); shader.setUniformf("u_offset", -0.6f); mesh.render(shader, GL20.GL_TRIANGLES); Gdx.gl20.glTexParameteri(GL20.GL_TEXTURE_2D, GL20.GL_TEXTURE_MIN_FILTER, GL20.GL_LINEAR_MIPMAP_LINEAR); shader.setUniformf("u_offset", 0.6f); mesh.render(shader, GL20.GL_TRIANGLES); shader.end(); }
From source file:com.lyeeedar.Roguelike3D.Graphics.Models.SkyBox.java
License:Open Source License
public SkyBox(String texture) { this.texture[0] = new Pixmap(Gdx.files.internal("data/textures/" + texture + "_px.png")); this.texture[1] = new Pixmap(Gdx.files.internal("data/textures/" + texture + "_nx.png")); this.texture[2] = new Pixmap(Gdx.files.internal("data/textures/" + texture + "_py.png")); this.texture[3] = new Pixmap(Gdx.files.internal("data/textures/" + texture + "_ny.png")); this.texture[4] = new Pixmap(Gdx.files.internal("data/textures/" + texture + "_pz.png")); this.texture[5] = new Pixmap(Gdx.files.internal("data/textures/" + texture + "_nz.png")); IntBuffer buffer = BufferUtils.newIntBuffer(1); buffer.position(0);//from w ww .ja v a 2s . c om buffer.limit(buffer.capacity()); Gdx.gl20.glGenTextures(1, buffer); textureId = buffer.get(0); Gdx.gl20.glActiveTexture(SKYBOX_TEXTURE_ACTIVE_UNIT); Gdx.gl20.glBindTexture(GL20.GL_TEXTURE_CUBE_MAP, textureId); for (int i = 0; i < 6; i++) { glTexImage2D(GL20.GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, this.texture[i]); } float[] vertices = { -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, }; for (int i = 0; i < vertices.length; i++) { vertices[i] *= 10; } short[] indices = { 0, 1, 2, 3, 7, 1, 5, 4, 7, 6, 2, 4, 0, 1 }; mesh = new Mesh(true, 24, 14, new VertexAttribute(Usage.Position, 3, "a_position")); mesh.setVertices(vertices); mesh.setIndices(indices); final String vertexShader = Gdx.files.internal("data/shaders/model/skybox.vertex.glsl").readString(); final String fragmentShader = Gdx.files.internal("data/shaders/model/skybox.fragment.glsl").readString(); ShaderProgram.pedantic = true; shader = new ShaderProgram(vertexShader, fragmentShader); Gdx.gl20.glTexParameteri(GL20.GL_TEXTURE_CUBE_MAP, GL20.GL_TEXTURE_MIN_FILTER, GL20.GL_NEAREST); Gdx.gl20.glTexParameteri(GL20.GL_TEXTURE_CUBE_MAP, GL20.GL_TEXTURE_MAG_FILTER, GL20.GL_NEAREST); Gdx.gl20.glTexParameteri(GL20.GL_TEXTURE_CUBE_MAP, GL20.GL_TEXTURE_WRAP_S, GL20.GL_CLAMP_TO_EDGE); Gdx.gl20.glTexParameteri(GL20.GL_TEXTURE_CUBE_MAP, GL20.GL_TEXTURE_WRAP_T, GL20.GL_CLAMP_TO_EDGE); }
From source file:com.perfectplay.org.SkyBox.java
License:Open Source License
public void reloadCubemap() { g_cubeTexture = createGLHandle();// ww w. j a v a 2 s . c o m Gdx.gl20.glBindTexture(GL20.GL_TEXTURE_CUBE_MAP, g_cubeTexture); Pixmap temp = manager.get(textures[0], Pixmap.class); Gdx.gl.glTexImage2D(GL20.GL_TEXTURE_CUBE_MAP_POSITIVE_X, 0, temp.getGLInternalFormat(), temp.getWidth(), temp.getHeight(), 0, temp.getGLFormat(), temp.getGLType(), temp.getPixels()); temp = manager.get(textures[1], Pixmap.class); Gdx.gl.glTexImage2D(GL20.GL_TEXTURE_CUBE_MAP_NEGATIVE_X, 0, temp.getGLInternalFormat(), temp.getWidth(), temp.getHeight(), 0, temp.getGLFormat(), temp.getGLType(), temp.getPixels()); temp = manager.get(textures[2], Pixmap.class); Gdx.gl.glTexImage2D(GL20.GL_TEXTURE_CUBE_MAP_POSITIVE_Y, 0, temp.getGLInternalFormat(), temp.getWidth(), temp.getHeight(), 0, temp.getGLFormat(), temp.getGLType(), temp.getPixels()); temp = manager.get(textures[3], Pixmap.class); Gdx.gl.glTexImage2D(GL20.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, temp.getGLInternalFormat(), temp.getWidth(), temp.getHeight(), 0, temp.getGLFormat(), temp.getGLType(), temp.getPixels()); temp = manager.get(textures[4], Pixmap.class); Gdx.gl.glTexImage2D(GL20.GL_TEXTURE_CUBE_MAP_POSITIVE_Z, 0, temp.getGLInternalFormat(), temp.getWidth(), temp.getHeight(), 0, temp.getGLFormat(), temp.getGLType(), temp.getPixels()); temp = manager.get(textures[5], Pixmap.class); Gdx.gl.glTexImage2D(GL20.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, temp.getGLInternalFormat(), temp.getWidth(), temp.getHeight(), 0, temp.getGLFormat(), temp.getGLType(), temp.getPixels()); Gdx.gl20.glBindTexture(GL20.GL_TEXTURE_CUBE_MAP, g_cubeTexture); Gdx.gl20.glTexParameterf(GL20.GL_TEXTURE_CUBE_MAP, GL20.GL_TEXTURE_MAG_FILTER, GL20.GL_LINEAR); Gdx.gl20.glTexParameterf(GL20.GL_TEXTURE_CUBE_MAP, GL20.GL_TEXTURE_MIN_FILTER, GL20.GL_NEAREST); Gdx.gl20.glTexParameteri(GL20.GL_TEXTURE_CUBE_MAP, GL20.GL_TEXTURE_WRAP_S, GL20.GL_CLAMP_TO_EDGE); Gdx.gl20.glTexParameteri(GL20.GL_TEXTURE_CUBE_MAP, GL20.GL_TEXTURE_WRAP_T, GL20.GL_CLAMP_TO_EDGE); }