Example usage for org.lwjgl.opengl GL11 glCopyTexImage2D

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

Introduction

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

Prototype

public static void glCopyTexImage2D(@NativeType("GLenum") int target, @NativeType("GLint") int level,
        @NativeType("GLenum") int internalFormat, @NativeType("GLint") int x, @NativeType("GLint") int y,
        @NativeType("GLsizei") int width, @NativeType("GLsizei") int height, @NativeType("GLint") int border) 

Source Link

Document

Defines a two-dimensional texel array in exactly the manner of #glTexImage2D TexImage2D , except that the image data are taken from the framebuffer rather than from client memory.

Usage

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

License:Apache License

public void glCopyTexImage2D(int target, int level, int internalformat, int x, int y, int width, int height,
        int border) {
    GL11.glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
}

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

License:Apache License

public final void glCopyTexImage2D(int target, int level, int internalformat, int x, int y, int width,
        int height, int border) {
    GL11.glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
}

From source file:de.sanandrew.mods.turretmod.client.render.world.RenderTurretCam.java

License:Creative Commons License

public static void render(Minecraft mc, final float renderTickTime) {
    GuiScreen prevDisplayedGui = null;//from w  w w  .  j  a  v  a 2  s .co  m

    if (mc.world == null) {
        return;
    }

    if (TURRETS.size() > 0) {

        if (!mc.inGameHasFocus) {
            prevDisplayedGui = mc.currentScreen;
            mc.currentScreen = null;
            mc.inGameHasFocus = true;
        }

        cleanupRenderers(false);

        TURRETS.forEach((turret, camEntry) -> {
            if (turret != null) {
                long updTime = System.nanoTime();
                if (updTime - camEntry.lastUpdTime > MAX_UPDATE_TIME_NS) {
                    EntityLiving turretL = turret.getEntity();
                    GameSettings settings = mc.gameSettings;
                    Entity entityBkp = mc.getRenderViewEntity();
                    int thirdPersonBkp = settings.thirdPersonView;
                    boolean hideGuiBkp = settings.hideGUI;
                    int mipmapBkp = settings.mipmapLevels;
                    float fovBkp = settings.fovSetting;
                    int widthBkp = mc.displayWidth;
                    int heightBkp = mc.displayHeight;
                    float turretPrevYawBkp = turretL.prevRotationYaw;
                    float turretYawBkp = turretL.rotationYaw;
                    float turretPitchBkp = turretL.rotationPitch;
                    float turretPrevPitchBkp = turretL.prevRotationPitch;
                    double turretPosYBkp = turretL.posY;
                    double turretPrevPosYBkp = turretL.prevPosY;
                    double turretLTPosYBkp = turretL.lastTickPosY;

                    mc.setRenderViewEntity(turretL);
                    settings.fovSetting = 100.0F;
                    settings.thirdPersonView = 0;
                    settings.hideGUI = true;
                    settings.mipmapLevels = 0;
                    mc.displayWidth = camEntry.quality;
                    mc.displayHeight = camEntry.quality;

                    RenderEventHandler.renderPlayer = true;
                    RenderEventHandler.renderEntity = mc.player;

                    turretL.prevRotationYaw = turretL.prevRotationYawHead;
                    turretL.rotationYaw = turretL.rotationYawHead;
                    if (turret.isUpsideDown()) {
                        turretL.posY -= 1.0F;
                        turretL.prevPosY -= 1.0F;
                        turretL.lastTickPosY -= 1.0F;
                        turretL.rotationPitch += 180.0F;
                        turretL.prevRotationPitch += 180.0F;
                        turretL.rotationYaw = -turretL.rotationYawHead;
                        turretL.prevRotationYaw = -turretL.prevRotationYawHead;
                    }

                    int fps = Math.min(Minecraft.getDebugFPS(), mc.gameSettings.limitFramerate);
                    fps = Math.max(fps, 60);
                    long timeDelta = updTime - renderEndNanoTime;
                    long timeDeltaFps = Math.max((1000000000 / fps / 4) - timeDelta, 0L);

                    mc.entityRenderer.renderWorld(renderTickTime, System.nanoTime() + timeDeltaFps);
                    GlStateManager.bindTexture(camEntry.textureId);
                    GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, 0, 0, camEntry.quality,
                            camEntry.quality, 0);

                    renderEndNanoTime = System.nanoTime();

                    turretL.posY = turretPosYBkp;
                    turretL.prevPosY = turretPrevPosYBkp;
                    turretL.lastTickPosY = turretLTPosYBkp;
                    turretL.rotationYaw = turretYawBkp;
                    turretL.prevRotationYaw = turretPrevYawBkp;
                    turretL.rotationPitch = turretPitchBkp;
                    turretL.prevRotationPitch = turretPrevPitchBkp;

                    RenderEventHandler.renderEntity = null;
                    RenderEventHandler.renderPlayer = false;

                    //noinspection ConstantConditions
                    mc.setRenderViewEntity(entityBkp);
                    settings.fovSetting = fovBkp;
                    settings.thirdPersonView = thirdPersonBkp;
                    settings.hideGUI = hideGuiBkp;
                    settings.mipmapLevels = mipmapBkp;
                    mc.displayWidth = widthBkp;
                    mc.displayHeight = heightBkp;

                    camEntry.lastUpdTime = updTime;
                }
            }

            camEntry.active = false;
        });

        if (prevDisplayedGui != null) {
            mc.currentScreen = prevDisplayedGui;
            mc.inGameHasFocus = false;
        }
    }
}

From source file:fi.conf.ae.gl.core.GLCore.java

License:LGPL

public void renderToTexture(int textureID, int width, int height) {
    GL11.glViewport(0, 0, width, height);
    glLoop();/*from  w w w. java  2 s . com*/
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID); // Bind and copy texture
    GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, 0, 0, width, height, 0);
    GL11.glViewport(0, 0, GLValues.screenWidth, GLValues.screenHeight);
    //GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);      // Clear The Screen And Depth Buffer
}

From source file:im.bci.jnuit.lwjgl.assets.AssetsLoader.java

License:Open Source License

public Texture grabScreenToTexture() {
    int maxSize = GL11.glGetInteger(GL11.GL_MAX_TEXTURE_SIZE);
    Texture texture = new Texture(Math.min(maxSize, LwjglHelper.getWidth()),
            Math.min(maxSize, LwjglHelper.getHeight()), false);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getId());
    LwjglHelper.setupGLTextureParams();/*from  w  w  w  . j  a v a2s . c o m*/
    GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, 0, 0, texture.getWidth(), texture.getHeight(), 0);
    return texture;
}

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

License:Apache License

public static void glCopyTexImage2D(int target, int level, int internalformat, int x, int y, int width,
        int height, int border) {
    GL11.glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
}

From source file:map.GameMap.java

License:Open Source License

private void renderMinimap() {
    int size = MINIMAP_SIZE;
    Texture tex = new Texture("ground");
    miniMap = new Material(name + "_minimap");
    int[] viewport = GLUtils.getViewport();
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();//from w w w .  j a  va2 s .  c o m
    GL11.glOrtho(0, size, size, 0, -10, 10);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glViewport(0, 0, size, size);

    GL11.glClearColor(0.0f, 0, 0, 1.0f);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    GL11.glScalef(size / tiles.length, size / tiles.length, size / tiles.length);

    GLUtils.glLightPos(1.0f, 1.0f, 1.0f);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDisable(GL11.GL_CULL_FACE);
    draw(null);
    GL11.glEnable(GL11.GL_CULL_FACE);

    IntBuffer addr = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer();
    GL11.glGenTextures(addr);
    tex.setID(addr.get(0));
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex.getID());

    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);
    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.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, 0, 0, size, size, 0);

    miniMap.setTexture(0, tex);
    GL11.glViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
}

From source file:org.oscim.gdx.LwjglGL20.java

License:Apache License

public void copyTexImage2D(int target, int level, int internalformat, int x, int y, int width, int height,
        int border) {
    GL11.glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
}

From source file:playn.java.JavaGL20.java

License:Apache License

@Override
public void glCopyTexImage2D(int target, int level, int internalformat, int x, int y, int width, int height,
        int border) {
    GL11.glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
}

From source file:processing.lwjgl.PLWJGL.java

License:Open Source License

public void copyTexImage2D(int target, int level, int internalFormat, int x, int y, int width, int height,
        int border) {
    GL11.glCopyTexImage2D(target, level, internalFormat, x, y, width, height, border);
}