@Override public TextureHandle generateTexture(int width, int height, ShortBuffer data, String name) { int texture = GL11.glGenTextures(); if (texture == 0) { return null; } //fix strange alpha test problem (minimap and landscape are unaffected) ShortBuffer bfr = BufferUtils.createShortBuffer(data.capacity()); int cap = data.capacity(); for(int i = 0;i != cap;i++) bfr.put(i, data.get(i)); TextureHandle textureHandle = new TextureHandle(this, texture); bindTexture(textureHandle); GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, width, height, 0, GL11.GL_RGBA, GL12.GL_UNSIGNED_SHORT_4_4_4_4, bfr); setTextureParameters(); setObjectLabel(GL11.GL_TEXTURE, texture, name + "-tex"); return textureHandle; }
/** * This method sets the current gamma ramp for the specified monitor. The original gamma ramp for that monitor is * saved by GLFW the first time this function is called and is restored by {@link GLFW3#terminate()}. * * @param gammaRamp The {@link GammaRamp} to use. */ public void setGammaRamp(GammaRamp gammaRamp) { GLFWGammaRamp ramp = GLFWGammaRamp.malloc(); ShortBuffer rBuffer = BufferUtils.createShortBuffer(gammaRamp.getSize()); ShortBuffer gBuffer = BufferUtils.createShortBuffer(gammaRamp.getSize()); ShortBuffer bBuffer = BufferUtils.createShortBuffer(gammaRamp.getSize()); rBuffer.put(gammaRamp.getRed()).flip(); gBuffer.put(gammaRamp.getGreen()).flip(); bBuffer.put(gammaRamp.getBlue()).flip(); ramp.red(rBuffer); ramp.green(gBuffer); ramp.blue(bBuffer); ramp.size(gammaRamp.getSize()); glfwSetGammaRamp(handle, ramp); ramp.free(); }