Example usage for org.lwjgl.opengl ARBImaging glColorTable

List of usage examples for org.lwjgl.opengl ARBImaging glColorTable

Introduction

In this page you can find the example usage for org.lwjgl.opengl ARBImaging glColorTable.

Prototype

public static void glColorTable(@NativeType("GLenum") int target, @NativeType("GLenum") int internalformat,
        @NativeType("GLsizei") int width, @NativeType("GLenum") int format, @NativeType("GLenum") int type,
        @NativeType("void const *") float[] table) 

Source Link

Document

Array version of: #glColorTable ColorTable

Usage

From source file:kuake2.render.lwjgl.Image.java

License:Open Source License

void GL_SetTexturePalette(int[] palette) {

    assert (palette != null && palette.length == 256) : "int palette[256] bug";

    int i;/*  w  w w . ja va  2s . c  o m*/
    //byte[] temptable = new byte[768];

    if (qglColorTableEXT && gl_ext_palettedtexture.value != 0.0f) {
        ByteBuffer temptable = BufferUtils.createByteBuffer(768);
        for (i = 0; i < 256; i++) {
            temptable.put(i * 3 + 0, (byte) ((palette[i] >> 0) & 0xff));
            temptable.put(i * 3 + 1, (byte) ((palette[i] >> 8) & 0xff));
            temptable.put(i * 3 + 2, (byte) ((palette[i] >> 16) & 0xff));
        }

        ARBImaging.glColorTable(EXTSharedTexturePalette.GL_SHARED_TEXTURE_PALETTE_EXT, GL11.GL_RGB, 256,
                GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, temptable);
    }
}