Example usage for org.lwjgl.opengl GL11 glDepthMask

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

Introduction

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

Prototype

public static void glDepthMask(@NativeType("GLboolean") boolean flag) 

Source Link

Document

Masks the writing of depth values to the depth buffer.

Usage

From source file:com.minestellar.moon.world.SkyRendererMoon.java

License:Open Source License

@Override
public void render(float partialTicks, WorldClient world, Minecraft mc) {
    WorldProviderMoon gcProvider = null;

    if (world.provider instanceof WorldProviderMoon) {
        gcProvider = (WorldProviderMoon) world.provider;
    }//from   w  ww.  j a  v  a  2 s .c om

    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glColor3f(1, 1, 1);
    final Tessellator var23 = Tessellator.instance;
    GL11.glDepthMask(false);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glColor3f(0, 0, 0);
    GL11.glCallList(this.glSkyList);
    GL11.glDisable(GL11.GL_FOG);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    RenderHelper.disableStandardItemLighting();
    float var10;
    float var11;
    float var12;

    float var20 = 0;

    if (gcProvider != null) {
        var20 = gcProvider.getStarBrightness(partialTicks);
    }

    if (var20 > 0.0F) {
        GL11.glColor4f(1.0F, 1.0F, 1.0F, var20);
        GL11.glCallList(this.starGLCallList);
    }

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    GL11.glPushMatrix();

    GL11.glPopMatrix();

    GL11.glPushMatrix();

    // SUN:
    GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 5F);
    GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);
    var12 = 30.0F;
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(SkyRendererMoon.sunTexture);
    var23.startDrawingQuads();
    var23.addVertexWithUV(-var12, 150.0D, -var12, 0.0D, 0.0D);
    var23.addVertexWithUV(var12, 150.0D, -var12, 1.0D, 0.0D);
    var23.addVertexWithUV(var12, 150.0D, var12, 1.0D, 1.0D);
    var23.addVertexWithUV(-var12, 150.0D, var12, 0.0D, 1.0D);
    var23.draw();

    GL11.glPopMatrix();

    GL11.glPushMatrix();

    GL11.glDisable(GL11.GL_BLEND);

    // EARTH:
    var12 = 50.0F;
    final float earthRotation = (float) (world.getSpawnPoint().posZ - mc.thePlayer.posZ) * 0.01F;
    GL11.glScalef(0.6F, 0.6F, 0.6F);
    GL11.glRotatef(earthRotation, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(200F, 1.0F, 0.0F, 0.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1F);
    FMLClientHandler.instance().getClient().renderEngine.bindTexture(SkyRendererMoon.earthTexture);
    world.getMoonPhase();
    var23.startDrawingQuads();
    var23.addVertexWithUV(-var12, -400.0D, var12, 0, 1);
    var23.addVertexWithUV(var12, -400.0D, var12, 1, 1);
    var23.addVertexWithUV(var12, -400.0D, -var12, 1, 0);
    var23.addVertexWithUV(-var12, -400.0D, -var12, 0, 0);
    var23.draw();

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_FOG);
    GL11.glPopMatrix();
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glColor3f(0.0F, 0.0F, 0.0F);
    final double var25 = mc.thePlayer.getPosition(partialTicks).yCoord - world.getHorizon();

    if (var25 < 0.0D) {
        GL11.glPushMatrix();
        GL11.glTranslatef(0.0F, 12.0F, 0.0F);
        GL11.glCallList(this.glSkyList2);
        GL11.glPopMatrix();
        var10 = 1.0F;
        var11 = -((float) (var25 + 65.0D));
        var12 = -var10;
        var23.startDrawingQuads();
        var23.setColorRGBA_I(0, 255);
        var23.addVertex(-var10, var11, var10);
        var23.addVertex(var10, var11, var10);
        var23.addVertex(var10, var12, var10);
        var23.addVertex(-var10, var12, var10);
        var23.addVertex(-var10, var12, -var10);
        var23.addVertex(var10, var12, -var10);
        var23.addVertex(var10, var11, -var10);
        var23.addVertex(-var10, var11, -var10);
        var23.addVertex(var10, var12, -var10);
        var23.addVertex(var10, var12, var10);
        var23.addVertex(var10, var11, var10);
        var23.addVertex(var10, var11, -var10);
        var23.addVertex(-var10, var11, -var10);
        var23.addVertex(-var10, var11, var10);
        var23.addVertex(-var10, var12, var10);
        var23.addVertex(-var10, var12, -var10);
        var23.addVertex(-var10, var12, -var10);
        var23.addVertex(-var10, var12, var10);
        var23.addVertex(var10, var12, var10);
        var23.addVertex(var10, var12, -var10);
        var23.draw();
    }

    GL11.glColor3f(70F / 256F, 70F / 256F, 70F / 256F);

    GL11.glPushMatrix();
    GL11.glTranslatef(0.0F, -((float) (var25 - 16.0D)), 0.0F);
    GL11.glCallList(this.glSkyList2);
    GL11.glPopMatrix();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDepthMask(true);
}

From source file:com.mtbs3d.minecrift.VRRenderer.java

License:LGPL

public void renderWorld(float renderPartialTicks, long nextFrameTime, int renderSceneNumber) {
    RenderGlobal renderGlobal = this.mc.renderGlobal;
    EffectRenderer effectRenderer = this.mc.effectRenderer;
    EntityLivingBase renderViewEntity = this.mc.renderViewEntity;

    //TODO: fog color isn't quite right yet when eyes split water/air
    this.updateFogColor(renderPartialTicks);
    GL11.glClearColor(fogColorRed, fogColorGreen, fogColorBlue, 0.5f);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    GL11.glEnable(GL11.GL_CULL_FACE);/*from ww  w.ja va 2 s .  c  om*/
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    //mc.checkGLError("FBO init");

    this.mc.mcProfiler.startSection("lightTex");
    if (this.lightmapUpdateNeeded) {
        this.updateLightmap(renderPartialTicks);
    }

    ActiveRenderInfo.updateRenderInfo(this.mc.thePlayer, this.mc.gameSettings.thirdPersonView == 2);
    this.mc.mcProfiler.endStartSection("frustrum");
    ClippingHelperImpl.getInstance(); // setup clip, using current modelview / projection matrices

    if (!Config.isSkyEnabled() && !Config.isSunMoonEnabled() && !Config.isStarsEnabled()) {
        GL11.glDisable(GL11.GL_BLEND);
    } else {
        this.setupFog(-1, renderPartialTicks);
        this.mc.mcProfiler.endStartSection("sky");
        renderGlobal.renderSky(renderPartialTicks);
    }

    GL11.glEnable(GL11.GL_FOG);
    this.setupFog(1, renderPartialTicks);

    if (this.mc.gameSettings.ambientOcclusion != 0) {
        GL11.glShadeModel(GL11.GL_SMOOTH);
    }

    this.mc.mcProfiler.endStartSection("culling");
    Frustrum frustrum = new Frustrum();
    frustrum.setPosition(renderOriginX, renderOriginY, renderOriginZ);

    this.mc.renderGlobal.clipRenderersByFrustum(frustrum, renderPartialTicks);

    if (renderSceneNumber == 0) {
        this.mc.mcProfiler.endStartSection("updatechunks");

        while (!this.mc.renderGlobal.updateRenderers(renderViewEntity, false) && nextFrameTime != 0L) {
            long var15 = nextFrameTime - System.nanoTime();

            if (var15 < 0L || var15 > 1000000000L) {
                break;
            }
        }
    }

    if (renderViewEntity.posY < 128.0D) {
        this.renderCloudsCheck(renderGlobal, renderPartialTicks);
    }

    this.mc.mcProfiler.endStartSection("prepareterrain");
    this.setupFog(0, renderPartialTicks);
    GL11.glEnable(GL11.GL_FOG);
    this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
    RenderHelper.disableStandardItemLighting();
    this.mc.mcProfiler.endStartSection("terrain");
    renderGlobal.sortAndRender(renderViewEntity, 0, (double) renderPartialTicks);
    GL11.glShadeModel(GL11.GL_FLAT);
    boolean var16 = Reflector.ForgeHooksClient.exists();
    EntityPlayer var18;

    if (this.debugViewDirection == 0) {
        RenderHelper.enableStandardItemLighting();
        this.mc.mcProfiler.endStartSection("entities");

        if (var16) {
            Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[] { Integer.valueOf(0) });
        }

        //TODO: multiple render passes for entities?
        renderGlobal.renderEntities(renderViewEntity.getPosition(renderPartialTicks), frustrum,
                renderPartialTicks);

        if (var16) {
            Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[] { Integer.valueOf(-1) });
        }

        RenderHelper.disableStandardItemLighting();

    }

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDepthMask(true);
    this.setupFog(0, renderPartialTicks);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_CULL_FACE);

    this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
    WrUpdates.resumeBackgroundUpdates();

    if (Config.isWaterFancy()) {
        this.mc.mcProfiler.endStartSection("water");

        if (this.mc.gameSettings.ambientOcclusion != 0) {
            GL11.glShadeModel(GL11.GL_SMOOTH);
        }

        GL11.glColorMask(false, false, false, false);
        int var17 = renderGlobal.renderAllSortedRenderers(1, (double) renderPartialTicks);

        if (this.mc.gameSettings.anaglyph) {
            if (anaglyphField == 0) {
                GL11.glColorMask(false, true, true, true);
            } else {
                GL11.glColorMask(true, false, false, true);
            }
        } else {
            GL11.glColorMask(true, true, true, true);
        }

        if (var17 > 0) {
            renderGlobal.renderAllSortedRenderers(1, (double) renderPartialTicks);
        }

        GL11.glShadeModel(GL11.GL_FLAT);
    } else {
        this.mc.mcProfiler.endStartSection("water");
        renderGlobal.renderAllSortedRenderers(1, (double) renderPartialTicks);
    }

    WrUpdates.pauseBackgroundUpdates();

    if (var16 && this.debugViewDirection == 0) {
        RenderHelper.enableStandardItemLighting();
        this.mc.mcProfiler.endStartSection("entities");
        Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[] { Integer.valueOf(1) });
        this.mc.renderGlobal.renderEntities(renderViewEntity.getPosition(renderPartialTicks), frustrum,
                renderPartialTicks);
        Reflector.callVoid(Reflector.ForgeHooksClient_setRenderPass, new Object[] { Integer.valueOf(-1) });
        RenderHelper.disableStandardItemLighting();
    }

    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDisable(GL11.GL_BLEND);

    boolean renderOutline = this.mc.vrSettings.alwaysRenderBlockOutline || !this.mc.gameSettings.hideGUI;
    if (this.mc.currentScreen == null && this.cameraZoom == 1.0D && renderViewEntity instanceof EntityPlayer
            && this.mc.objectMouseOver != null && !renderViewEntity.isInsideOfMaterial(Material.water)
            && renderOutline) {
        var18 = (EntityPlayer) renderViewEntity;
        GL11.glDisable(GL11.GL_ALPHA_TEST);
        this.mc.mcProfiler.endStartSection("outline");

        if (!var16 || !Reflector.callBoolean(Reflector.ForgeHooksClient_onDrawBlockHighlight,
                new Object[] { renderGlobal, var18, this.mc.objectMouseOver, Integer.valueOf(0),
                        var18.inventory.getCurrentItem(), Float.valueOf(renderPartialTicks) })) {
            renderGlobal.drawSelectionBox(var18, this.mc.objectMouseOver, 0, renderPartialTicks);
        }
        GL11.glEnable(GL11.GL_ALPHA_TEST);
    }

    if (this.mc.currentScreen == null && this.cameraZoom == 1.0D && renderViewEntity instanceof EntityPlayer
            && !renderViewEntity.isInsideOfMaterial(Material.water) && renderOutline
            && this.mc.vrSettings.showEntityOutline) {
        var18 = (EntityPlayer) renderViewEntity;
        if (var18 != null) {
            GL11.glDisable(GL11.GL_ALPHA_TEST);
            this.mc.mcProfiler.endStartSection("entityOutline");

            if (this.bb != null)
                drawBoundingBox(var18, this.bb, renderPartialTicks);

            GL11.glEnable(GL11.GL_ALPHA_TEST);
        }
    }

    this.mc.mcProfiler.endStartSection("destroyProgress");
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    renderGlobal.drawBlockDamageTexture(Tessellator.instance, renderViewEntity, renderPartialTicks);
    GL11.glDisable(GL11.GL_BLEND);
    this.mc.mcProfiler.endStartSection("weather");
    this.renderRainSnow(renderPartialTicks);

    GL11.glDisable(GL11.GL_FOG);

    if (renderViewEntity.posY >= 128.0D) {
        this.renderCloudsCheck(renderGlobal, renderPartialTicks);
    }

    this.enableLightmap((double) renderPartialTicks);
    this.mc.mcProfiler.endStartSection("litParticles");
    RenderHelper.enableStandardItemLighting();
    effectRenderer.renderLitParticles(renderViewEntity, renderPartialTicks);
    RenderHelper.disableStandardItemLighting();
    this.setupFog(0, renderPartialTicks);
    this.mc.mcProfiler.endStartSection("particles");
    effectRenderer.renderParticles(renderViewEntity, renderPartialTicks);
    this.disableLightmap((double) renderPartialTicks);

    if (var16) {
        this.mc.mcProfiler.endStartSection("FRenderLast");
        Reflector.callVoid(Reflector.ForgeHooksClient_dispatchRenderLast,
                new Object[] { renderGlobal, Float.valueOf(renderPartialTicks) });
    }

    if (this.mc.vrSettings.renderFullFirstPersonModel == false) {
        GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
        this.renderHand(renderPartialTicks, renderSceneNumber);
    }

    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); //white crosshair, with blending
    //Draw crosshair
    boolean renderCrosshair = this.mc.vrSettings.alwaysRenderInGameCrosshair || !this.mc.gameSettings.hideGUI;

    if (this.mc.currentScreen == null && this.mc.gameSettings.thirdPersonView == 0 && renderCrosshair) {
        this.mc.mcProfiler.endStartSection("crosshair");
        float crossDepth = (float) Math.sqrt((crossX * crossX + crossY * crossY + crossZ * crossZ));
        float scale = 0.025f * crossDepth * this.mc.vrSettings.crosshairScale;

        GL11.glPushMatrix();
        GL11.glTranslatef(crossX, crossY, crossZ);
        GL11.glRotatef(-this.aimYaw, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(this.aimPitch, 1.0F, 0.0F, 0.0F);
        if (this.mc.vrSettings.crosshairRollsWithHead)
            GL11.glRotatef(this.cameraRoll, 0.0F, 0.0F, 1.0F);
        GL11.glScalef(-scale, -scale, scale);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_ONE_MINUS_DST_COLOR, GL11.GL_ONE_MINUS_SRC_COLOR);
        this.mc.getTextureManager().bindTexture(Gui.icons);

        float var7 = 0.00390625F;
        float var8 = 0.00390625F;
        Tessellator.instance.startDrawingQuads();
        Tessellator.instance.addVertexWithUV(-1, +1, 0, 0, 16 * var8);
        Tessellator.instance.addVertexWithUV(+1, +1, 0, 16 * var7, 16 * var8);
        Tessellator.instance.addVertexWithUV(+1, -1, 0, 16 * var7, 0);
        Tessellator.instance.addVertexWithUV(-1, -1, 0, 0, 0);
        Tessellator.instance.draw();
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glPopMatrix();
        //mc.checkGLError("crosshair");
    }

    this.mc.mcProfiler.endSection();
}

From source file:com.mtbs3d.minecrift.VRRenderer.java

License:LGPL

public void drawBoundingBox(EntityPlayer par1EntityPlayer, AxisAlignedBB bb, float par4) {
    GL11.glEnable(GL11.GL_BLEND);//from  w  w  w .  j av  a 2 s . c o m
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.4F);
    GL11.glLineWidth(2.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDepthMask(false);
    float var5 = 0.002F;
    double var7 = par1EntityPlayer.lastTickPosX
            + (par1EntityPlayer.posX - par1EntityPlayer.lastTickPosX) * (double) par4;
    double var9 = par1EntityPlayer.lastTickPosY
            + (par1EntityPlayer.posY - par1EntityPlayer.lastTickPosY) * (double) par4;
    double var11 = par1EntityPlayer.lastTickPosZ
            + (par1EntityPlayer.posZ - par1EntityPlayer.lastTickPosZ) * (double) par4;
    drawOutlinedBoundingBox(
            bb.expand((double) var5, (double) var5, (double) var5).getOffsetBoundingBox(-var7, -var9, -var11));

    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
}

From source file:com.mtbs3d.minecrift.VRRenderer.java

License:LGPL

public void drawLine(EntityPlayer par1EntityPlayer, Vec3 start, Vec3 end, float par4) {
    GL11.glEnable(GL11.GL_BLEND);//ww  w.j  a va  2 s  . c o  m
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4f(0.0F, 0.0F, 0.0F, 0.4F);
    GL11.glLineWidth(2.0F);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glDepthMask(false);
    float var5 = 0.002F;
    double var7 = par1EntityPlayer.lastTickPosX
            + (par1EntityPlayer.posX - par1EntityPlayer.lastTickPosX) * (double) par4;
    double var9 = par1EntityPlayer.lastTickPosY
            + (par1EntityPlayer.posY - par1EntityPlayer.lastTickPosY) * (double) par4;
    double var11 = par1EntityPlayer.lastTickPosZ
            + (par1EntityPlayer.posZ - par1EntityPlayer.lastTickPosZ) * (double) par4;

    Tessellator var2 = Tessellator.instance;
    var2.startDrawing(GL11.GL_LINE_STRIP);
    var2.addVertex(start.xCoord, start.yCoord, start.zCoord);
    var2.addVertex(end.xCoord, end.yCoord, end.zCoord);
    var2.draw();

    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
}

From source file:com.opengrave.og.base.RenderableLiquid.java

License:Open Source License

@Override
public void render(Matrix4f matrix, RenderStyle style) {
    dealWithChange();/* ww w.  j a  va 2  s  .c om*/
    if (vertexList.size() == 0) {
        return;
    }
    int pID = Resources.loadShader("liquid.vs", "liquid.fs").getProgram();
    GL20.glUseProgram(pID);
    int atlas = GL20.glGetUniformLocation(pID, "arraytexture");
    int normals = GL20.glGetUniformLocation(pID, "arraytexturedata");
    int colours = GL20.glGetUniformLocation(pID, "colours");
    int flows = GL20.glGetUniformLocation(pID, "flows");
    int shadow = GL20.glGetUniformLocation(pID, "shadowMap");

    GL20.glUniform1i(atlas, 0);
    GL20.glUniform1i(normals, 1);
    GL20.glUniform1i(colours, 2);
    GL20.glUniform1i(flows, 3);
    GL20.glUniform1i(shadow, 4);
    GL30.glBindVertexArray(vaoID);

    GL20.glEnableVertexAttribArray(0);
    GL20.glEnableVertexAttribArray(1);
    GL20.glEnableVertexAttribArray(2);

    getContext().setMatrices(pID, matrix);
    textureAtlas.bind(GL13.GL_TEXTURE0);
    normalAtlas.bind(GL13.GL_TEXTURE1);
    getColourTexture().bind(GL13.GL_TEXTURE2);
    getFlowTexture().bind(GL13.GL_TEXTURE3);

    getContext().bindShadowData(GL13.GL_TEXTURE4);
    getContext().bindLights(pID, GL13.GL_TEXTURE5);
    Util.setRenderStyle(pID, style);
    GL11.glDepthMask(false);
    GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, vertexList.size());
    GL11.glDepthMask(true);
    getContext().unbindLights();
    getContext().unbindShadowData();

    textureAtlas.unbind();
    getFlowTexture().unbind();
    getColourTexture().unbind();
    GL20.glDisableVertexAttribArray(0);
    GL20.glDisableVertexAttribArray(1);
    GL20.glDisableVertexAttribArray(2);

    GL30.glBindVertexArray(0);

    GL20.glUseProgram(0);
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
    GL30.glBindVertexArray(0);
}

From source file:com.opengrave.og.base.RenderableParticles.java

License:Open Source License

@Override
public void render(Matrix4f matrix, RenderStyle style) {
    dealWithChange();//from ww  w  .  j  a  v a  2s . c o  m
    if (matList == null || !matList.valid()) {
        return;
    }
    GL30.glBindVertexArray(idVao);
    int pID = Resources.loadShader("particle.vs", "particle.fs").getProgram();
    GL20.glUseProgram(pID);
    GL20.glEnableVertexAttribArray(0);
    GL20.glEnableVertexAttribArray(1);
    GL20.glEnableVertexAttribArray(2);
    GL20.glBindAttribLocation(pID, 0, "in_Position");
    GL20.glBindAttribLocation(pID, 1, "in_Colour");
    GL20.glBindAttribLocation(pID, 2, "in_Scale");
    Util.checkErr();
    int texture = GL20.glGetUniformLocation(pID, "tex");
    GL20.glUniform1i(texture, 0);
    int wSS = GL20.glGetUniformLocation(pID, "windowSizeScale");

    GL20.glUniform1f(wSS, getContext().width / 1024f);
    getContext().setMatrices(pID, matrix);
    if (matList != null && matList.valid()) {
        matList.bind(pID, GL13.GL_TEXTURE0);
    }
    GL11.glEnable(GL20.GL_POINT_SPRITE);
    GL11.glEnable(GL20.GL_VERTEX_PROGRAM_POINT_SIZE);
    GL11.glDepthMask(false);
    GL11.glDrawArrays(GL11.GL_POINTS, 0, size);
    GL11.glDepthMask(true);
    GL11.glDisable(GL20.GL_POINT_SPRITE);
    GL11.glDisable(GL20.GL_VERTEX_PROGRAM_POINT_SIZE);

    if (matList != null && matList.valid()) {
        matList.unbind();
    }
    Util.checkErr();

    GL20.glDisableVertexAttribArray(0);
    GL20.glDisableVertexAttribArray(1);
    GL20.glDisableVertexAttribArray(2);

    Util.checkErr();

    GL20.glUseProgram(0);
    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
    GL30.glBindVertexArray(0);
    Util.checkErr();
}

From source file:com.opengrave.og.engine.StaticObject.java

License:Open Source License

@Override
public void doRenderSemiTransparent(Matrix4f matrix) {
    if (!transparent) {
        return;//  ww  w  . java 2  s  .  com
    }
    renderable.setMaterialList(matList);
    renderable.setContext(context);
    GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);
    GL11.glDepthMask(false);
    renderable.render(matrix, style);
    GL11.glDepthMask(true);
    context.prepare3DTransparent();
}

From source file:com.opengrave.og.light.Depth2DFramebuffer.java

License:Open Source License

@Override
public void bindDraw() {
    Util.checkErr();/*from  www .ja v a 2 s. c o m*/

    for (int i = GL13.GL_TEXTURE0; i < GL13.GL_TEXTURE31; i++) {
        GL13.glActiveTexture(i);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
        GL11.glBindTexture(GL30.GL_TEXTURE_2D_ARRAY, 0);
        GL11.glBindTexture(GL13.GL_TEXTURE_CUBE_MAP, 0);
    }
    Util.checkErr();
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, framebuffer);
    Util.checkErr();
    GL11.glDisable(GL11.GL_BLEND);
    Util.checkErr();
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LESS);
    GL11.glDepthMask(true);
    Util.checkErr();
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    Util.checkErr();
    GL11.glViewport(0, 0, framebufferSize, framebufferSize);

}

From source file:com.opengrave.og.light.DepthCubeFramebuffer.java

License:Open Source License

public void bindDraw(int direction) {
    Util.checkErr();//from   w  w w  . jav  a 2 s. c om
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, framebuffer);
    shadowMap.bindToFrameBuffer(direction);
    Util.checkErr();

    Util.checkErr();
    GL11.glDisable(GL11.GL_BLEND);
    Util.checkErr();
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LESS);
    GL11.glDepthMask(true);
    Util.checkErr();
    GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
    Util.checkErr();
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    GL11.glViewport(0, 0, framebufferSize, framebufferSize);

}

From source file:com.pahimar.ee3.core.handlers.DrawBlockHighlightHandler.java

License:LGPL

public void drawInWorldTransmutationOverlay(DrawBlockHighlightEvent event) {

    double x = event.target.blockX + 0.5F;
    double y = event.target.blockY + 0.5F;
    double z = event.target.blockZ + 0.5F;
    double iPX = event.player.prevPosX + (event.player.posX - event.player.prevPosX) * event.partialTicks;
    double iPY = event.player.prevPosY + (event.player.posY - event.player.prevPosY) * event.partialTicks;
    double iPZ = event.player.prevPosZ + (event.player.posZ - event.player.prevPosZ) * event.partialTicks;
    int texture = event.context.renderEngine.getTexture(Textures.EFFECT_WORLD_TRANSMUTATION);

    float xScale = 1;
    float yScale = 1;
    float zScale = 1;
    float xShift = 0.1F;
    float yShift = 0.1F;
    float zShift = 0.1F;
    int chargeLevel;
    int itemChargeLevel = 0;

    if (event.currentItem.getItem() instanceof IChargeable) {
        itemChargeLevel = ((IChargeable) event.currentItem.getItem()).getCharge(event.currentItem);
    }/*  w w  w  . j a v a  2s .co m*/
    chargeLevel = 1 + itemChargeLevel * 2;

    ForgeDirection sideHit = ForgeDirection.getOrientation(event.target.sideHit);

    switch (sideHit) {
    case UP: {
        xScale = chargeLevel + 0.1F;
        zScale = chargeLevel + 0.1F;
        xShift = 0;
        zShift = 0;
        break;
    }
    case DOWN: {
        xScale = chargeLevel + 0.1F;
        zScale = chargeLevel + 0.1F;
        xShift = 0;
        yShift = -yShift;
        zShift = 0;
        break;
    }
    case NORTH: {
        xScale = chargeLevel + 0.1F;
        yScale = chargeLevel + 0.1F;
        xShift = 0;
        yShift = 0;
        zShift = -zShift;
        break;
    }
    case SOUTH: {
        xScale = chargeLevel + 0.1F;
        yScale = chargeLevel + 0.1F;
        xShift = 0;
        yShift = 0;
        break;
    }
    case EAST: {
        yScale = chargeLevel + 0.1F;
        zScale = chargeLevel + 0.1F;
        yShift = 0;
        zShift = 0;
        break;
    }
    case WEST: {
        yScale = chargeLevel + 0.1F;
        zScale = chargeLevel + 0.1F;
        xShift = -xShift;
        yShift = 0;
        zShift = 0;
        break;
    }
    default:
        break;
    }

    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_CULL_FACE);

    for (int i = 0; i < 6; i++) {
        ForgeDirection forgeDir = ForgeDirection.getOrientation(i);
        int zCorrection = i == 2 ? -1 : 1;
        GL11.glPushMatrix();
        GL11.glTranslated(-iPX + x + xShift, -iPY + y + yShift, -iPZ + z + zShift);
        GL11.glScalef(1F * xScale, 1F * yScale, 1F * zScale);
        GL11.glRotatef(90, forgeDir.offsetX, forgeDir.offsetY, forgeDir.offsetZ);
        GL11.glTranslated(0, 0, 0.5f * zCorrection);
        GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
        renderPulsingQuad(texture, 0.75F);
        GL11.glPopMatrix();
    }

    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glDepthMask(true);
}