Example usage for org.lwjgl.opengl GL11 GL_LIGHT0

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

Introduction

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

Prototype

int GL_LIGHT0

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

Click Source Link

Document

LightName

Usage

From source file:src.graphics.common.Rendering.java

License:Open Source License

/**  A generalised interface for stuff that wants to be rendered-
  *///  ww  w .  j ava  2  s  . co  m
void initSettings() {
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_LIGHT0);
    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
    GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
    GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);

    GL11.glEnable(GL11.GL_NORMALIZE); //  IF MISSING, COLOURS ARE TOO BRIGHT.
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glCullFace(GL11.GL_BACK);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1f);

    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    GL11.glColorMaterial(GL11.GL_FRONT_AND_BACK, GL11.GL_AMBIENT_AND_DIFFUSE);
}

From source file:util.GLUtils.java

License:Open Source License

public static void glLightColour(int type, float r, float g, float b, float a) {
    floatBuffer.clear();//from w w w. j a v a2 s  .c o  m
    floatBuffer.put(r);
    floatBuffer.put(g);
    floatBuffer.put(b);
    floatBuffer.put(a);
    floatBuffer.flip();
    GL11.glLight(GL11.GL_LIGHT0, type, floatBuffer);
}

From source file:util.GLUtils.java

License:Open Source License

public static void glLightPos(float x, float y, float z) {
    floatBuffer.clear();/*from   ww w  .  ja va 2 s. c  o  m*/
    floatBuffer.put(x);
    floatBuffer.put(y);
    floatBuffer.put(z);
    floatBuffer.put(0);
    floatBuffer.flip();
    GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, floatBuffer);
}