List of usage examples for org.lwjgl.opengl GL11 GL_LIGHT0
int GL_LIGHT0
To view the source code for org.lwjgl.opengl GL11 GL_LIGHT0.
Click Source Link
From source file:jpcsp.graphics.RE.RenderingEngineLwjgl.java
License:Open Source License
@Override public void setLightSpotExponent(int light, float exponent) { GL11.glLightf(GL11.GL_LIGHT0 + light, GL11.GL_SPOT_EXPONENT, exponent); }
From source file:lwjglapp.Lights.java
private void initGL() { GL11.glShadeModel(GL11.GL_SMOOTH);// w w w .j ava 2s . c o m GL11.glMaterial(GL11.GL_FRONT, GL11.GL_SPECULAR, matSpecular); // sets specular material color GL11.glMaterialf(GL11.GL_FRONT, GL11.GL_SHININESS, 50.0f); // sets shininess GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, lightPosition); // sets light position GL11.glLight(GL11.GL_LIGHT0, GL11.GL_SPECULAR, whiteLight); // sets specular light to white GL11.glLight(GL11.GL_LIGHT0, GL11.GL_DIFFUSE, whiteLight); // sets diffuse light to white GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, lModelAmbient); // global ambient light GL11.glEnable(GL11.GL_LIGHTING); // enables lighting GL11.glEnable(GL11.GL_LIGHT0); // enables light0 GL11.glEnable(GL11.GL_COLOR_MATERIAL); // enables opengl to use glColor3f to define material color GL11.glColorMaterial(GL11.GL_FRONT, GL11.GL_AMBIENT_AND_DIFFUSE); // tell opengl glColor3f effects the ambient and diffuse properties of material }
From source file:modeledit.ModelView3D.java
License:Open Source License
private void glInit() { try {/*from ww w . j a va 2 s .co m*/ this.makeCurrent(); } catch (Exception e) { return; // e.printStackTrace(); } GL11.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GLU.gluPerspective(40, ((float) this.getWidth()) / ((float) this.getHeight()), 1, 100); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glShadeModel(GL11.GL_SMOOTH); // GL11.glPolygonMode(GL11.GL_FRONT,GL11.GL_LINE); // GL11.glEnable(GL11.GL_TEXTURE_2D); // Enable Texture Mapping GL11.glLight(GL11.GL_LIGHT0, GL11.GL_DIFFUSE, get(whiteLight)); GL11.glLight(GL11.GL_LIGHT0, GL11.GL_SPECULAR, get(whiteLight)); GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, get(ambientLight)); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_LIGHT0); GLUtils.glLightPos(1.0f, 1.0f, 1.0f); // GL11.glTexParameteri(GL11.GL_TEXTURE_2D,GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP); // GL11.glTexParameteri(GL11.GL_TEXTURE_2D,GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP); }
From source file:net.smert.frameworkgl.opengl.OpenGL1.java
License:Apache License
public OpenGL1 disableLight0() { GL11.glDisable(GL11.GL_LIGHT0); return this; }
From source file:net.smert.frameworkgl.opengl.OpenGL1.java
License:Apache License
public OpenGL1 enableLight0() { GL11.glEnable(GL11.GL_LIGHT0); return this; }
From source file:org.jtrfp.mtmx.tools.internal.ModelViewerConfiguration.java
License:Open Source License
@Override public void initLight() { GL11.glEnable(GL11.GL_LIGHTING);/*from www . j a v a 2 s . c o m*/ float[] vec = new float[] { 1.0f, 1.0f, 1.0f, 1.0f }; // XXX: FloatBuffer must have 4 additional floats free FloatBuffer diffBuffer = BufferUtils.createFloatBuffer(vec.length + 4); diffBuffer.put(vec); GL11.glLight(GL11.GL_LIGHT0, GL11.GL_AMBIENT_AND_DIFFUSE, diffBuffer); GL11.glEnable(GL11.GL_LIGHT0); }
From source file:org.jtrfp.mtmx.tools.internal.TruckViewerConfiguration.java
License:Open Source License
@Override public void initLight() { GL11.glEnable(GL11.GL_LIGHTING);/* w w w.ja v a2 s . co m*/ float[] vec = new float[] { 1.0f, 1.0f, 1.0f, 1.0f }; // XXX: FloatBuffer must have 4 additional floats free FloatBuffer diffBuffer = BufferUtils.createFloatBuffer(vec.length + 4); diffBuffer.put(vec); GL11.glLight(GL11.GL_LIGHT0, GL11.GL_AMBIENT_AND_DIFFUSE, diffBuffer); GL11.glEnable(GL11.GL_LIGHT0); GL11.glShadeModel(GL11.GL_FLAT); }
From source file:org.jtrfp.mtmx.tools.internal.WorldViewerConfiguration.java
License:Open Source License
@Override public void initLight() { GL11.glEnable(GL11.GL_LIGHTING);//from www . j ava 2 s .c o m // XXX: FloatBuffer must have 4 additional floats free float[] amb = new float[] { 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f }; FloatBuffer ambientBuffer = EngineUtil.createFloatBuffer(amb); GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, ambientBuffer); // XXX: FloatBuffer must have 4 additional floats free float[] vec = new float[] { 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f }; FloatBuffer diffBuffer = EngineUtil.createFloatBuffer(vec); GL11.glLight(GL11.GL_LIGHT0, GL11.GL_DIFFUSE, diffBuffer); GL11.glEnable(GL11.GL_LIGHT0); GL11.glShadeModel(GL11.GL_FLAT); }
From source file:org.ode4j.drawstuff.internal.DrawStuffGL.java
License:Open Source License
@Override // void dsDrawFrame (int width, int height, dsFunctions *fn, int pause) void dsDrawFrame(int width, int height, dsFunctions fn, boolean pause) { if (current_state < 1) dsDebug("internal error"); current_state = 2;/* ww w.j a v a 2s . com*/ // setup stuff GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_LIGHT0); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_TEXTURE_GEN_S); GL11.glDisable(GL11.GL_TEXTURE_GEN_T); GL11.glShadeModel(GL11.GL_FLAT); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthFunc(GL11.GL_LESS); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glCullFace(GL11.GL_BACK); GL11.glFrontFace(GL11.GL_CCW); // setup viewport GL11.glViewport(0, 0, width, height); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); final float vnear = 0.1f; final float vfar = 100.0f; final float k = 0.8f; // view scale, 1 = +/- 45 degrees if (width >= height) { float k2 = (float) height / (float) width; GL11.glFrustum(-vnear * k, vnear * k, -vnear * k * k2, vnear * k * k2, vnear, vfar); } else { float k2 = (float) width / (float) height; GL11.glFrustum(-vnear * k * k2, vnear * k * k2, -vnear * k, vnear * k, vnear, vfar); } // setup lights. it makes a difference whether this is done in the // GL_PROJECTION matrix mode (lights are scene relative) or the // GL_MODELVIEW matrix mode (lights are camera relative, bad!). // static GLfloat light_ambient[] = { 0.5, 0.5, 0.5, 1.0 }; // static GLfloat light_diffuse[] = { 1.0, 1.0, 1.0, 1.0 }; // static GLfloat light_specular[] = { 1.0, 1.0, 1.0, 1.0 }; GL11.glLight(GL11.GL_LIGHT0, GL11.GL_AMBIENT, light_ambient); GL11.glLight(GL11.GL_LIGHT0, GL11.GL_DIFFUSE, light_diffuse); GL11.glLight(GL11.GL_LIGHT0, GL11.GL_SPECULAR, light_specular); GL11.glColor3f(1.0f, 1.0f, 1.0f); // clear the window GL11.glClearColor(0.5f, 0.5f, 0.5f, 0); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); // snapshot camera position (in MS Windows it is changed by the GUI thread) float[] view2_xyz = view_xyz.clone(); float[] view2_rxyz = view_rxyz.clone(); // memcpy (view2_xyz,view_xyz);//,sizeof(float)*3); // memcpy (view2_hpr,view_hpr);//,sizeof(float)*3); // go to GL_MODELVIEW matrix mode and set the camera GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); setCamera(view2_xyz[0], view2_xyz[1], view2_xyz[2], view2_rxyz[0], view2_rxyz[1], view2_rxyz[2]); // set the light position (for some reason we have to do this in model view. // static GLfloat light_position[] = { LIGHTX, LIGHTY, 1.0, 0.0 }; GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, light_position); // draw the background (ground, sky etc) drawSky(view2_xyz); drawGround(); // draw the little markers on the ground drawPyramidGrid(); // leave openGL in a known state - flat shaded white, no textures GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_FLAT); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthFunc(GL11.GL_LESS); GL11.glColor3f(1, 1, 1); setColor(1, 1, 1, 1); // draw the rest of the objects. set drawing state first. color[0] = 1; color[1] = 1; color[2] = 1; color[3] = 1; tnum = DS_TEXTURE_NUMBER.DS_NONE; //if (fn.step) fn.step(pause); }
From source file:src.graphics.common.Lighting.java
License:Open Source License
/** Binds this light to the GL11 light register specified (between 0 to 8). *///from w ww . j a v a 2s . c om public void bindLight(int lI) { lI += GL11.GL_LIGHT0; GL11.glEnable(lI); ambBuffer.clear(); ambBuffer.put(ambience).flip(); difBuffer.clear(); difBuffer.put(diffused).flip(); posBuffer.clear(); posBuffer.put(position).flip(); GL11.glLight(lI, GL11.GL_AMBIENT, ambBuffer); GL11.glLight(lI, GL11.GL_DIFFUSE, difBuffer); GL11.glLight(lI, GL11.GL_POSITION, posBuffer); DARK.clear(); DARK.put(new float[4]).flip(); GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, DARK); }