Example usage for org.lwjgl.opengl GL11 glFogi

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

Introduction

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

Prototype

public static native void glFogi(@NativeType("GLenum") int pname, @NativeType("GLint") int param);

Source Link

Document

Sets the integer value of a fog parameter.

Usage

From source file:com.ardor3d.scene.state.lwjgl.LwjglFogStateUtil.java

License:Open Source License

private static void applyFogSource(final CoordinateSource source, final FogStateRecord record,
        final ContextCapabilities caps) {
    if (caps.isFogCoordinatesSupported()) {
        if (!record.isValid() || !source.equals(record.source)) {
            if (source == CoordinateSource.Depth) {
                GL11.glFogi(EXTFogCoord.GL_FOG_COORDINATE_SOURCE_EXT, EXTFogCoord.GL_FRAGMENT_DEPTH_EXT);
            } else {
                GL11.glFogi(EXTFogCoord.GL_FOG_COORDINATE_SOURCE_EXT, EXTFogCoord.GL_FOG_COORDINATE_EXT);
            }/*from w  w w.jav  a 2  s  .c  o m*/
        }
    }
}

From source file:com.ardor3d.scene.state.lwjgl.LwjglFogStateUtil.java

License:Open Source License

private static void applyFogMode(final DensityFunction densityFunction, final FogStateRecord record) {
    int glMode = 0;
    switch (densityFunction) {
    case Exponential:
        glMode = GL11.GL_EXP;/*from  www  .  j  a v a  2s . com*/
        break;
    case Linear:
        glMode = GL11.GL_LINEAR;
        break;
    case ExponentialSquared:
        glMode = GL11.GL_EXP2;
        break;
    }

    if (!record.isValid() || record.fogMode != glMode) {
        GL11.glFogi(GL11.GL_FOG_MODE, glMode);
        record.fogMode = glMode;
    }
}

From source file:de.sanandrew.mods.enderstuffp.client.event.RenderGameOverlayHandler.java

License:Creative Commons License

@SubscribeEvent
public void renderFogDensity(FogDensity event) {
    if (event.block == EspBlocks.endFluidBlock) {
        GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP);

        if (event.entity.isPotionActive(Potion.waterBreathing)) {
            event.density = 0.05F;/*  www. j  a  va 2  s  . c o m*/
        } else {
            event.density = 0.7F - EnchantmentHelper.getRespiration(event.entity) * 0.03F;
        }
        event.setCanceled(true);
    }
}

From source file:gravestone.core.event.GSRenderEventHandler.java

License:LGPL

@SubscribeEvent
@SideOnly(Side.CLIENT)//w w w.ja v  a 2 s. co  m
public void fogEvent(EntityViewRenderEvent.RenderFogEvent event) {
    if (GSConfig.isFogEnabled) {
        if (fogDensity < fogDensityPerTick) {
            fogDensity += DENSITY_PER_TICK;
        } else if (fogDensity > fogDensityPerTick) {
            fogDensity -= DENSITY_PER_TICK;
        }
        if (fogDensity < DENSITY_PER_TICK) {
            fogDensity = 0;
        }

        if (fogDensity > 0) {
            GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP);
            GL11.glFogf(GL11.GL_FOG_DENSITY, fogDensity);
        }
    }
}

From source file:io.flob.blackheart.Level.java

License:Open Source License

public void tick() throws Exception {

    if (display_list_dirty) {
        load_display_list();//from w w w .j  a va2  s.  c  o  m
    }

    ByteBuffer temp = ByteBuffer.allocateDirect(16);
    temp.order(ByteOrder.nativeOrder());
    float fog_colour[] = new float[] { 0f, 0f, 0f, 0f };
    GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP);
    temp.asFloatBuffer().put(fog_colour).flip();
    GL11.glFog(GL11.GL_FOG_COLOR, temp.asFloatBuffer());
    GL11.glFogf(GL11.GL_FOG_DENSITY, 0.25f);
    GL11.glHint(GL11.GL_FOG_HINT, GL11.GL_DONT_CARE);
    GL11.glFogf(GL11.GL_FOG_START, 0);
    GL11.glFogf(GL11.GL_FOG_END, 200);

    _barry.tick();

    try {
        Collections.sort(objects_dynamic, this.sort_objects);
    } catch (Exception ex) {
        Output.error(ex.getMessage());
    }

    if (Debug.collision_boxs) {
        _game._core._display.flush_texture();
        for (int count = 0; count < objects_static.size(); count++) {
            if (objects_static.get(count) instanceof ICollidable) {
                ICollidable objcet = (ICollidable) objects_static.get(count);
                objcet.collision_box().render();
            }
        }
        for (int count = 0; count < objects_dynamic.size(); count++) {
            if (objects_dynamic.get(count) instanceof ICollidable) {
                ICollidable objcet = (ICollidable) objects_dynamic.get(count);
                objcet.collision_box().render();
            }
        }
        _barry.collision_box().render();
        _barry.ray_picker().collision_box().render();
    }

    GL11.glPushMatrix();
    _game._core._texture.game_atlas.bind();
    if (_game.anaglyph()) {
        GL11.glTranslatef(1 * 0.03f, 0, 0);
        GL11.glColorMask(true, false, false, true);
    }
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glCallList(display_list);
    for (int count = 0; count < objects_dynamic.size(); count++) {
        objects_dynamic.get(count).tick();
    }
    GL11.glEnd();
    if (_game.anaglyph()) {
        GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
        GL11.glColorMask(false, true, true, true);
        GL11.glTranslatef(-1 * 0.03f, 0, 0);
        GL11.glBegin(GL11.GL_QUADS);
        GL11.glCallList(display_list);
        for (int count = 0; count < objects_dynamic.size(); count++) {
            objects_dynamic.get(count)._render();
        }
        GL11.glEnd();
        GL11.glColorMask(true, true, true, true);
    }
    GL11.glPopMatrix();

    for (int count = 0; count < objects_dynamic.size(); count++) {
        if (objects_dynamic.get(count).IRemove()) {
            objects_dynamic.remove(count);
        }
    }

    _hud.tick();

    if (_barry.health() <= 0) {
        _game._core.state(_game._core._game_dead);
    }
}

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

License:Open Source License

@Override
public void setFogHint() {
    GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_LINEAR);
    GL11.glHint(GL11.GL_FOG_HINT, GL11.GL_DONT_CARE);
}

From source file:nightkosh.gravestone_extended.core.event.RenderEventHandler.java

License:LGPL

@SubscribeEvent
@SideOnly(Side.CLIENT)/*from   ww w.  jav  a 2  s.c om*/
public void fogEvent(EntityViewRenderEvent.RenderFogEvent event) {
    if (ExtendedConfig.isFogEnabled) {
        if (fogDensity < fogDensityPerTick) {
            fogDensity += DENSITY_PER_TICK;
        } else if (fogDensity > fogDensityPerTick) {
            fogDensity -= DENSITY_PER_TICK;
        }
        if (fogDensity < DENSITY_PER_TICK) {
            fogDensity = 0;
        }

        if (fogDensity > 0) {
            GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_EXP);
            GL11.glFogf(GL11.GL_FOG_DENSITY, fogDensity);
        }
    }
}

From source file:org.mkdev.ai.langton3d.core.App.java

License:GNU General Public License

private void setupFog(float density, float start, float end) {
    GL11.glEnable(GL11.GL_FOG);/*from ww w. j  av  a  2 s.  co  m*/

    FloatBuffer fogColor = BufferUtils.createFloatBuffer(4);
    fogColor.put(Settings.FOG_COLOR_RED).put(Settings.FOG_COLOR_GREEN).put(Settings.FOG_COLOR_BLUE)
            .put(Settings.FOG_COLOR_ALPHA).flip();

    int fogMode = GL11.GL_LINEAR;
    GL11.glFogi(GL11.GL_FOG_MODE, fogMode);
    GL11.glFog(GL11.GL_FOG_COLOR, fogColor);
    GL11.glFogf(GL11.GL_FOG_DENSITY, density);
    GL11.glHint(GL11.GL_FOG_HINT, GL11.GL_NICEST);
    GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_NICEST);
    GL11.glFogf(GL11.GL_FOG_START, start);
    GL11.glFogf(GL11.GL_FOG_END, end);
}

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

License:Open Source License

public static void glFogi(int a, int b) {
    GL11.glFogi(a, b);
}