Example usage for org.lwjgl.opengl GL11 glCopyTexSubImage2D

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

Introduction

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

Prototype

public static void glCopyTexSubImage2D(@NativeType("GLenum") int target, @NativeType("GLint") int level,
        @NativeType("GLint") int xoffset, @NativeType("GLint") int yoffset, @NativeType("GLint") int x,
        @NativeType("GLint") int y, @NativeType("GLsizei") int width, @NativeType("GLsizei") int height) 

Source Link

Document

Respecifies a rectangular subregion of an existing texel array.

Usage

From source file:com.ardor3d.renderer.lwjgl.LwjglPbufferTextureRenderer.java

License:Open Source License

public void copyToTexture(final Texture tex, final int x, final int y, final int width, final int height,
        final int xoffset, final int yoffset) {
    LwjglTextureStateUtil.doTextureBind(tex, 0, true);

    GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, xoffset, yoffset, x, y, width, height);
}

From source file:com.ardor3d.renderer.lwjgl.LwjglTextureRenderer.java

License:Open Source License

public void copyToTexture(final Texture tex, final int x, final int y, final int width, final int height,
        final int xoffset, final int yoffset) {
    LwjglTextureStateUtil.doTextureBind(tex, 0, true);

    if (tex.getType() == Type.TwoDimensional) {
        GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, xoffset, yoffset, x, y, width, height);
    } else if (tex.getType() == Type.CubeMap) {
        GL11.glCopyTexSubImage2D(/*from w  w  w  .j  a v  a 2 s.  co m*/
                LwjglTextureStateUtil.getGLCubeMapFace(((TextureCubeMap) tex).getCurrentRTTFace()), 0, xoffset,
                yoffset, x, y, width, height);
    } else {
        throw new IllegalArgumentException("Invalid texture type: " + tex.getType());
    }
}

From source file:com.badlogic.gdx.backends.jglfw.JglfwGL20.java

License:Apache License

public void glCopyTexSubImage2D(int target, int level, int xoffset, int yoffset, int x, int y, int width,
        int height) {
    GL11.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
}

From source file:com.badlogic.gdx.backends.lwjgl.LwjglGL10.java

License:Apache License

public final void glCopyTexSubImage2D(int target, int level, int xoffset, int yoffset, int x, int y, int width,
        int height) {
    GL11.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
}

From source file:com.dinasgames.engine.graphics.Texture.java

protected void update(Window window, int x, int y) {

    assert (x + window.getWidth() <= mWidth);
    assert (y + window.getHeight() <= mHeight);

    if (mTexture > 0 && window.setActive(true)) {
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, mTexture);
        GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, x, y, 0, 0, window.getWidth(), window.getHeight());
        mPixelsFlipped = true;// www .j  a v  a  2  s .  c  om
        mCacheId = getUniqueId();
    }

}

From source file:com.enderville.mod.client.gui.mainmenu.MenuBaseEnderVille.java

License:LGPL

/**
 * Rotate and blurs the skybox view in the main menu
 *///www  .  j a v  a  2 s.c  o m
private void rotateAndBlurSkybox(float par1) {
    this.mc.getTextureManager().bindTexture(this.viewportTextureLocation);
    GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColorMask(true, true, true, false);
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    byte b0 = 3;

    for (int i = 0; i < b0; ++i) {
        //            tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F / (float)(i + 1));
        int j = this.width;
        int k = this.height;
        float f1 = (float) (i - b0 / 2) / 256.0F;
        tessellator.addVertexWithUV((double) j, (double) k, (double) this.zLevel, (double) (0.0F + f1), 0.0D);
        tessellator.addVertexWithUV((double) j, 0.0D, (double) this.zLevel, (double) (1.0F + f1), 0.0D);
        tessellator.addVertexWithUV(0.0D, 0.0D, (double) this.zLevel, (double) (1.0F + f1), 1.0D);
        tessellator.addVertexWithUV(0.0D, (double) k, (double) this.zLevel, (double) (0.0F + f1), 1.0D);
    }

    tessellator.draw();
    GL11.glColorMask(true, true, true, true);
}

From source file:com.kegare.caveworld.client.gui.GuiListSlot.java

License:Minecraft Mod Public

private void rotateAndBlurSkybox(float ticks) {
    mc.getTextureManager().bindTexture(panoramaBackground);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, 256, 256);
    GL11.glEnable(GL11.GL_BLEND);//from  w  ww  .j  a v a  2 s.c  o  m
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    GL11.glColorMask(true, true, true, false);
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    byte b0 = 3;

    for (int i = 0; i < b0; ++i) {
        tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1.0F / (i + 1));
        int j = width;
        int k = height;
        float f1 = (i - b0 / 2) / 256.0F;
        tessellator.addVertexWithUV(j, k, 0.0F, 0.0F + f1, 1.0D);
        tessellator.addVertexWithUV(j, 0.0D, 0.0F, 1.0F + f1, 1.0D);
        tessellator.addVertexWithUV(0.0D, 0.0D, 0.0F, 1.0F + f1, 0.0D);
        tessellator.addVertexWithUV(0.0D, k, 0.0F, 0.0F + f1, 0.0D);
    }

    tessellator.draw();
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glColorMask(true, true, true, true);
}

From source file:io.root.gfx.glutils.GL.java

License:Apache License

public static void glCopyTexSubImage2D(int target, int level, int xoffset, int yoffset, int x, int y, int width,
        int height) {
    GL11.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
}

From source file:jpcsp.graphics.RE.RenderingEngineLwjgl.java

License:Open Source License

@Override
public void copyTexSubImage(int level, int xOffset, int yOffset, int x, int y, int width, int height) {
    GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, level, xOffset, yOffset, x, y, width, height);
}

From source file:net.neilcsmith.praxis.video.opengl.internal.GLRenderer.java

License:Apache License

private void activate() {
    if (active) {
        return;//w  ww .jav a  2s. c om
    }

    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_TEXTURE_2D);

    FrameBuffer fbo = null;
    boolean clear = false;
    target = null;

    if (surface != null) {
        GLSurfaceData data = surface.getData();
        if (data == null) {
            LOGGER.finest("Setting up render to empty surface");
            data = new GLSurfaceData(surface.getWidth(), surface.getHeight(), surface.hasAlpha());
            data.texture = context.getTextureManager().acquire(data.width, data.height);
            surface.setData(data);
            clear = true;
        } else if (data.usage > 1) {
            LOGGER.finest("Setting up render to shared surface");
            data.usage--;
            if (data.texture == null) {
                data.texture = context.getTextureManager().acquire(data.width, data.height);
                syncPixelsToTexture(data);
            }
            data.texture.getFrameBuffer().bind();
            data = new GLSurfaceData(surface.getWidth(), surface.getHeight(), surface.hasAlpha());
            data.texture = context.getTextureManager().acquire(data.width, data.height);
            data.texture.bind();
            GL11.glCopyTexSubImage2D(GL11.GL_TEXTURE_2D, 0, 0, 0, 0, 0, data.width, data.height);
            surface.setData(data);
        } else if (data.texture == null) {
            LOGGER.finest("Setting up render to pixel backed surface");
            data.texture = context.getTextureManager().acquire(data.width, data.height);
            syncPixelsToTexture(data);
        }
        data.pixels = null;
        target = data.texture;
        fbo = data.texture.getFrameBuffer();
    }

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);

    if (fbo == null) {
        LOGGER.finest("Setting up render to screen");
        int w = GLContext.getCurrent().getWidth();
        int h = GLContext.getCurrent().getHeight();
        FrameBuffer.unbind();
        GL11.glViewport(0, 0, w, h);
        projectionMatrix.setToOrtho2D(0, 0, w, h);
    } else {
        LOGGER.finest("Setting up render to texture");
        fbo.bind();
        int w = surface.getWidth();
        int h = surface.getHeight();
        GL11.glViewport(0, 0, w, h);
        projectionMatrix.setToOrtho2D(0, h, w, -h);
    }

    if (customShader != null) {
        customShader.begin();
    } else {
        shader.begin();
    }
    setupMatrices();

    active = true;

    if (clear) {
        clear();
    }

}