Java 类org.lwjgl.opengl.GL14 实例源码

项目:DecompiledMinecraft    文件:OpenGlHelper.java   
public static void glBlendFunc(int sFactorRGB, int dFactorRGB, int sfactorAlpha, int dfactorAlpha)
{
    if (openGL14)
    {
        if (extBlendFuncSeparate)
        {
            EXTBlendFuncSeparate.glBlendFuncSeparateEXT(sFactorRGB, dFactorRGB, sfactorAlpha, dfactorAlpha);
        }
        else
        {
            GL14.glBlendFuncSeparate(sFactorRGB, dFactorRGB, sfactorAlpha, dfactorAlpha);
        }
    }
    else
    {
        GL11.glBlendFunc(sFactorRGB, dFactorRGB);
    }
}
项目:DecompiledMinecraft    文件:TextureUtil.java   
public static void allocateTextureImpl(int p_180600_0_, int p_180600_1_, int p_180600_2_, int p_180600_3_)
{
    deleteTexture(p_180600_0_);
    bindTexture(p_180600_0_);

    if (p_180600_1_ >= 0)
    {
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, p_180600_1_);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MIN_LOD, 0.0F);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LOD, (float)p_180600_1_);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, 0.0F);
    }

    for (int i = 0; i <= p_180600_1_; ++i)
    {
        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, i, GL11.GL_RGBA, p_180600_2_ >> i, p_180600_3_ >> i, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)((IntBuffer)null));
    }
}
项目:BaseClient    文件:OpenGlHelper.java   
public static void glBlendFunc(int sFactorRGB, int dFactorRGB, int sfactorAlpha, int dfactorAlpha)
{
    if (openGL14)
    {
        if (extBlendFuncSeparate)
        {
            EXTBlendFuncSeparate.glBlendFuncSeparateEXT(sFactorRGB, dFactorRGB, sfactorAlpha, dfactorAlpha);
        }
        else
        {
            GL14.glBlendFuncSeparate(sFactorRGB, dFactorRGB, sfactorAlpha, dfactorAlpha);
        }
    }
    else
    {
        GL11.glBlendFunc(sFactorRGB, dFactorRGB);
    }
}
项目:BaseClient    文件:OpenGlHelper.java   
public static void glBlendFunc(int sFactorRGB, int dFactorRGB, int sfactorAlpha, int dfactorAlpha)
{
    if (openGL14)
    {
        if (extBlendFuncSeparate)
        {
            EXTBlendFuncSeparate.glBlendFuncSeparateEXT(sFactorRGB, dFactorRGB, sfactorAlpha, dfactorAlpha);
        }
        else
        {
            GL14.glBlendFuncSeparate(sFactorRGB, dFactorRGB, sfactorAlpha, dfactorAlpha);
        }
    }
    else
    {
        GL11.glBlendFunc(sFactorRGB, dFactorRGB);
    }
}
项目:BaseClient    文件:TextureUtil.java   
public static void allocateTextureImpl(int p_180600_0_, int p_180600_1_, int p_180600_2_, int p_180600_3_)
{
    deleteTexture(p_180600_0_);
    bindTexture(p_180600_0_);

    if (p_180600_1_ >= 0)
    {
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, p_180600_1_);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MIN_LOD, 0.0F);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LOD, (float)p_180600_1_);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, 0.0F);
    }

    for (int i = 0; i <= p_180600_1_; ++i)
    {
        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, i, GL11.GL_RGBA, p_180600_2_ >> i, p_180600_3_ >> i, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)((IntBuffer)null));
    }
}
项目:candlelight    文件:Texture.java   
private static int getInternalTextureFormat(Bitmap.Format format)
{
    switch (format)
    {
        case GRAYSCALE:
            return GL11.GL_LUMINANCE;
        case GRAYSCALEALPHA:
            return GL11.GL_LUMINANCE_ALPHA;
        case RGB: return GL21.GL_SRGB;
        case RGBA: return GL21.GL_SRGB_ALPHA;
        case DEPTH:
            return GL14.GL_DEPTH_COMPONENT16;
        default:
            throw new UnsupportedOperationException("Unrecognized bitmap format!");
    }
}
项目:Backmemed    文件:OpenGlHelper.java   
public static void glBlendFunc(int sFactorRGB, int dFactorRGB, int sfactorAlpha, int dfactorAlpha)
{
    if (openGL14)
    {
        if (extBlendFuncSeparate)
        {
            EXTBlendFuncSeparate.glBlendFuncSeparateEXT(sFactorRGB, dFactorRGB, sfactorAlpha, dfactorAlpha);
        }
        else
        {
            GL14.glBlendFuncSeparate(sFactorRGB, dFactorRGB, sfactorAlpha, dfactorAlpha);
        }
    }
    else
    {
        GL11.glBlendFunc(sFactorRGB, dFactorRGB);
    }
}
项目:CustomWorldGen    文件:OpenGlHelper.java   
public static void glBlendFunc(int sFactorRGB, int dFactorRGB, int sfactorAlpha, int dfactorAlpha)
{
    if (openGL14)
    {
        if (extBlendFuncSeparate)
        {
            EXTBlendFuncSeparate.glBlendFuncSeparateEXT(sFactorRGB, dFactorRGB, sfactorAlpha, dfactorAlpha);
        }
        else
        {
            GL14.glBlendFuncSeparate(sFactorRGB, dFactorRGB, sfactorAlpha, dfactorAlpha);
        }
    }
    else
    {
        GL11.glBlendFunc(sFactorRGB, dFactorRGB);
    }
}
项目:Rival-Rebels-Mod    文件:EntityDocileFlameFX.java   
@Override
public void renderParticle(Tessellator t, float par2, float par3, float par4, float par5, float par6, float par7)
{
    Minecraft.getMinecraft().renderEngine.bindTexture(RivalRebels.etflameball);
    GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    GL14.glBlendEquation(GL14.GL_FUNC_ADD);
    float f10 = 0.03F * particleScale;
    float f11 = (float) (prevPosX + (posX - prevPosX) * par2 - interpPosX);
    float f12 = (float) (prevPosY + (posY - prevPosY) * par2 - interpPosY);
    float f13 = (float) (prevPosZ + (posZ - prevPosZ) * par2 - interpPosZ);
    t.setColorRGBA_F(1, 1, 1, 1);
    float X = (sequence % 4) / 4f;
    float Y = (sequence - (sequence % 4)) / 16f;
    t.addVertexWithUV(f11 - par3 * f10 - par6 * f10, f12 - par4 * f10, f13 - par5 * f10 - par7 * f10, X + 0.25f, Y + 0.25f);
    t.addVertexWithUV(f11 - par3 * f10 + par6 * f10, f12 + par4 * f10, f13 - par5 * f10 + par7 * f10, X + 0.25f, Y);
    t.addVertexWithUV(f11 + par3 * f10 + par6 * f10, f12 + par4 * f10, f13 + par5 * f10 + par7 * f10, X, Y);
    t.addVertexWithUV(f11 + par3 * f10 - par6 * f10, f12 - par4 * f10, f13 + par5 * f10 - par7 * f10, X, Y + 0.25f);
}
项目:DynamicSurroundings    文件:OpenGlState.java   
private OpenGlState() {
    this.enableBlend = isSet(GL11.GL_BLEND);
    this.blendSource = getInteger(GL11.GL_BLEND_SRC);
    this.blendDest = getInteger(GL11.GL_BLEND_DST);
    this.blendEquation = getInteger(GL14.GL_BLEND_EQUATION);

    this.enableAlphaTest = isSet(GL11.GL_ALPHA_TEST);
    this.alphaTestFunc = getInteger(GL11.GL_ALPHA_TEST_FUNC);
    this.alphaTestRef = getFloat(GL11.GL_ALPHA_TEST_REF);

    this.depthTest = isSet(GL11.GL_DEPTH_TEST);
    this.depthFunc = getInteger(GL11.GL_DEPTH_FUNC);

    this.lighting = isSet(GL11.GL_LIGHTING);
    this.depthMask = isSet(GL11.GL_DEPTH_WRITEMASK);
    this.normal = isSet(GL11.GL_NORMALIZE);
    this.rescaleNormal = isSet(GL12.GL_RESCALE_NORMAL);

    GlStateManager.pushMatrix();
}
项目:geoxygene    文件:LwjglLayerRenderer.java   
/**
 * Initialize layer FBO to receive GL primitives from a set of identical
 * symbolizers
 * 
 * @param primitive
 * @param opacity
 * @param currentSymbolizer
 * @throws GLException
 */
private void clearFBOLayer() throws GLException {
    GLTools.glCheckError("preparing next FBO Layer");
    GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, this.getLayerViewPanel().getGLCanvas().getFboId());
    GL11.glDrawBuffer(GL30.GL_COLOR_ATTACHMENT0);

    GLTools.glCheckError("bind frame buffer");

    // Blending mode in FBO drawing.
    GLTools.glCheckError("finalizing FBO initialization");
    GL11.glClearColor(0f, 0f, 0f, 0f);
    GLTools.glCheckError("finalizing FBO initialization");
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);

    GLTools.glCheckError("finalizing FBO initialization");
    glEnable(GL11.GL_BLEND);
    GLTools.glCheckError("finalizing FBO initialization");
    GL20.glBlendEquationSeparate(GL14.GL_FUNC_ADD, GL14.GL_MAX);
    GLTools.glCheckError("finalizing FBO initialization");
    GL14.glBlendFuncSeparate(GL11.GL_ONE, GL11.GL_ZERO, GL11.GL_ZERO, GL11.GL_ZERO);
    GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, 0);
    GLTools.glCheckError("finalizing FBO initialization");
}
项目:HeroMod    文件:TextureUtil.java   
public static void loadTextureMipmap(int tex, int[] rgb, int width, int height) {
    IntBuffer rgbBuf = BufferUtils.createIntBuffer(rgb.length);
    rgbBuf.put(rgb);
    rgbBuf.flip();

    bind(tex);

    //If OpenGL30, use glGenerateMipmap, else use the GL_GENERATE_MIPMAP tex param
    if (RenderUtil.GL_30) {
        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, width, height,
                0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, rgbBuf);
        GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);
    } else {
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL14.GL_GENERATE_MIPMAP, GL11.GL_TRUE);
        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, width, height,
                0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, rgbBuf);
    }
}
项目:LookingGlass    文件:FrameBufferContainer.java   
private void allocateFrameBuffer() {
    if (this.framebuffer != 0) return;

    this.framebuffer = EXTFramebufferObject.glGenFramebuffersEXT(); //Release via: EXTFramebufferObject.glDeleteFramebuffersEXT(framebuffer);
    this.depthBuffer = EXTFramebufferObject.glGenRenderbuffersEXT(); //Release via: EXTFramebufferObject.glDeleteRenderbuffersEXT(depthBuffer);

    EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, this.framebuffer);

    EXTFramebufferObject.glBindRenderbufferEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, depthBuffer);
    if (MinecraftForgeClient.getStencilBits() == 0) EXTFramebufferObject.glRenderbufferStorageEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, GL14.GL_DEPTH_COMPONENT24, width, height);
    else EXTFramebufferObject.glRenderbufferStorageEXT(EXTFramebufferObject.GL_RENDERBUFFER_EXT, org.lwjgl.opengl.EXTPackedDepthStencil.GL_DEPTH24_STENCIL8_EXT, width, height);

    EXTFramebufferObject.glFramebufferRenderbufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, EXTFramebufferObject.GL_RENDERBUFFER_EXT, depthBuffer);
    if (MinecraftForgeClient.getStencilBits() != 0) EXTFramebufferObject.glFramebufferRenderbufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, EXTFramebufferObject.GL_RENDERBUFFER_EXT, depthBuffer);

    this.texture = GL11.glGenTextures(); //Release via: GL11.glDeleteTextures(colorTexture);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.texture);
    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, width, height, 0, GL11.GL_RGBA, GL11.GL_INT, (java.nio.ByteBuffer) null);
    EXTFramebufferObject.glFramebufferTexture2DEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, EXTFramebufferObject.GL_COLOR_ATTACHMENT0_EXT, GL11.GL_TEXTURE_2D, this.texture, 0);

    EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, 0);
}
项目:Mystic-Bastion    文件:Loader.java   
public int loadTexture(String fileName) {
    Texture texture = null;
    try {
        texture = TextureLoader.getTexture("PNG",
                new FileInputStream(MainGameLoop.fileManager.getTextureFile(fileName)));
        GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, 0);
        if (GLContext.getCapabilities().GL_EXT_texture_filter_anisotropic) {
            float amount = Math.min(4f,
                    GL11.glGetFloat(EXTTextureFilterAnisotropic.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT));
            GL11.glTexParameterf(GL11.GL_TEXTURE_2D, EXTTextureFilterAnisotropic.GL_TEXTURE_MAX_ANISOTROPY_EXT,
                    amount);
        } else {
            System.out.println("Filter Anisotropic Not Supported");
        }
    } catch (Exception e) {
        e.printStackTrace();
        System.err.println("Tried to load texture " + fileName + ".png , didn't work");
        System.exit(-1);
    }
    textures.add(texture.getTextureID());
    return texture.getTextureID();
}
项目:Resilience-Client-Source    文件:TextureUtil.java   
public static void func_147946_a(int p_147946_0_, int p_147946_1_, int p_147946_2_, int p_147946_3_, float p_147946_4_)
{
    deleteTexture(p_147946_0_);
    bindTexture(p_147946_0_);

    if (OpenGlHelper.anisotropicFilteringSupported)
    {
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, 34046, p_147946_4_);
    }

    if (p_147946_1_ > 0)
    {
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, p_147946_1_);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MIN_LOD, 0.0F);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LOD, (float)p_147946_1_);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, 0.0F);
    }

    for (int var5 = 0; var5 <= p_147946_1_; ++var5)
    {
        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, var5, GL11.GL_RGBA, p_147946_2_ >> var5, p_147946_3_ >> var5, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)null);
    }
}
项目:opsu    文件:CurveRenderState.java   
/**
 * Reads the first row of the slider gradient texture and upload it as
 * a 1D texture to OpenGL if it hasn't already been done.
 */
public void initGradient() {
    if (gradientTexture == 0) {
        Image slider = GameImage.SLIDER_GRADIENT.getImage().getScaledCopy(1.0f / GameImage.getUIscale());
        staticState.gradientTexture = GL11.glGenTextures();
        ByteBuffer buff = BufferUtils.createByteBuffer(slider.getWidth() * 4);
        for (int i = 0; i < slider.getWidth(); ++i) {
            Color col = slider.getColor(i, 0);
            buff.put((byte) (255 * col.r));
            buff.put((byte) (255 * col.g));
            buff.put((byte) (255 * col.b));
            buff.put((byte) (255 * col.a));
        }
        buff.flip();
        GL11.glBindTexture(GL11.GL_TEXTURE_1D, gradientTexture);
        GL11.glTexImage1D(GL11.GL_TEXTURE_1D, 0, GL11.GL_RGBA, slider.getWidth(), 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, buff);
        ContextCapabilities capabilities = GLContext.getCapabilities();
        if (capabilities.OpenGL30) {
            GL30.glGenerateMipmap(GL11.GL_TEXTURE_1D);
        } else if (capabilities.GL_EXT_framebuffer_object) {
            EXTFramebufferObject.glGenerateMipmapEXT(GL11.GL_TEXTURE_1D);
        } else {
            GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL14.GL_GENERATE_MIPMAP, GL11.GL_TRUE);
        }
    }
}
项目:ExpandedRailsMod    文件:OpenGlHelper.java   
public static void glBlendFunc(int sFactorRGB, int dFactorRGB, int sfactorAlpha, int dfactorAlpha)
{
    if (openGL14)
    {
        if (extBlendFuncSeparate)
        {
            EXTBlendFuncSeparate.glBlendFuncSeparateEXT(sFactorRGB, dFactorRGB, sfactorAlpha, dfactorAlpha);
        }
        else
        {
            GL14.glBlendFuncSeparate(sFactorRGB, dFactorRGB, sfactorAlpha, dfactorAlpha);
        }
    }
    else
    {
        GL11.glBlendFunc(sFactorRGB, dFactorRGB);
    }
}
项目:Cauldron    文件:OpenGlHelper.java   
public static void glBlendFunc(int p_148821_0_, int p_148821_1_, int p_148821_2_, int p_148821_3_)
{
    if (openGL14)
    {
        if (field_153211_u)
        {
            EXTBlendFuncSeparate.glBlendFuncSeparateEXT(p_148821_0_, p_148821_1_, p_148821_2_, p_148821_3_);
        }
        else
        {
            GL14.glBlendFuncSeparate(p_148821_0_, p_148821_1_, p_148821_2_, p_148821_3_);
        }
    }
    else
    {
        GL11.glBlendFunc(p_148821_0_, p_148821_1_);
    }
}
项目:Cauldron    文件:TextureUtil.java   
public static void allocateTextureImpl(int p_147946_0_, int p_147946_1_, int p_147946_2_, int p_147946_3_, float p_147946_4_)
{
    deleteTexture(p_147946_0_);
    bindTexture(p_147946_0_);

    if (OpenGlHelper.anisotropicFilteringSupported)
    {
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, 34046, p_147946_4_);
    }

    if (p_147946_1_ > 0)
    {
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, p_147946_1_);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MIN_LOD, 0.0F);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LOD, (float)p_147946_1_);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, 0.0F);
    }

    for (int i1 = 0; i1 <= p_147946_1_; ++i1)
    {
        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, i1, GL11.GL_RGBA, p_147946_2_ >> i1, p_147946_3_ >> i1, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)null);
    }
}
项目:Cauldron    文件:OpenGlHelper.java   
public static void glBlendFunc(int p_148821_0_, int p_148821_1_, int p_148821_2_, int p_148821_3_)
{
    if (openGL14)
    {
        if (field_153211_u)
        {
            EXTBlendFuncSeparate.glBlendFuncSeparateEXT(p_148821_0_, p_148821_1_, p_148821_2_, p_148821_3_);
        }
        else
        {
            GL14.glBlendFuncSeparate(p_148821_0_, p_148821_1_, p_148821_2_, p_148821_3_);
        }
    }
    else
    {
        GL11.glBlendFunc(p_148821_0_, p_148821_1_);
    }
}
项目:Cauldron    文件:TextureUtil.java   
public static void allocateTextureImpl(int p_147946_0_, int p_147946_1_, int p_147946_2_, int p_147946_3_, float p_147946_4_)
{
    deleteTexture(p_147946_0_);
    bindTexture(p_147946_0_);

    if (OpenGlHelper.anisotropicFilteringSupported)
    {
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, 34046, p_147946_4_);
    }

    if (p_147946_1_ > 0)
    {
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, p_147946_1_);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MIN_LOD, 0.0F);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LOD, (float)p_147946_1_);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, 0.0F);
    }

    for (int i1 = 0; i1 <= p_147946_1_; ++i1)
    {
        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, i1, GL11.GL_RGBA, p_147946_2_ >> i1, p_147946_3_ >> i1, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)null);
    }
}
项目:DecompiledMinecraft    文件:JsonBlendingMode.java   
public void func_148109_a()
{
    if (!this.equals(field_148118_a))
    {
        if (field_148118_a == null || this.field_148119_h != field_148118_a.func_148111_b())
        {
            field_148118_a = this;

            if (this.field_148119_h)
            {
                GlStateManager.disableBlend();
                return;
            }

            GlStateManager.enableBlend();
        }

        GL14.glBlendEquation(this.field_148112_f);

        if (this.field_148113_g)
        {
            GlStateManager.tryBlendFuncSeparate(this.field_148116_b, this.field_148114_d, this.field_148117_c, this.field_148115_e);
        }
        else
        {
            GlStateManager.blendFunc(this.field_148116_b, this.field_148114_d);
        }
    }
}
项目:BaseClient    文件:TextureUtil.java   
public static void allocateTextureImpl(int p_180600_0_, int p_180600_1_, int p_180600_2_, int p_180600_3_)
{
    Object object = TextureUtil.class;

    if (Reflector.SplashScreen.exists())
    {
        object = Reflector.SplashScreen.getTargetClass();
    }

    synchronized (object)
    {
        deleteTexture(p_180600_0_);
        bindTexture(p_180600_0_);
    }

    if (p_180600_1_ >= 0)
    {
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LEVEL, p_180600_1_);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MIN_LOD, 0.0F);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL12.GL_TEXTURE_MAX_LOD, (float)p_180600_1_);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, 0.0F);
    }

    for (int i = 0; i <= p_180600_1_; ++i)
    {
        GL11.glTexImage2D(GL11.GL_TEXTURE_2D, i, GL11.GL_RGBA, p_180600_2_ >> i, p_180600_3_ >> i, 0, GL12.GL_BGRA, GL12.GL_UNSIGNED_INT_8_8_8_8_REV, (IntBuffer)((IntBuffer)null));
    }
}
项目:BaseClient    文件:JsonBlendingMode.java   
public void func_148109_a()
{
    if (!this.equals(field_148118_a))
    {
        if (field_148118_a == null || this.field_148119_h != field_148118_a.func_148111_b())
        {
            field_148118_a = this;

            if (this.field_148119_h)
            {
                GlStateManager.disableBlend();
                return;
            }

            GlStateManager.enableBlend();
        }

        GL14.glBlendEquation(this.field_148112_f);

        if (this.field_148113_g)
        {
            GlStateManager.tryBlendFuncSeparate(this.field_148116_b, this.field_148114_d, this.field_148117_c, this.field_148115_e);
        }
        else
        {
            GlStateManager.blendFunc(this.field_148116_b, this.field_148114_d);
        }
    }
}
项目:BaseClient    文件:JsonBlendingMode.java   
public void func_148109_a()
{
    if (!this.equals(field_148118_a))
    {
        if (field_148118_a == null || this.field_148119_h != field_148118_a.func_148111_b())
        {
            field_148118_a = this;

            if (this.field_148119_h)
            {
                GlStateManager.disableBlend();
                return;
            }

            GlStateManager.enableBlend();
        }

        GL14.glBlendEquation(this.field_148112_f);

        if (this.field_148113_g)
        {
            GlStateManager.tryBlendFuncSeparate(this.field_148116_b, this.field_148114_d, this.field_148117_c, this.field_148115_e);
        }
        else
        {
            GlStateManager.blendFunc(this.field_148116_b, this.field_148114_d);
        }
    }
}
项目:CommunityEngine-Java    文件:TextureLoader.java   
public static Texture loadTexture(String textureFile) {
        try {
//          InputStream in = TextureLoader.class.getResourceAsStream("/" + textureFile);
            InputStream in = Util.loadInternal(textureFile);
            BufferedImage image = ImageIO.read(in);

            int[] pixels = new int[image.getWidth() * image.getHeight()];
            image.getRGB(0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth());
            ByteBuffer buffer = ByteBuffer.allocateDirect(image.getWidth() * image.getHeight() * 4);

            for(int h = 0; h < image.getHeight(); h++) {
                for(int w = 0; w < image.getWidth(); w++) {
                    int pixel = pixels[h * image.getWidth() + w];

                    buffer.put((byte) ((pixel >> 16) & 0xFF));
                    buffer.put((byte) ((pixel >> 8) & 0xFF));
                    buffer.put((byte) (pixel & 0xFF));
                    buffer.put((byte) ((pixel >> 24) & 0xFF));
                }
            }

            buffer.flip();
            in.close();

            int textureID = GL11.glGenTextures();
            GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID);
            GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, image.getWidth(), image.getHeight(), 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, buffer);

            GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);
            GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_NEAREST);
            GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_MAX_TEXTURE_LOD_BIAS, -1);
            GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);

            return new Texture(textureID, image.getWidth(), image.getHeight());
        } catch (Exception e) {
            e.printStackTrace();

            return null;
        }
    }
项目:OpenGL-Animation    文件:TextureUtils.java   
protected static int loadTextureToOpenGL(TextureData data, TextureBuilder builder) {
    int texID = GL11.glGenTextures();
    GL13.glActiveTexture(GL13.GL_TEXTURE0);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texID);
    GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, data.getWidth(), data.getHeight(), 0, GL12.GL_BGRA,
            GL11.GL_UNSIGNED_BYTE, data.getBuffer());
    if (builder.isMipmap()) {
        GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);
        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_MIPMAP_LINEAR);
        if (builder.isAnisotropic() && GLContext.getCapabilities().GL_EXT_texture_filter_anisotropic) {
            GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, 0);
            GL11.glTexParameterf(GL11.GL_TEXTURE_2D, EXTTextureFilterAnisotropic.GL_TEXTURE_MAX_ANISOTROPY_EXT,
                    4.0f);
        }
    } else if (builder.isNearest()) {
        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);
    }
    if (builder.isClampEdges()) {
        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);
    } else {
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);
    }
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
    return texID;
}
项目:OcclusionQueries    文件:WaterFrameBuffers.java   
private int createDepthTextureAttachment(int width, int height){
    int texture = GL11.glGenTextures();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL14.GL_DEPTH_COMPONENT32, width, height,
            0, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (ByteBuffer) null);
    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);
    GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT,
            texture, 0);
    return texture;
}
项目:OcclusionQueries    文件:TextureUtils.java   
protected static int loadTextureToOpenGL(TextureData data, TextureBuilder builder) {
    int texID = GL11.glGenTextures();
    GL13.glActiveTexture(GL13.GL_TEXTURE0);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texID);
    GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, data.getWidth(), data.getHeight(), 0, GL12.GL_BGRA,
            GL11.GL_UNSIGNED_BYTE, data.getBuffer());
    if (builder.isMipmap()) {
        GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);
        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_MIPMAP_LINEAR);
        if (builder.isAnisotropic() && GLContext.getCapabilities().GL_EXT_texture_filter_anisotropic) {
            GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, 0);
            GL11.glTexParameterf(GL11.GL_TEXTURE_2D, EXTTextureFilterAnisotropic.GL_TEXTURE_MAX_ANISOTROPY_EXT,
                    4.0f);
        }
    } else if (builder.isNearest()) {
        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);
    }
    if (builder.isClampEdges()) {
        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);
    } else {
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);
    }
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
    return texID;
}
项目:3d-Engine    文件:WaterFrameBuffers.java   
private int createDepthTextureAttachment(int width, int height){
    int texture = GL11.glGenTextures();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL14.GL_DEPTH_COMPONENT32, width, height,
            0, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (ByteBuffer) null);
    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);
    GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT,
            texture, 0);
    return texture;
}
项目:MineLittlePony    文件:LayerHeldPonyItem.java   
public void renderItemGlow(EntityLivingBase entity, ItemStack drop, ItemCameraTransforms.TransformType transform, EnumHandSide hand,
        int glowColor) {

    // enchantments mess up the rendering
    ItemStack drop2 = drop.copy();
    if (drop2.hasEffect()) {
        removeEnch(drop2.getTagCompound());
    }
    float red = (glowColor >> 16 & 255) / 255.0F;
    float green = (glowColor >> 8 & 255) / 255.0F;
    float blue = (glowColor & 255) / 255.0F;
    float alpha = 0.2F;

    pushMatrix();
    disableLighting();

    GL14.glBlendColor(red, green, blue, alpha);

    RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
    ((IRenderItem) renderItem).useTransparency(true);

    scale(1.1, 1.1, 1.1);

    translate(0, .01, .01);
    renderItem.renderItem(drop, entity, transform, hand == EnumHandSide.LEFT);
    translate(.01, -.01, -.02);
    renderItem.renderItem(drop, entity, transform, hand == EnumHandSide.LEFT);

    ((IRenderItem) renderItem).useTransparency(false);
    enableLighting();
    popMatrix();

    // I hate rendering
}
项目:sandbox    文件:Fbo.java   
private void createDepthTextureAttachment() {
    depthTexture = GL11.glGenTextures();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, depthTexture);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL14.GL_DEPTH_COMPONENT24, width, height, 0, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (ByteBuffer) null);
    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);
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, GL11.GL_TEXTURE_2D, depthTexture, 0);
}
项目:sandbox    文件:WaterFrameBuffers.java   
private int createDepthTextureAttachment(int width, int height) {
    int texture = GL11.glGenTextures();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL14.GL_DEPTH_COMPONENT32, width, height, 0, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (ByteBuffer) null);
    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);
    if (DisplayManager.hasAttribs()) GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, texture, 0);
    return texture;
}
项目:sandbox    文件:ShadowFrameBuffer.java   
private static int createDepthBufferAttachment(int width, int height) {
    int texture = GL11.glGenTextures();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL14.GL_DEPTH_COMPONENT16, width, height, 0, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (ByteBuffer) null);
    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);
    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);
    if (DisplayManager.hasAttribs()) GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, texture, 0);
    return texture;
}
项目:sandbox    文件:Loader.java   
public int loadTexture(boolean root, String directory, String file, float bias) {
    Texture texture = null;
    if (!file.toLowerCase().endsWith(".png")) file += ".png";
    try {
        String path = directory + "/" + file;
        if (!root) path = "assets/" + path;
        texture = TextureLoader.getTexture("PNG", net.gogo98901.util.Loader.getResourceAsStream(path));
        GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, bias);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
        GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);
        if (directory != "fonts") {
            if (GLContext.getCapabilities().GL_EXT_texture_filter_anisotropic) {
                if (Config.anisotropic.get()) {
                    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, 0F);

                    float amount = Math.min(4F, GL11.glGetFloat(EXTTextureFilterAnisotropic.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT));
                    GL11.glTexParameterf(GL11.GL_TEXTURE_2D, EXTTextureFilterAnisotropic.GL_TEXTURE_MAX_ANISOTROPY_EXT, amount);
                } else {
                    Log.info("GL: Anisotropic filtering disabled by config");
                }
            } else {
                Log.warn("GL: Anisotropic filtering not supported");
            }
        }
    } catch (IOException e) {
        Log.warn("Could not read texture '" + file + "'");
        Log.stackTrace(e);
    }
    textures.add(texture.getTextureID());
    return texture.getTextureID();
}
项目:FastDMM    文件:DMI.java   
public void createGL() {
    if (image == null || glID != -1)
        return;
    int[] pixels = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();
    image.getRGB(0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth());

    ByteBuffer buffer = BufferUtils.createByteBuffer(image.getWidth() * image.getHeight() * 4); //4 for RGBA, 3 for RGB

    for (int y = 0; y < image.getHeight(); y++) {
        for (int x = 0; x < image.getWidth(); x++) {
            int pixel = pixels[y * image.getWidth() + x];
            buffer.put((byte) ((pixel >> 16) & 0xFF));     // Red component
            buffer.put((byte) ((pixel >> 8) & 0xFF));      // Green component
            buffer.put((byte) (pixel & 0xFF));               // Blue component
            buffer.put((byte) ((pixel >> 24) & 0xFF));    // Alpha component. Only for RGBA
        }
    }

    buffer.flip(); //FOR THE LOVE OF GOD DO NOT FORGET THIS

    // You now have a ByteBuffer filled with the color data of each pixel.
    // Now just create a texture ID and bind it. Then you can load it using 
    // whatever OpenGL method you want, for example:
    glID = glGenTextures();
    glBindTexture(GL_TEXTURE_2D, glID);

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

    //Setup texture scaling filtering
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

    glTexParameteri(GL_TEXTURE_2D, GL14.GL_GENERATE_MIPMAP, GL_TRUE);

    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, image.getWidth(), image.getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
}
项目:origin    文件:Shadow.java   
public Shadow(GameCamera camera, Render render)
{
    _camera = camera;

    _frameBuffer = new DepthFrameBuffer(Pixmap.Format.RGBA8888, SHADOW_MAP_SIZE, SHADOW_MAP_SIZE, true, false, true);
    _frameBuffer.setHasDepthTexture(true);
    _frameBuffer.setDepthBufferSize(GL14.GL_DEPTH_COMPONENT16);
    _frameBuffer.setDepthTextureFilter(Texture.TextureFilter.Nearest);
    _frameBuffer.setDepthTextureWrap(Texture.TextureWrap.ClampToEdge);
    _frameBuffer.build();
    _modelBatch = new ModelBatch(new ShadowShaderProvider(render.getShadowShader()));
    _shadowBox = new ShadowBox(camera);
}
项目:origin    文件:DepthFrameBuffer.java   
/**
 * старый но! рабочий код) создания текстуры для буфера глубины. оставлен для истории
 */
@Deprecated
public void createDepthTextre(Texture.TextureFilter filter, Texture.TextureWrap wrap)
{
    // сначала биндим наш буфер
    gl.glBindFramebuffer(GL20.GL_FRAMEBUFFER, getFramebufferHandle());

    // создаем текстуру
    _depthTexture = gl.glGenTexture();
    // биндим ее
    gl.glBindTexture(GL11.GL_TEXTURE_2D, _depthTexture);
    gl.glTexImage2D(
            GL11.GL_TEXTURE_2D, 0,
            GL14.GL_DEPTH_COMPONENT16, width, height,
            0, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, null);
    // сделаем сглаживание
    gl.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, filter.getGLEnum());
    gl.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, filter.getGLEnum());
    gl.glTexParameteri(GL11.GL_TEXTURE_2D, GL20.GL_TEXTURE_WRAP_S, wrap.getGLEnum());
    gl.glTexParameteri(GL11.GL_TEXTURE_2D, GL20.GL_TEXTURE_WRAP_T, wrap.getGLEnum());
    // связываем нашу текстуру с буфером
    gl.glFramebufferTexture2D(GL20.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT,
                              GL20.GL_TEXTURE_2D,
                              _depthTexture, 0);

    // а вот тут может случится ата-та. т.к. надо знать ид буфера экрана. см код libgdx
    gl.glBindFramebuffer(GL20.GL_FRAMEBUFFER, 0);
}
项目:senjin    文件:SimpleAntiAliasing.java   
public void initAA(int w, int h) {
        // init our fbo
        textureW = w * x;
        textureH = h * x;
        this.w = w;
        this.h = h;

        framebufferID = glGenFramebuffers();                                            // create a new framebuffer
        colorTextureID = glGenTextures();                                               // and a new texture used as a color buffer
        depthRenderBufferID = glGenRenderbuffers();                                 // And finally a new depthbuffer

        glBindFramebuffer(GL_FRAMEBUFFER_EXT, framebufferID);                       // switch to the new framebuffer

        // initialize color texture
        glBindTexture(GL_TEXTURE_2D, colorTextureID);                                   // Bind the colorbuffer texture
//        glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);             // make it linear filterd
//        glTexParameteri(GL_TEXTURE_2D,
//                SGISGenerateMipmap.GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, textureW, textureH, 0, GL_RGBA, GL_INT, (java.nio.ByteBuffer) null);   // Create the texture data

/////
//        glGenerateMipmap(GL_TEXTURE_2D);

        glFramebufferTexture2D(GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT,GL_TEXTURE_2D, colorTextureID, 0); // attach it to the framebuffer


        // initialize depth renderbuffer
        glBindRenderbuffer(GL_RENDERBUFFER_EXT, depthRenderBufferID);               // bind the depth renderbuffer
        glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL14.GL_DEPTH_COMPONENT24, textureW, textureH);  // get the data space for it
        glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT,GL_DEPTH_ATTACHMENT_EXT,GL_RENDERBUFFER_EXT, depthRenderBufferID); // bind it to the renderbuffer

        glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0);                                   // Swithch back to normal framebuffer rendering
    }
项目:senjin    文件:FrameBuffer.java   
public FrameBuffer initFBO(SomeTexture... tt) {
    // init our fbo
    if (textures != null) {
        for (SomeTexture texture : textures) texture.release();
    }
    this.textures = al(tt);
    w = textures.car().width;
    h = textures.car().height;
    for (SomeTexture t : textures) if (t.width != w || t.height != h) BadException.die("all textures must be of same size");
    framebufferID = glGenFramebuffers();                                            // create a new framebuffer
    depthRenderBufferID = glGenRenderbuffers();                                 // And finally a new depthbuffer
    glBindFramebuffer(GL_FRAMEBUFFER_EXT, framebufferID);                       // switch to the new framebuffer

    IntBuffer drawBufferParam;
    drawBufferParam = BufferUtils.createIntBuffer(tt.length);
    for (int i = 0; i < tt.length; i++) {
        drawBufferParam.put(GL_COLOR_ATTACHMENT0_EXT + i);
        glBindTexture(GL_TEXTURE_2D, tt[i].textureObjectId);
        glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT + i, GL_TEXTURE_2D, tt[i].textureObjectId, 0); // attach texture to the framebuffer
    }
    drawBufferParam.rewind();
    GL20.glDrawBuffers(drawBufferParam);



    // initialize depth renderbuffer
    glBindRenderbuffer(GL_RENDERBUFFER_EXT, depthRenderBufferID);               // bind the depth renderbuffer
    glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL14.GL_DEPTH_COMPONENT32, tt[0].width, tt[0].height);   // get the data space for it
    glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT,GL_DEPTH_ATTACHMENT_EXT,GL_RENDERBUFFER_EXT, depthRenderBufferID); // bind it to the renderbuffer
    int result = glCheckFramebufferStatus(GL_FRAMEBUFFER);
    if (result != GL_FRAMEBUFFER_COMPLETE) BadException.die("Wrong FBO status: " + result);
    glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0);                                   // Swithch back to normal framebuffer rendering

    Util.checkGLError();

    return this;
}