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:com.ardor3d.scene.state.lwjgl.LwjglLightStateUtil.java
License:Open Source License
private static void setSingleLightEnabled(final boolean enable, final int index, final LightStateRecord record, final LightRecord lr) { if (!record.isValid() || lr.isEnabled() != enable) { if (enable) { GL11.glEnable(GL11.GL_LIGHT0 + index); } else {//from w w w . j a v a 2s .c o m GL11.glDisable(GL11.GL_LIGHT0 + index); } lr.setEnabled(enable); } }
From source file:com.ardor3d.scene.state.lwjgl.LwjglLightStateUtil.java
License:Open Source License
private static void setAmbient(final int index, final LightStateRecord record, final ReadOnlyColorRGBA ambient, final LightRecord lr) { if (!record.isValid() || !lr.ambient.equals(ambient)) { record.lightBuffer.clear();/*w ww . j a v a2 s . c o m*/ record.lightBuffer.put(ambient.getRed()); record.lightBuffer.put(ambient.getGreen()); record.lightBuffer.put(ambient.getBlue()); record.lightBuffer.put(ambient.getAlpha()); record.lightBuffer.flip(); GL11.glLight(GL11.GL_LIGHT0 + index, GL11.GL_AMBIENT, record.lightBuffer); lr.ambient.set(ambient); } }
From source file:com.ardor3d.scene.state.lwjgl.LwjglLightStateUtil.java
License:Open Source License
private static void setDiffuse(final int index, final LightStateRecord record, final ReadOnlyColorRGBA diffuse, final LightRecord lr) { if (!record.isValid() || !lr.diffuse.equals(diffuse)) { record.lightBuffer.clear();/*from www. j av a 2 s.c om*/ record.lightBuffer.put(diffuse.getRed()); record.lightBuffer.put(diffuse.getGreen()); record.lightBuffer.put(diffuse.getBlue()); record.lightBuffer.put(diffuse.getAlpha()); record.lightBuffer.flip(); GL11.glLight(GL11.GL_LIGHT0 + index, GL11.GL_DIFFUSE, record.lightBuffer); lr.diffuse.set(diffuse); } }
From source file:com.ardor3d.scene.state.lwjgl.LwjglLightStateUtil.java
License:Open Source License
private static void setSpecular(final int index, final LightStateRecord record, final ReadOnlyColorRGBA specular, final LightRecord lr) { if (!record.isValid() || !lr.specular.equals(specular)) { record.lightBuffer.clear();//from www . jav a 2 s .com record.lightBuffer.put(specular.getRed()); record.lightBuffer.put(specular.getGreen()); record.lightBuffer.put(specular.getBlue()); record.lightBuffer.put(specular.getAlpha()); record.lightBuffer.flip(); GL11.glLight(GL11.GL_LIGHT0 + index, GL11.GL_SPECULAR, record.lightBuffer); lr.specular.set(specular); } }
From source file:com.ardor3d.scene.state.lwjgl.LwjglLightStateUtil.java
License:Open Source License
private static void setPosition(final int index, final LightStateRecord record, final float positionX, final float positionY, final float positionZ, final float positionW, final LightRecord lr) { // From OpenGL Docs: // The light position is transformed by the contents of the current top // of the ModelView matrix stack when you specify the light position // with a call to glLightfv(GL_LIGHT_POSITION,...). If you later change // the ModelView matrix, such as when the view changes for the next // frame, the light position isn't automatically retransformed by the // new contents of the ModelView matrix. If you want to update the // light's position, you must again specify the light position with a // call to glLightfv(GL_LIGHT_POSITION,...). // XXX: This is a hack until we get a better lighting model up final ReadOnlyMatrix4 modelViewMatrix = Camera.getCurrentCamera().getModelViewMatrix(); if (!record.isValid() || lr.position.getXf() != positionX || lr.position.getYf() != positionY || lr.position.getZf() != positionZ || lr.position.getWf() != positionW || !lr.modelViewMatrix.equals(modelViewMatrix)) { record.lightBuffer.clear();//from www . j ava 2s.c o m record.lightBuffer.put(positionX); record.lightBuffer.put(positionY); record.lightBuffer.put(positionZ); record.lightBuffer.put(positionW); record.lightBuffer.flip(); GL11.glLight(GL11.GL_LIGHT0 + index, GL11.GL_POSITION, record.lightBuffer); lr.position.set(positionX, positionY, positionZ, positionW); if (!Camera.getCurrentCamera().isFrameDirty()) { lr.modelViewMatrix.set(modelViewMatrix); } } }
From source file:com.ardor3d.scene.state.lwjgl.LwjglLightStateUtil.java
License:Open Source License
private static void setSpotDirection(final int index, final LightStateRecord record, final float directionX, final float directionY, final float directionZ, final float value) { // From OpenGL Docs: // The light position is transformed by the contents of the current top // of the ModelView matrix stack when you specify the light position // with a call to glLightfv(GL_LIGHT_POSITION,...). If you later change // the ModelView matrix, such as when the view changes for the next // frame, the light position isn't automatically retransformed by the // new contents of the ModelView matrix. If you want to update the // light's position, you must again specify the light position with a // call to glLightfv(GL_LIGHT_POSITION,...). record.lightBuffer.clear();//from w ww . j av a 2s . c o m record.lightBuffer.put(directionX); record.lightBuffer.put(directionY); record.lightBuffer.put(directionZ); record.lightBuffer.put(value); record.lightBuffer.flip(); GL11.glLight(GL11.GL_LIGHT0 + index, GL11.GL_SPOT_DIRECTION, record.lightBuffer); }
From source file:com.ardor3d.scene.state.lwjgl.LwjglLightStateUtil.java
License:Open Source License
private static void setConstant(final int index, final float constant, final LightRecord lr, final boolean force) { if (force || constant != lr.getConstant()) { GL11.glLightf(GL11.GL_LIGHT0 + index, GL11.GL_CONSTANT_ATTENUATION, constant); lr.setConstant(constant);/*w w w .j av a2s . c o m*/ } }
From source file:com.ardor3d.scene.state.lwjgl.LwjglLightStateUtil.java
License:Open Source License
private static void setLinear(final int index, final float linear, final LightRecord lr, final boolean force) { if (force || linear != lr.getLinear()) { GL11.glLightf(GL11.GL_LIGHT0 + index, GL11.GL_LINEAR_ATTENUATION, linear); lr.setLinear(linear);//from w w w . j a v a2 s. co m } }
From source file:com.ardor3d.scene.state.lwjgl.LwjglLightStateUtil.java
License:Open Source License
private static void setQuadratic(final int index, final float quad, final LightRecord lr, final boolean force) { if (force || quad != lr.getQuadratic()) { GL11.glLightf(GL11.GL_LIGHT0 + index, GL11.GL_QUADRATIC_ATTENUATION, quad); lr.setQuadratic(quad);/*w w w. j a va 2 s .co m*/ } }
From source file:com.ardor3d.scene.state.lwjgl.LwjglLightStateUtil.java
License:Open Source License
private static void setSpotExponent(final int index, final LightStateRecord record, final float exponent, final LightRecord lr) { if (!record.isValid() || lr.getSpotExponent() != exponent) { GL11.glLightf(GL11.GL_LIGHT0 + index, GL11.GL_SPOT_EXPONENT, exponent); lr.setSpotExponent(exponent);//ww w.j a v a 2 s .c om } }