@Override public void glGenerateMipmap (int target) { GL30.glGenerateMipmap(target); }
@Override public void glGenerateMipmap (int target) { GL30.glGenerateMipmap(target); }
@Override public void glGenerateMipmap (int target) { GL30.glGenerateMipmap(target); }
@Override public void glGenerateMipmap (int target) { GL30.glGenerateMipmap(target); }
@Override public void glGenerateMipmapEXT(int param1) { GL30.glGenerateMipmap(param1); }
@Override public void glGenerateMipmapEXT(final int target) { GL30.glGenerateMipmap(target); }
@Override public void glGenerateMipmap(int target) { GL30.glGenerateMipmap(target); }
@Override public void glGenerateMipmap (int target) { GL30.glGenerateMipmap(target); }
@Override public void glGenerateMipmap(int target) { GL30.glGenerateMipmap(target); }
@Override public void glGenerateMipmapEXT(int param1) { GL30.glGenerateMipmap(param1); }
@Override public void glGenerateMipmap(int target) { GL30.glGenerateMipmap(target); }
@Override public void glGenerateMipmap (int target) { GL30.glGenerateMipmap(target); }
public void trilinearFilter(){ glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glGenerateMipmap(target); glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); }
private static int loadTexture(String fileName) throws Exception { // Load Texture file PNGDecoder decoder = new PNGDecoder(Texture.class.getResourceAsStream(fileName)); // Load texture contents into a byte buffer ByteBuffer buf = ByteBuffer.allocateDirect( 4 * decoder.getWidth() * decoder.getHeight()); decoder.decode(buf, decoder.getWidth() * 4, Format.RGBA); buf.flip(); // Create a new OpenGL texture int textureId = glGenTextures(); // Bind the texture glBindTexture(GL_TEXTURE_2D, textureId); // Tell OpenGL how to unpack the RGBA bytes. Each component is 1 byte size glPixelStorei(GL_UNPACK_ALIGNMENT, 1); //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // Upload the texture data glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, decoder.getWidth(), decoder.getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, buf); // Generate Mip Map glGenerateMipmap(GL_TEXTURE_2D); return textureId; }
public Texture(ByteBuffer imageData) { try (MemoryStack stack = stackPush()) { IntBuffer w = stack.mallocInt(1); IntBuffer h = stack.mallocInt(1); IntBuffer avChannels = stack.mallocInt(1); // Decode texture image into a byte buffer ByteBuffer decodedImage = stbi_load_from_memory(imageData, w, h, avChannels, 4); this.width = w.get(); this.height = h.get(); // Create a new OpenGL texture this.id = glGenTextures(); // Bind the texture glBindTexture(GL_TEXTURE_2D, this.id); // Tell OpenGL how to unpack the RGBA bytes. Each component is 1 byte size glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // Upload the texture data glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, this.width, this.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, decodedImage); // Generate Mip Map glGenerateMipmap(GL_TEXTURE_2D); } }
public Texture(ByteBuffer imageData) { try (MemoryStack stack = stackPush()) { IntBuffer w = stack.mallocInt(1); IntBuffer h = stack.mallocInt(1); IntBuffer avChannels = stack.mallocInt(1); // Decode texture image into a byte buffer ByteBuffer decodedImage = stbi_load_from_memory(imageData, w, h, avChannels, 4); this.width = w.get(); this.height = h.get(); // Create a new OpenGL texture this.id = glGenTextures(); // Bind the texture glBindTexture(GL_TEXTURE_2D, this.id); // Tell OpenGL how to unpack the RGBA bytes. Each component is 1 byte size glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // Upload the texture data glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, this.width, this.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, decodedImage); // Generate Mip Map glGenerateMipmap(GL_TEXTURE_2D); } }
public Texture(ByteBuffer imageData) { try (MemoryStack stack = stackPush()) { IntBuffer w = stack.mallocInt(1); IntBuffer h = stack.mallocInt(1); IntBuffer avChannels = stack.mallocInt(1); // Decode texture image into a byte buffer ByteBuffer decodedImage = stbi_load_from_memory(imageData, w, h, avChannels, 4); this.width = w.get(); this.height = h.get(); // Create a new OpenGL texture this.id = glGenTextures(); // Bind the texture glBindTexture(GL_TEXTURE_2D, this.id); // Tell OpenGL how to unpack the RGBA bytes. Each component is 1 byte size glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // Upload the texture data glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, this.width, this.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, decodedImage); // Generate Mip Map glGenerateMipmap(GL_TEXTURE_2D); } }
public Texture(InputStream is) throws Exception { // Load Texture file PNGDecoder decoder = new PNGDecoder(is); this.width = decoder.getWidth(); this.height = decoder.getHeight(); // Load texture contents into a byte buffer ByteBuffer buf = ByteBuffer.allocateDirect( 4 * decoder.getWidth() * decoder.getHeight()); decoder.decode(buf, decoder.getWidth() * 4, Format.RGBA); buf.flip(); // Create a new OpenGL texture this.id = glGenTextures(); // Bind the texture glBindTexture(GL_TEXTURE_2D, this.id); // Tell OpenGL how to unpack the RGBA bytes. Each component is 1 byte size glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // Upload the texture data glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, this.width, this.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, buf); // Generate Mip Map glGenerateMipmap(GL_TEXTURE_2D); }
public Texture(InputStream is) throws Exception { // Load Texture file PNGDecoder decoder = new PNGDecoder(is); this.width = decoder.getWidth(); this.height = decoder.getHeight(); // Load texture contents into a byte buffer ByteBuffer buf = ByteBuffer.allocateDirect( 4 * decoder.getWidth() * decoder.getHeight()); decoder.decode(buf, decoder.getWidth() * 4, Format.RGBA); buf.flip(); // Create a new OpenGL texture this.id = glGenTextures(); // Bind the texture glBindTexture(GL_TEXTURE_2D, this.id); // Tell OpenGL how to unpack the RGBA bytes. Each component is 1 byte size glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // Upload the texture data glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, this.width, this.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, buf); // Generate Mip Map glGenerateMipmap(GL_TEXTURE_2D); }
public Texture(InputStream is) throws Exception { // Load Texture file PNGDecoder decoder = new PNGDecoder(is); this.width = decoder.getWidth(); this.height = decoder.getHeight(); // Load texture contents into a byte buffer ByteBuffer buf = ByteBuffer.allocateDirect( 4 * decoder.getWidth() * decoder.getHeight()); decoder.decode(buf, decoder.getWidth() * 4, Format.RGBA); buf.flip(); // Create a new OpenGL texture this.id = glGenTextures(); // Bind the texture glBindTexture(GL_TEXTURE_2D, this.id); // Tell OpenGL how to unpack the RGBA bytes. Each component is 1 byte size glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); // Upload the texture data glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, this.width, this.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, buf); // Generate Mip Map glGenerateMipmap(GL_TEXTURE_2D); }