Example usage for org.lwjgl.opengl GL11 glTexSubImage2D

List of usage examples for org.lwjgl.opengl GL11 glTexSubImage2D

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glTexSubImage2D.

Prototype

public static void glTexSubImage2D(@NativeType("GLenum") int target, @NativeType("GLint") int level,
        @NativeType("GLint") int xoffset, @NativeType("GLint") int yoffset, @NativeType("GLsizei") int width,
        @NativeType("GLsizei") int height, @NativeType("GLenum") int format, @NativeType("GLenum") int type,
        @NativeType("void const *") double[] pixels) 

Source Link

Document

Array version of: #glTexSubImage2D TexSubImage2D

Usage

From source file:playn.java.JavaGL20.java

License:Apache License

@Override
public void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format,
        int type, int pixels) {
    GL11.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
}

From source file:processing.lwjgl.PGL.java

License:Open Source License

public void texSubImage2D(int target, int level, int xOffset, int yOffset, int width, int height, int format,
        int type, Buffer data) {
    GL11.glTexSubImage2D(target, level, xOffset, yOffset, width, height, format, type, (IntBuffer) data);
}

From source file:processing.opengl.PLWJGL.java

License:Open Source License

@Override
public void texSubImage2D(int target, int level, int xOffset, int yOffset, int width, int height, int format,
        int type, Buffer data) {
    GL11.glTexSubImage2D(target, level, xOffset, yOffset, width, height, format, type, (IntBuffer) data);
}

From source file:pw.knx.feather.font.FontCache.java

License:Apache License

/**
 * Update a portion of the current glyph cache texture using the contents of the glyphImage with glTexSubImage2D().
 *
 * @param dirty The rectangular region in glyphImage that has changed and needs to be copied into the texture
 *///from  ww  w  .  j  a v a  2  s  .  c  o m
private void updateTexture(Rectangle dirty) {
    if (dirty != null) {
        updateBuffer(dirty.x, dirty.y, dirty.width, dirty.height);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
        GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, dirty.x, dirty.y, dirty.width, dirty.height, GL11.GL_RGBA,
                GL11.GL_UNSIGNED_BYTE, imageBuffer);
    }
}

From source file:tectonicus.rasteriser.lwjgl.LwjglTextureUtils.java

License:BSD License

public static int createTexture(BufferedImage imageData, TextureFilter filterMode) {
    imageData = convertToGlFormat(imageData);

    IntBuffer buff = BufferUtils.createIntBuffer(16);
    buff.limit(1);//from  w ww . j  a  v  a 2  s . com
    GL11.glGenTextures(buff);

    int textureId = buff.get();

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureId);
    if (filterMode == TextureFilter.NEAREST) {
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
    } else {
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    }

    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);

    ByteBuffer scratch = ByteBuffer.allocateDirect(4 * imageData.getWidth() * imageData.getHeight());

    Raster raster = imageData.getRaster();
    byte data[] = (byte[]) raster.getDataElements(0, 0, imageData.getWidth(), imageData.getHeight(), null);
    scratch.clear();
    scratch.put(data);
    scratch.rewind();

    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, // Mip level & Internal format
            imageData.getWidth(), imageData.getHeight(), 0, // width, height, border
            GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, // pixel data format
            scratch); // pixel data

    GL11.glTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, imageData.getWidth(), imageData.getHeight(), GL11.GL_RGBA,
            GL11.GL_UNSIGNED_BYTE, // format, type
            scratch);

    return textureId;
}

From source file:tk.ivybits.engine.gl.GL.java

License:Open Source License

public static void glTexSubImage2D(int a, int b, int c, int d, int e, int f, int g, int h, DoubleBuffer i) {
    GL11.glTexSubImage2D(a, b, c, d, e, f, g, h, i);
}

From source file:tk.ivybits.engine.gl.GL.java

License:Open Source License

public static void glTexSubImage2D(int a, int b, int c, int d, int e, int f, int g, int h, ByteBuffer i) {
    GL11.glTexSubImage2D(a, b, c, d, e, f, g, h, i);
}

From source file:tk.ivybits.engine.gl.GL.java

License:Open Source License

public static void glTexSubImage2D(int a, int b, int c, int d, int e, int f, int g, int h, long i) {
    GL11.glTexSubImage2D(a, b, c, d, e, f, g, h, i);
}

From source file:tk.ivybits.engine.gl.GL.java

License:Open Source License

public static void glTexSubImage2D(int a, int b, int c, int d, int e, int f, int g, int h, FloatBuffer i) {
    GL11.glTexSubImage2D(a, b, c, d, e, f, g, h, i);
}

From source file:tk.ivybits.engine.gl.GL.java

License:Open Source License

public static void glTexSubImage2D(int a, int b, int c, int d, int e, int f, int g, int h, IntBuffer i) {
    GL11.glTexSubImage2D(a, b, c, d, e, f, g, h, i);
}