Example usage for org.lwjgl.opengl GL11 glColorMaterial

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

Introduction

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

Prototype

public static native void glColorMaterial(@NativeType("GLenum") int face, @NativeType("GLenum") int mode);

Source Link

Document

It is possible to attach one or more material properties to the current color, so that they continuously track its component values.

Usage

From source file:com.ardor3d.scene.state.lwjgl.LwjglMaterialStateUtil.java

License:Open Source License

private static void applyColorMaterial(final ColorMaterial colorMaterial, final MaterialFace face,
        final MaterialStateRecord record) {
    if (!record.isValid() || face != record.colorMaterialFace || colorMaterial != record.colorMaterial) {
        if (colorMaterial == ColorMaterial.None) {
            GL11.glDisable(GL11.GL_COLOR_MATERIAL);
        } else {//from   w  w  w  . j a v  a 2s. c o  m
            final int glMat = getGLColorMaterial(colorMaterial);
            final int glFace = getGLMaterialFace(face);

            GL11.glColorMaterial(glFace, glMat);
            GL11.glEnable(GL11.GL_COLOR_MATERIAL);
            record.resetColorsForCM(face, colorMaterial);
        }
        record.colorMaterial = colorMaterial;
        record.colorMaterialFace = face;
    }
}

From source file:com.runescape.client.revised.editor.modelviewer.Main.java

License:Open Source License

public static void initialize(final Canvas modelCanvas) {
    try {/*from ww w .  j  av a 2  s  .  c  o  m*/
        Display.setParent(modelCanvas);
        Display.create(new PixelFormat(8, 24, 8, 8));
        Display.makeCurrent();
    } catch (final LWJGLException lwjgle) {
        try {
            Display.create(new PixelFormat(8, 24, 8, 0));
        } catch (final LWJGLException e) {
            e.printStackTrace();
        }
    }
    Display.setVSyncEnabled(false);
    Display.setSwapInterval(0);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glClearColor(0.0F, 0.0F, 0.0F, 0.0F);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glClearDepth(1.0F);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
    GL11.glEnable(GL11.GL_NORMALIZE);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_POINT_SMOOTH);
    GL11.glEnable(GL11.GL_POLYGON_SMOOTH);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    GL11.glColorMaterial(GL11.GL_FRONT, GL11.GL_DIFFUSE);
    GL11.glCullFace(GL11.GL_BACK);
}

From source file:jpcsp.graphics.RE.RenderingEngineLwjgl.java

License:Open Source License

@Override
public void setColorMaterial(boolean ambient, boolean diffuse, boolean specular) {
    int index = (ambient ? 1 : 0) | (diffuse ? 2 : 0) | (specular ? 4 : 0);
    GL11.glColorMaterial(GL11.GL_FRONT_AND_BACK, colorMaterialToGL[index]);
}

From source file:lwjglapp.Lights.java

private void initGL() {
    GL11.glShadeModel(GL11.GL_SMOOTH);/*from  ww w .  ja  va 2 s. c  om*/
    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:net.smert.frameworkgl.opengl.OpenGL1.java

License:Apache License

public OpenGL1 colorMaterial(int face, int material) {
    GL11.glColorMaterial(face, material);
    return this;
}

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

License:Open Source License

/**  A generalised interface for stuff that wants to be rendered-
  *//* www .j  a  v  a 2s.c  om*/
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:tk.ivybits.engine.gl.GL.java

License:Open Source License

public static void glColorMaterial(int a, int b) {
    GL11.glColorMaterial(a, b);
}