Example usage for org.lwjgl.opengl GL11 GL_AMBIENT

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

Introduction

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

Prototype

int GL_AMBIENT

To view the source code for org.lwjgl.opengl GL11 GL_AMBIENT.

Click Source Link

Document

LightParameter

Usage

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).
  *//*  w w w  .  j  av  a2  s  .c o  m*/
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);
}

From source file:zildo.fwk.opengl.OpenGLGestion.java

License:Open Source License

private void initGL() {
    GL11.glEnable(GL11.GL_TEXTURE_2D); // Enable Texture Mapping
    GL11.glShadeModel(GL11.GL_SMOOTH); // Enable Smooth Shading
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background
    GL11.glClearDepth(1.0f); // Depth Buffer Setup
    GL11.glEnable(GL11.GL_DEPTH_TEST); // Enables Depth Testing
    GL11.glDepthFunc(GL11.GL_LEQUAL); // The Type Of Depth Testing To Do

    // initProjectionScene();

    GL11.glEnable(GL11.GL_CULL_FACE);//w w w.  ja v  a2 s  . c o m

    ByteBuffer temp = ByteBuffer.allocateDirect(16);
    temp.order(ByteOrder.nativeOrder());
    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_AMBIENT, (FloatBuffer) temp.asFloatBuffer().put(lightAmbient).flip()); // Setup The Ambient
    // Light
    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_DIFFUSE, (FloatBuffer) temp.asFloatBuffer().put(lightDiffuse).flip()); // Setup The Diffuse
    // Light
    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_POSITION,
            (FloatBuffer) temp.asFloatBuffer().put(lightPosition).flip()); // Position The
    // Light
    GL11.glEnable(GL11.GL_LIGHT1); // Enable Light One

    // GL11.glEnable(GL11.GL_LIGHTING);

    Display.setVSyncEnabled(true);

}

From source file:zildo.platform.opengl.LwjglOpenGLGestion.java

License:Open Source License

private void initGL() {
    GL11.glEnable(GL11.GL_TEXTURE_2D); // Enable Texture Mapping
    GL11.glShadeModel(GL11.GL_SMOOTH); // Enable Smooth Shading
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background
    GL11.glClearDepth(1.0f); // Depth Buffer Setup
    GL11.glEnable(GL11.GL_DEPTH_TEST); // Enables Depth Testing
    GL11.glDepthFunc(GL11.GL_LEQUAL); // The Type Of Depth Testing To Do

    // initProjectionScene();

    GL11.glEnable(GL11.GL_CULL_FACE);//from ww  w.  j  a v  a  2  s  .  c o  m

    ByteBuffer temp = ByteBuffer.allocateDirect(16);
    temp.order(ByteOrder.nativeOrder());
    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_AMBIENT, (FloatBuffer) temp.asFloatBuffer().put(lightAmbient).flip()); // Setup The Ambient
                                                                                                                // Light
    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_DIFFUSE, (FloatBuffer) temp.asFloatBuffer().put(lightDiffuse).flip()); // Setup The Diffuse
                                                                                                                // Light
    GL11.glLight(GL11.GL_LIGHT1, GL11.GL_POSITION,
            (FloatBuffer) temp.asFloatBuffer().put(lightPosition).flip()); // Position The
                                                                                                                          // Light
    GL11.glEnable(GL11.GL_LIGHT1); // Enable Light One

    // GL11.glEnable(GL11.GL_LIGHTING);

    Display.setVSyncEnabled(true);

}