Java Code Examples for com.jogamp.opengl.GL2#glEnable()
The following examples show how to use
com.jogamp.opengl.GL2#glEnable() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MaterialEntity.java From Robot-Overlord-App with GNU General Public License v2.0 | 6 votes |
public void render(GL2 gl2) { gl2.glColor4d(diffuse.getR(),diffuse.getG(),diffuse.getB(),diffuse.getA()); gl2.glMaterialfv(GL2.GL_FRONT, GL2.GL_DIFFUSE, diffuse.getFloatArray(),0); gl2.glMaterialfv(GL2.GL_FRONT, GL2.GL_SPECULAR, specular.getFloatArray(),0); gl2.glMaterialfv(GL2.GL_FRONT, GL2.GL_EMISSION, emission.getFloatArray(),0); gl2.glMaterialfv(GL2.GL_FRONT, GL2.GL_AMBIENT, ambient.getFloatArray(),0); gl2.glMaterialf(GL2.GL_FRONT, GL2.GL_SHININESS, shininess.get().floatValue()); gl2.glColorMaterial(GL2.GL_FRONT,GL2.GL_AMBIENT_AND_DIFFUSE ); boolean isColorEnabled = gl2.glIsEnabled(GL2.GL_COLOR_MATERIAL); gl2.glDisable(GL2.GL_COLOR_MATERIAL); gl2.glShadeModel(GL2.GL_SMOOTH); if(isLit()) gl2.glEnable(GL2.GL_LIGHTING); else gl2.glDisable(GL2.GL_LIGHTING); texture.render(gl2); if(isColorEnabled) gl2.glEnable(GL2.GL_COLOR_MATERIAL); }
Example 2
Source File: CubeTexture.java From MeteoInfo with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void init(GLAutoDrawable drawable) { final GL2 gl = drawable.getGL().getGL2(); gl.glShadeModel(GL2.GL_SMOOTH); gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); gl.glClearDepth(1.0f); gl.glEnable(GL2.GL_DEPTH_TEST); gl.glDepthFunc(GL2.GL_LEQUAL); gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL2.GL_NICEST); gl.glEnable(GL2.GL_TEXTURE_2D); try { File im = new File("D:\\Temp\\image\\lenna.jpg "); //File im = new File("D:\\Temp\\Map\\GLOBALeb3colshade.jpg"); BufferedImage image = ImageIO.read(im); Texture t = AWTTextureIO.newTexture(gl.getGLProfile(), image, true); //Texture t = TextureIO.newTexture(im, true); texture = t.getTextureObject(gl); } catch (IOException e) { e.printStackTrace(); } }
Example 3
Source File: Cuboid.java From Robot-Overlord-App with GNU General Public License v2.0 | 6 votes |
public void render(GL2 gl2) { gl2.glPushMatrix(); //MatrixHelper.applyMatrix(gl2, poseWorld); IntBuffer depthFunc = IntBuffer.allocate(1); gl2.glGetIntegerv(GL2.GL_DEPTH_FUNC, depthFunc); gl2.glDepthFunc(GL2.GL_ALWAYS); boolean isLit = gl2.glIsEnabled(GL2.GL_LIGHTING); gl2.glDisable(GL2.GL_LIGHTING); gl2.glColor3d(255,255,255); PrimitiveSolids.drawBoxWireframe(gl2, getBoundsBottom(),getBoundsTop()); if (isLit) gl2.glEnable(GL2.GL_LIGHTING); gl2.glDepthFunc(depthFunc.get()); gl2.glPopMatrix(); }
Example 4
Source File: MatrixHelper.java From Robot-Overlord-App with GNU General Public License v2.0 | 6 votes |
/** * See drawMatrix(gl2,p,u,v,w,1) * @param gl2 * @param m * @param scale */ public static void drawMatrix2(GL2 gl2,Matrix4d m,double scale) { boolean depthWasOn = gl2.glIsEnabled(GL2.GL_DEPTH_TEST); gl2.glDisable(GL2.GL_DEPTH_TEST); boolean lightWasOn = gl2.glIsEnabled(GL2.GL_LIGHTING); gl2.glDisable(GL2.GL_LIGHTING); gl2.glPushMatrix(); gl2.glTranslated(m.m03,m.m13,m.m23); gl2.glScaled(scale, scale, scale); gl2.glBegin(GL2.GL_LINES); gl2.glColor3f(1,1,0); gl2.glVertex3f(0,0,0); gl2.glVertex3d(m.m00,m.m10,m.m20); // 1,1,0 = yellow gl2.glColor3f(0,1,1); gl2.glVertex3f(0,0,0); gl2.glVertex3d(m.m01,m.m11,m.m21); // 0,1,1 = teal gl2.glColor3f(1,0,1); gl2.glVertex3f(0,0,0); gl2.glVertex3d(m.m02,m.m12,m.m22); // 1,0,1 = magenta gl2.glEnd(); gl2.glPopMatrix(); if(lightWasOn) gl2.glEnable(GL2.GL_LIGHTING); if(depthWasOn) gl2.glEnable(GL2.GL_DEPTH_TEST); }
Example 5
Source File: MatrixHelper.java From Robot-Overlord-App with GNU General Public License v2.0 | 6 votes |
/** * See drawMatrix(gl2,p,u,v,w,1) * @param gl2 * @param m * @param scale */ public static void drawMatrix(GL2 gl2,Matrix4d m,double scale) { boolean depthWasOn = gl2.glIsEnabled(GL2.GL_DEPTH_TEST); gl2.glDisable(GL2.GL_DEPTH_TEST); boolean lightWasOn = gl2.glIsEnabled(GL2.GL_LIGHTING); gl2.glDisable(GL2.GL_LIGHTING); gl2.glPushMatrix(); gl2.glTranslated(m.m03,m.m13,m.m23); gl2.glScaled(scale, scale, scale); gl2.glBegin(GL2.GL_LINES); gl2.glColor3f(1,0,0); gl2.glVertex3f(0,0,0); gl2.glVertex3d(m.m00,m.m10,m.m20); // 1,0,0 = red gl2.glColor3f(0,1,0); gl2.glVertex3f(0,0,0); gl2.glVertex3d(m.m01,m.m11,m.m21); // 0,1,0 = green gl2.glColor3f(0,0,1); gl2.glVertex3f(0,0,0); gl2.glVertex3d(m.m02,m.m12,m.m22); // 0,0,1 = blue gl2.glEnd(); gl2.glPopMatrix(); if(lightWasOn) gl2.glEnable(GL2.GL_LIGHTING); if(depthWasOn) gl2.glEnable(GL2.GL_DEPTH_TEST); }
Example 6
Source File: DelaunayTriangulationExample.java From delaunay-triangulator with MIT License | 6 votes |
public void init(GLAutoDrawable drawable) { GL2 gl = drawable.getGL().getGL2(); gl.glDisable(GL.GL_CULL_FACE); gl.glShadeModel(GL2.GL_SMOOTH); gl.glClearColor(COLOR_BACKGROUND.getRed() / 255.0f, COLOR_BACKGROUND.getGreen() / 255.0f, COLOR_BACKGROUND.getBlue() / 255.0f, 1); gl.glClearDepth(1.0f); gl.glEnable(GL.GL_DEPTH_TEST); gl.glDepthFunc(GL.GL_LEQUAL); gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); gl.setSwapInterval(1); gl.glDisable(GL2.GL_CULL_FACE); delaunayTriangulator = new DelaunayTriangulator(pointSet); }
Example 7
Source File: TextureEntity.java From Robot-Overlord-App with GNU General Public License v2.0 | 6 votes |
public void render(GL2 gl2) { if(textureDirty) { // texture has changed, load the new texture. if(t == null || t.length()==0) texture = null; else { try { texture = TextureIO.newTexture(FileAccess.open(t), false, t.substring(t.lastIndexOf('.')+1)); } catch(IOException e) { //e.printStackTrace(); Log.error("I can't load "+t); } textureDirty=false; } } if(texture==null) { gl2.glDisable(GL2.GL_TEXTURE_2D); } else { gl2.glEnable(GL2.GL_TEXTURE_2D); texture.bind(gl2); } }
Example 8
Source File: Arrow.java From depan with Apache License 2.0 | 6 votes |
/** * Links the two given shapes (and their centers) with this arrow. Shapes are * used to determine if points are inside the shapes, or outside. This is * useful to draw an arrow that starts and end at the edge of the shape, and * not in the middle of the shape. * * @param gl GL object where to draw this shape. * @param arcInfo the arc to draw. */ public void linkShapes(GL2 gl, ArcInfo arcInfo) { // enable GL_LINE_STIPPLE if edge must be dashed if (dashed) { gl.glEnable(GL2.GL_LINE_STIPPLE); gl.glLineStipple(1, (short) 0xf0f0); } drawCurve(gl, arcInfo); // now disable GL_LINE_STIPPLE if it was enabled if (dashed) { gl.glDisable(GL2.GL_LINE_STIPPLE); } drawHead(gl, arcInfo); }
Example 9
Source File: Lighting.java From MeteoInfo with GNU Lesser General Public License v3.0 | 6 votes |
/** * Start the lighting * * @param gl GL2 */ public void start(GL2 gl) { //gl.glShadeModel(GL2.GL_SMOOTH); gl.glEnable(GL2.GL_LIGHTING); gl.glEnable(this.light); gl.glEnable(GL2.GL_DEPTH_TEST); gl.glLightModelfv(GL2.GL_LIGHT_MODEL_AMBIENT, ambient, 0); //gl.glLightfv(this.light, GL2.GL_AMBIENT, ambient, 0); gl.glLightfv(this.light, GL2.GL_SPECULAR, specular, 0); gl.glLightfv(this.light, GL2.GL_DIFFUSE, diffuse, 0); gl.glLightfv(this.light, GL2.GL_POSITION, position, 0); //Material gl.glMaterialfv(GL2.GL_FRONT, GL2.GL_AMBIENT, mat_ambient, 0); gl.glMaterialfv(GL2.GL_FRONT, GL2.GL_DIFFUSE, mat_diffuse, 0); gl.glMaterialfv(GL2.GL_FRONT, GL2.GL_SPECULAR, mat_specular, 0); gl.glMaterialf(GL2.GL_FRONT, GL2.GL_SHININESS, mat_shininess); }
Example 10
Source File: LightEntity.java From Robot-Overlord-App with GNU General Public License v2.0 | 5 votes |
public void setupLight(GL2 gl2) { int i = GL2.GL_LIGHT0+lightIndex; if(!enabled.get()) { gl2.glDisable(i); return; } gl2.glEnable(i); position[0]=(float)poseWorld.m03; position[1]=(float)poseWorld.m13; position[2]=(float)poseWorld.m23; position[3]=isDirectional.get()?1:0; gl2.glLightfv(i, GL2.GL_POSITION, position,0); gl2.glLightfv(i, GL2.GL_AMBIENT, ambient.getFloatArray(),0); gl2.glLightfv(i, GL2.GL_DIFFUSE, diffuse.getFloatArray(),0); gl2.glLightfv(i, GL2.GL_SPECULAR, specular.getFloatArray(),0); // z axis of the matrix is the light direction spotDirection[0]=(float)poseWorld.m02; spotDirection[1]=(float)poseWorld.m12; spotDirection[2]=(float)poseWorld.m22; gl2.glLightfv(i, GL2.GL_SPOT_DIRECTION, spotDirection,0); gl2.glLightf(i, GL2.GL_SPOT_CUTOFF, cutoff.get().floatValue()); gl2.glLightf(i, GL2.GL_SPOT_EXPONENT, exponent.get().floatValue()); // falloff/fade out gl2.glLightf(i, GL2.GL_CONSTANT_ATTENUATION,attenuationConstant.get().floatValue()); gl2.glLightf(i, GL2.GL_LINEAR_ATTENUATION,attenuationLinear.get().floatValue()); gl2.glLightf(i, GL2.GL_QUADRATIC_ATTENUATION,attenuationQuadratic.get().floatValue()); super.render(gl2); }
Example 11
Source File: Renderer.java From Ultraino with MIT License | 5 votes |
void enableTexture2D(GL2 gl, boolean enabled){ if (enabled != texture2d){ if (enabled){ gl.glEnable(GL2.GL_TEXTURE_2D); }else{ gl.glDisable(GL2.GL_TEXTURE_2D); } texture2d = enabled; } }
Example 12
Source File: Renderer.java From Ultraino with MIT License | 5 votes |
void enableDepthTest(GL2 gl, boolean enabled){ if (enabled != depthTest){ if (enabled){ gl.glEnable(GL2.GL_DEPTH_TEST); }else{ gl.glDisable(GL2.GL_DEPTH_TEST); } depthTest = enabled; } }
Example 13
Source File: Renderer.java From Ultraino with MIT License | 5 votes |
void enableCullFace(GL2 gl, boolean enabled){ if (enabled != cullFace){ if (enabled){ gl.glEnable(GL2.GL_CULL_FACE); }else{ gl.glDisable(GL2.GL_CULL_FACE); } cullFace = enabled; } }
Example 14
Source File: PoseEntity.java From Robot-Overlord-App with GNU General Public License v2.0 | 5 votes |
public void renderLineage(GL2 gl2) { boolean isTex = gl2.glIsEnabled(GL2.GL_TEXTURE_2D); gl2.glDisable(GL2.GL_TEXTURE_2D); // save the lighting mode boolean lightWasOn = gl2.glIsEnabled(GL2.GL_LIGHTING); gl2.glDisable(GL2.GL_LIGHTING); IntBuffer depthFunc = IntBuffer.allocate(1); gl2.glGetIntegerv(GL2.GL_DEPTH_FUNC, depthFunc); gl2.glDepthFunc(GL2.GL_ALWAYS); //boolean depthWasOn = gl2.glIsEnabled(GL2.GL_DEPTH_TEST); //gl2.glDisable(GL2.GL_DEPTH_TEST); gl2.glColor4d(1,1,1,1); gl2.glBegin(GL2.GL_LINES); // connection to children for(Entity e : children ) { if(e instanceof PoseEntity) { Vector3d p = ((PoseEntity)e).getPosition(); gl2.glVertex3d(0, 0, 0); gl2.glVertex3d(p.x,p.y,p.z); } } gl2.glEnd(); //if(depthWasOn) gl2.glEnable(GL2.GL_DEPTH_TEST); gl2.glDepthFunc(depthFunc.get()); // restore lighting if(lightWasOn) gl2.glEnable(GL2.GL_LIGHTING); if(isTex) gl2.glDisable(GL2.GL_TEXTURE_2D); }
Example 15
Source File: JLight.java From MeteoInfo with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void display(GLAutoDrawable drawable) { final GL2 gl = drawable.getGL().getGL2(); gl.glColor3f(1f, 0f, 0f); gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT); gl.glLoadIdentity(); gl.glRotatef(rotation, 1.0f, 1.0f, 0.0f); gl.glBegin(GL2.GL_TRIANGLES); gl.glVertex2d(0, 0.5); gl.glVertex2d(-0.5, -0.5); gl.glVertex2d(0.5, -0.5); gl.glEnd(); gl.glFlush(); //Angle rotation += 0.6f; gl.glEnable(GL2.GL_LIGHTING); gl.glEnable(GL2.GL_LIGHT0); gl.glEnable(GL2.GL_DEPTH_TEST); float[] ambientLight = {0f, 0f, 1f, 0f}; gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_AMBIENT, ambientLight, 0); float[] specularLight = {1f, 0f, 0f, 0f}; gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_SPECULAR, specularLight, 0); float[] diffuseLight = {1f, 0f, 0f, 0f}; gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_DIFFUSE, diffuseLight, 0); }
Example 16
Source File: OpenGLVideoRenderer.java From sagetv with Apache License 2.0 | 4 votes |
private void updateVideo(int frametype) { if(owner.isInFrame() || (owner.getPbuffer().getContext().makeCurrent()==GLContext.CONTEXT_NOT_CURRENT)) { if(!owner.isInFrame()) { System.out.println("Couldn't make pbuffer current?"); return; } else { System.out.println("update video while already in frame"); } } GL2 gl = owner.getPbuffer().getGL().getGL2(); if(pureNativeMode) { try { updateVideo0(); } catch(Throwable t) {} } else { //System.out.println("20,20 pixel: "+videobuffer.get(20*720+20)); //System.out.println(" width: "+videowidth+" height: "+videoheight); gl.glEnable(gl.GL_TEXTURE_RECTANGLE); gl.glBindTexture(gl.GL_TEXTURE_RECTANGLE, videot[0]); gl.glPixelStorei(gl.GL_UNPACK_SKIP_PIXELS, videoy); gl.glTexSubImage2D(gl.GL_TEXTURE_RECTANGLE, 0, 0, 0, videowidth, videoheight, gl.GL_LUMINANCE, gl.GL_UNSIGNED_BYTE, videobuffer); gl.glBindTexture(gl.GL_TEXTURE_RECTANGLE, videot[1]); gl.glPixelStorei(gl.GL_UNPACK_SKIP_PIXELS, videou); gl.glTexSubImage2D(gl.GL_TEXTURE_RECTANGLE, 0, 0, 0, videowidth/2, videoheight/2, gl.GL_LUMINANCE, gl.GL_UNSIGNED_BYTE, videobuffer); gl.glBindTexture(gl.GL_TEXTURE_RECTANGLE, videot[2]); gl.glPixelStorei(gl.GL_UNPACK_SKIP_PIXELS, videov); gl.glTexSubImage2D(gl.GL_TEXTURE_RECTANGLE, 0, 0, 0, videowidth/2, videoheight/2, gl.GL_LUMINANCE, gl.GL_UNSIGNED_BYTE, videobuffer); gl.glPixelStorei(gl.GL_UNPACK_SKIP_PIXELS, 0); gl.glDisable(gl.GL_TEXTURE_RECTANGLE); gl.glFlush(); } if(!owner.isInFrame()) owner.getPbuffer().getContext().release(); }
Example 17
Source File: SkyBoxEntity.java From Robot-Overlord-App with GNU General Public License v2.0 | 4 votes |
public void render(GL2 gl2,CameraEntity camera) { //gl2.glDisable(GL2.GL_DEPTH_TEST); gl2.glDisable(GL2.GL_LIGHTING); gl2.glDisable(GL2.GL_COLOR_MATERIAL); gl2.glEnable(GL2.GL_TEXTURE_2D); gl2.glPushMatrix(); gl2.glColor3f(1, 1, 1); Vector3d p = camera.getPosition(); gl2.glTranslated(-p.x,-p.y,-p.z); skyboxtextureXPos.render(gl2); gl2.glBegin(GL2.GL_TRIANGLE_FAN); gl2.glTexCoord2d(0,1); gl2.glVertex3d(10, 10, 10); gl2.glTexCoord2d(1,1); gl2.glVertex3d(10, -10, 10); gl2.glTexCoord2d(1,0); gl2.glVertex3d(10, -10, -10); gl2.glTexCoord2d(0,0); gl2.glVertex3d(10, 10, -10); gl2.glEnd(); skyboxtextureXNeg.render(gl2); gl2.glBegin(GL2.GL_TRIANGLE_FAN); gl2.glTexCoord2d(0,1); gl2.glVertex3d(-10, -10, 10); gl2.glTexCoord2d(1,1); gl2.glVertex3d(-10, 10, 10); gl2.glTexCoord2d(1,0); gl2.glVertex3d(-10, 10, -10); gl2.glTexCoord2d(0,0); gl2.glVertex3d(-10, -10, -10); gl2.glEnd(); skyboxtextureYPos.render(gl2); gl2.glBegin(GL2.GL_TRIANGLE_FAN); gl2.glTexCoord2d(0,1); gl2.glVertex3d(-10, 10, 10); gl2.glTexCoord2d(1,1); gl2.glVertex3d(10, 10, 10); gl2.glTexCoord2d(1,0); gl2.glVertex3d(10, 10, -10); gl2.glTexCoord2d(0,0); gl2.glVertex3d(-10, 10, -10); gl2.glEnd(); skyboxtextureYNeg.render(gl2); gl2.glBegin(GL2.GL_TRIANGLE_FAN); gl2.glTexCoord2d(0,1); gl2.glVertex3d(10, -10, 10); gl2.glTexCoord2d(1,1); gl2.glVertex3d(-10, -10, 10); gl2.glTexCoord2d(1,0); gl2.glVertex3d(-10, -10, -10); gl2.glTexCoord2d(0,0); gl2.glVertex3d(10, -10, -10); gl2.glEnd(); skyboxtextureZPos.render(gl2); gl2.glBegin(GL2.GL_TRIANGLE_FAN); gl2.glTexCoord2d(0,0); gl2.glVertex3d(-10, 10, 10); gl2.glTexCoord2d(1,0); gl2.glVertex3d( 10, 10, 10); gl2.glTexCoord2d(1,1); gl2.glVertex3d( 10,-10, 10); gl2.glTexCoord2d(0,1); gl2.glVertex3d(-10,-10, 10); gl2.glEnd(); skyboxtextureZNeg.render(gl2); gl2.glBegin(GL2.GL_TRIANGLE_FAN); gl2.glTexCoord2d(0,0); gl2.glVertex3d(-10,-10, -10); gl2.glTexCoord2d(1,0); gl2.glVertex3d( 10,-10, -10); gl2.glTexCoord2d(1,1); gl2.glVertex3d( 10, 10, -10); gl2.glTexCoord2d(0,1); gl2.glVertex3d(-10, 10, -10); gl2.glEnd(); gl2.glPopMatrix(); gl2.glEnable(GL2.GL_DEPTH_TEST); }
Example 18
Source File: SpideeLeg.java From Robot-Overlord-App with GNU General Public License v2.0 | 4 votes |
void render(GL2 gl2,int color_index) { float [] colors = { 1,0,0, 0,1,0, 0,0,1, 1,1,0, 0,1,1, 1,0,1 }; //* gl2.glDisable(GL2.GL_LIGHTING); gl2.glColor3f(colors[color_index*3], colors[color_index*3+1], colors[color_index*3+2]); // last point of contact gl2.glBegin(GL2.GL_LINE_LOOP); gl2.glVertex3d(lpoc.x+0.5f, lpoc.y-0.5f, 0); gl2.glVertex3d(lpoc.x+0.5f, lpoc.y+0.5f, 0); gl2.glVertex3d(lpoc.x-0.5f, lpoc.y+0.5f, 0); gl2.glVertex3d(lpoc.x-0.5f, lpoc.y-0.5f, 0); gl2.glEnd(); gl2.glBegin(GL2.GL_LINES); gl2.glVertex3d(npoc.x-1.0f, npoc.y, 0); gl2.glVertex3d(npoc.x+1.0f, npoc.y, 0); gl2.glVertex3d(npoc.x, npoc.y-1.0f, 0); gl2.glVertex3d(npoc.x, npoc.y+1.0f, 0); gl2.glEnd(); // next point of contact gl2.glBegin(GL2.GL_LINE_LOOP); gl2.glVertex3d(npoc.x+0.75f, npoc.y-0.75f, 0); gl2.glVertex3d(npoc.x+0.75f, npoc.y+0.75f, 0); gl2.glVertex3d(npoc.x-0.75f, npoc.y+0.75f, 0); gl2.glVertex3d(npoc.x-0.75f, npoc.y-0.75f, 0); gl2.glEnd(); gl2.glBegin(GL2.GL_LINES); gl2.glVertex3d(ankle_joint.pos.x,ankle_joint.pos.y,ankle_joint.pos.z); gl2.glVertex3d(ankle_joint.pos.x,ankle_joint.pos.y,0); gl2.glEnd(); pan_joint.Draw(gl2,2); tilt_joint.Draw(gl2,1); knee_joint.Draw(gl2,3); gl2.glEnable(GL2.GL_LIGHTING); }
Example 19
Source File: OpenGLUtil.java From haxademic with MIT License | 3 votes |
public static void setFog(PGraphics pg, boolean isEnabled) { GL2 gl = ((PJOGL)pg.beginPGL()).gl.getGL2(); // Turn On Fog // float[] FogCol = {0.0f,0.8f,0.8f}; // define a nice light grey if(isEnabled) gl.glEnable(GL2.GL_FOG); else gl.glDisable(GL2.GL_FOG); // gl.glEnable(GL2.GL_FOG); // gl.glFogfv(GL2.GL_FOG_COLOR, FogCol, 1); // Set the fog color // gl.glFogf(GL2.GL_FOG_DENSITY,0.9f); // Thin the fog out a little // gl.glFogf(GL2.GL_FOG_MODE, GL2.GL_LINEAR); // GL_LINEAR, GL_EXP, or GL_EXP2 // gl.glFogf(GL2.GL_FOG_START, 0); // gl.glFogf(GL2.GL_FOG_END, 1000); float[] Fog_colour = {0,0,1f,0}; gl.glHint(GL2.GL_FOG_HINT, GL2.GL_NICEST); //gl.glFogi(GL2.GL_FOG_MODE, GL2.GL_EXP); gl.glFogi(GL2.GL_FOG_MODE, GL2.GL_EXP2); //gl.glFogi(GL2.GL_FOG_MODE, GL2.GL_LINEAR); gl.glFogf(GL2.GL_FOG_DENSITY, 0.005f); gl.glFogfv(GL2.GL_FOG_COLOR, Fog_colour, 0); gl.glFogf(GL2.GL_FOG_START, 300 - 30); gl.glFogf(GL2.GL_FOG_END, 300); }
Example 20
Source File: OpenGLHelper.java From Robot-Overlord-App with GNU General Public License v2.0 | 2 votes |
static public void disableLightingEnd(GL2 gl2,boolean lightWasOn) { if(lightWasOn) gl2.glEnable(GL2.GL_LIGHTING); }