List of usage examples for org.lwjgl.opengl GL11 glFogf
public static native void glFogf(@NativeType("GLenum") int pname, @NativeType("GLfloat") float param);
From source file:com.ardor3d.scene.state.lwjgl.LwjglFogStateUtil.java
License:Open Source License
public static void apply(final FogState state) { // ask for the current state record final RenderContext context = ContextManager.getCurrentContext(); final FogStateRecord record = (FogStateRecord) context.getStateRecord(StateType.Fog); context.setCurrentState(StateType.Fog, state); if (state.isEnabled()) { enableFog(true, record);//ww w .j av a 2 s. c om if (record.isValid()) { if (record.fogStart != state.getStart()) { GL11.glFogf(GL11.GL_FOG_START, state.getStart()); record.fogStart = state.getStart(); } if (record.fogEnd != state.getEnd()) { GL11.glFogf(GL11.GL_FOG_END, state.getEnd()); record.fogEnd = state.getEnd(); } if (record.density != state.getDensity()) { GL11.glFogf(GL11.GL_FOG_DENSITY, state.getDensity()); record.density = state.getDensity(); } } else { GL11.glFogf(GL11.GL_FOG_START, state.getStart()); record.fogStart = state.getStart(); GL11.glFogf(GL11.GL_FOG_END, state.getEnd()); record.fogEnd = state.getEnd(); GL11.glFogf(GL11.GL_FOG_DENSITY, state.getDensity()); record.density = state.getDensity(); } final ReadOnlyColorRGBA fogColor = state.getColor(); applyFogColor(fogColor, record); applyFogMode(state.getDensityFunction(), record); applyFogHint(state.getQuality(), record); applyFogSource(state.getSource(), record, context.getCapabilities()); } else { enableFog(false, record); } if (!record.isValid()) { record.validate(); } }
From source file:com.badlogic.gdx.backends.lwjgl.LwjglGL10.java
License:Apache License
public final void glFogf(int pname, float param) { GL11.glFogf(pname, param); }
From source file:gravestone.core.event.GSRenderEventHandler.java
License:LGPL
@SubscribeEvent @SideOnly(Side.CLIENT)/*from w w w . j a v a 2 s . c o 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 v a 2 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 setFogDist(float start, float end) { GL11.glFogf(GL11.GL_FOG_START, start); GL11.glFogf(GL11.GL_FOG_END, end); }
From source file:net.kubin.world.World.java
License:Apache License
public void render() { /* Prepare Matrixes */ Game.getInstance().initSceneRendering(); Configuration configuration = Kubin.getConfiguration(); /* Look through the camera with high viewing distance to render the sky */ _player.getFirstPersonCamera().lookThrough(512.0f); /* Set the fog color based on time */ _fogColor.set(Kubin.getConfiguration().getFogColor()); _fogColor.scale(_sunlight - 0.05f);//from ww w .jav a 2s. c o m GL11.glFog(GL11.GL_FOG_COLOR, GLUtils.wrapDirect(_fogColor.x(), _fogColor.y(), _fogColor.z(), 1.0f)); GL11.glClearColor(_fogColor.x(), _fogColor.y(), _fogColor.z(), 1.0f); /* Render the sky */ GL11.glFogf(GL11.GL_FOG_START, 200); GL11.glFogf(GL11.GL_FOG_END, 400); _sky.renderSky(); /* Restore the fog distance */ GL11.glFogf(GL11.GL_FOG_START, configuration.getViewingDistance() * 0.55f); GL11.glFogf(GL11.GL_FOG_END, configuration.getViewingDistance()); /* Select the visible blocks */ selectVisibleChunks(_player.getFirstPersonCamera().getViewFrustum()); /* Bind the terrain texture */ //GL11.glEnable(GL11.GL_TEXTURE_2D); //TextureStorage.getTexture("terrain").bind(); PerformanceMonitor.getInstance().start(Operation.RENDER_OPAQUE); for (int i = 0; i < _visibleChunks.size(); ++i) { _visibleChunks.get(i).render(MeshType.OPAQUE); } PerformanceMonitor.getInstance().stop(Operation.RENDER_OPAQUE); PerformanceMonitor.getInstance().start(Operation.RENDER_TRANSLUCENT); for (int i = 0; i < _visibleChunks.size(); ++i) { _visibleChunks.get(i).render(MeshType.TRANSLUCENT); } PerformanceMonitor.getInstance().stop(Operation.RENDER_TRANSLUCENT); PerformanceMonitor.getInstance().start(Operation.RENDER_MANUAL); for (int i = 0; i < _visibleChunks.size(); ++i) { _visibleChunks.get(i).renderManualBlocks(); } PerformanceMonitor.getInstance().stop(Operation.RENDER_MANUAL); /* Render the clouds */ GL11.glFogf(GL11.GL_FOG_START, 200); GL11.glFogf(GL11.GL_FOG_END, 400); _sky.renderClouds(); _player.render(); renderOverlay(); }
From source file:nightkosh.gravestone_extended.core.event.RenderEventHandler.java
License:LGPL
@SubscribeEvent @SideOnly(Side.CLIENT)//from w ww .j av a2s . com 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.craftmania.world.World.java
License:Apache License
public void render() { /* Prepare Matrixes */ Game.getInstance().initSceneRendering(); Configuration configuration = Game.getInstance().getConfiguration(); /* Look through the camera with high viewing distance to render the sky */ _player.getFirstPersonCamera().lookThrough(512.0f); /* Set the fog color based on time */ _fogColor.set(Game.getInstance().getConfiguration().getFogColor()); _fogColor.scale(_sunlight - 0.05f);/* w w w. j a v a2s .com*/ GL11.glFog(GL11.GL_FOG_COLOR, GLUtils.wrapDirect(_fogColor.x(), _fogColor.y(), _fogColor.z(), 1.0f)); GL11.glClearColor(_fogColor.x(), _fogColor.y(), _fogColor.z(), 1.0f); /* Render the sky */ GL11.glFogf(GL11.GL_FOG_START, 200); GL11.glFogf(GL11.GL_FOG_END, 400); _sky.renderSky(); /* Restore the fog distance */ GL11.glFogf(GL11.GL_FOG_START, configuration.getViewingDistance() * 0.55f); GL11.glFogf(GL11.GL_FOG_END, configuration.getViewingDistance()); /* Select the visible blocks */ selectVisibleChunks(_player.getFirstPersonCamera().getViewFrustum()); /* Bind the terrain texture */ GL11.glEnable(GL11.GL_TEXTURE_2D); TextureStorage.getTexture("terrain").bind(); PerformanceMonitor.getInstance().start(Operation.RENDER_OPAQUE); for (int i = 0; i < _visibleChunks.size(); ++i) { _visibleChunks.get(i).render(MeshType.OPAQUE); } PerformanceMonitor.getInstance().stop(Operation.RENDER_OPAQUE); PerformanceMonitor.getInstance().start(Operation.RENDER_TRANSLUCENT); for (int i = 0; i < _visibleChunks.size(); ++i) { _visibleChunks.get(i).render(MeshType.TRANSLUCENT); } PerformanceMonitor.getInstance().stop(Operation.RENDER_TRANSLUCENT); PerformanceMonitor.getInstance().start(Operation.RENDER_MANUAL); for (int i = 0; i < _visibleChunks.size(); ++i) { _visibleChunks.get(i).renderManualBlocks(); } PerformanceMonitor.getInstance().stop(Operation.RENDER_MANUAL); /* Render the clouds */ GL11.glFogf(GL11.GL_FOG_START, 200); GL11.glFogf(GL11.GL_FOG_END, 400); _sky.renderClouds(); _player.render(); renderOverlay(); }
From source file:org.minetweak.world.World.java
License:Apache License
public void render() { /* Prepare Matrixes */ Game.getInstance().initSceneRendering(); Configuration configuration = Game.getInstance().getConfiguration(); /* Look through the camera with high viewing distance to render the sky */ _player.getFirstPersonCamera().lookThrough(512.0f); /* Set the fog color based on time */ _fogColor.set(Game.getInstance().getConfiguration().getFogColor()); _fogColor.scale(_sunlight - 0.05f);//from w w w . j av a 2 s. c o m GL11.glFog(GL11.GL_FOG_COLOR, GLUtils.wrapDirect(_fogColor.x(), _fogColor.y(), _fogColor.z(), 1.0f)); GL11.glClearColor(_fogColor.x(), _fogColor.y(), _fogColor.z(), 1.0f); /* Render the sky */ GL11.glFogf(GL11.GL_FOG_START, 200); GL11.glFogf(GL11.GL_FOG_END, 400); _sky.renderSky(); /* Restore the fog distance */ GL11.glFogf(GL11.GL_FOG_START, configuration.getViewingDistance() * 0.55f); GL11.glFogf(GL11.GL_FOG_END, configuration.getViewingDistance()); /* Select the visible blocks */ selectVisibleChunks(_player.getFirstPersonCamera().getViewFrustum()); /* Bind the terrain texture */ GL11.glEnable(GL11.GL_TEXTURE_2D); TextureStorage.getTexture("terrain").bind(); PerformanceMonitor.getInstance().start(Operation.RENDER_OPAQUE); for (Chunk _visibleChunk : _visibleChunks) { _visibleChunk.render(MeshType.OPAQUE); } PerformanceMonitor.getInstance().stop(Operation.RENDER_OPAQUE); PerformanceMonitor.getInstance().start(Operation.RENDER_TRANSLUCENT); for (Chunk _visibleChunk : _visibleChunks) { _visibleChunk.render(MeshType.TRANSLUCENT); } PerformanceMonitor.getInstance().stop(Operation.RENDER_TRANSLUCENT); PerformanceMonitor.getInstance().start(Operation.RENDER_MANUAL); for (Chunk _visibleChunk : _visibleChunks) { _visibleChunk.renderManualBlocks(); } PerformanceMonitor.getInstance().stop(Operation.RENDER_MANUAL); /* Render the clouds */ GL11.glFogf(GL11.GL_FOG_START, 200); GL11.glFogf(GL11.GL_FOG_END, 400); _sky.renderClouds(); _player.render(); renderOverlay(); if (currentGui != null) { currentGui.render(); } }
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 w ww.j a v a 2s . 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); }