Example usage for org.lwjgl.opengl GL11 glHint

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

Introduction

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

Prototype

public static void glHint(@NativeType("GLenum") int target, @NativeType("GLenum") int hint) 

Source Link

Document

Certain aspects of GL behavior, when there is room for variation, may be controlled with this function.

Usage

From source file:io.root.gfx.glutils.GL.java

License:Apache License

public static void glHint(int target, int mode) {
    GL11.glHint(target, mode);
}

From source file:ion2d.INDirector.java

License:Open Source License

public static void setDepthTest(boolean depth) {
    if (Display.isCreated() == false)
        return;//from w w w . j  a v a 2  s . c  o m

    if (depth) {
        GL11.glClearDepth(1.0f);
        GL11.glEnable(GL11.GL_DEPTH_TEST);
        GL11.glDepthFunc(GL11.GL_LEQUAL);
        GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
    } else {
        GL11.glDisable(GL11.GL_DEPTH_TEST);
    }
}

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

License:Open Source License

@Override
public void setFogHint() {
    GL11.glFogi(GL11.GL_FOG_MODE, GL11.GL_LINEAR);
    GL11.glHint(GL11.GL_FOG_HINT, GL11.GL_DONT_CARE);
}

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

License:Open Source License

@Override
public void setLineSmoothHint() {
    GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
}

From source file:lwjglapp.Renderer.java

private void initGL() {

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();/*from   w ww . ja  v  a2 s.  co m*/
    GLU.gluPerspective(45.0f, (float) (width / height), 0.1f, 100.0f);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    //      GL11.glLoadIdentity();
    //
    //      GL11.glEnable(GL11.GL_TEXTURE_2D);                                    // Enable Texture Mapping ( NEW )
    //      GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    GL11.glClearDepth(1.0f);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
}

From source file:mods.railcraft.client.render.RenderTESRSignals.java

License:Open Source License

private void renderPairs(TileEntity tile, double x, double y, double z, float f, AbstractPair pair,
        ColorProfile colorProfile) {/*from   w w  w.j a va  2 s. c  om*/
    if (pair.getPairs().isEmpty()) {
        return;
    }
    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_TEXTURE_2D);

    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
    GL11.glLineWidth(5F);

    GL11.glBegin(GL11.GL_LINES);
    for (WorldCoordinate target : pair.getPairs()) {
        int color = colorProfile.getColor(tile, pair.getCoords(), target);
        float c1 = (float) (color >> 16 & 255) / 255.0F;
        float c2 = (float) (color >> 8 & 255) / 255.0F;
        float c3 = (float) (color & 255) / 255.0F;
        GL11.glColor3f(c1, c2, c3);

        GL11.glVertex3f((float) x + 0.5f, (float) y + 0.5f, (float) z + 0.5f);
        float tx = (float) x + target.x - tile.xCoord;
        float ty = (float) y + target.y - tile.yCoord;
        float tz = (float) z + target.z - tile.zCoord;
        GL11.glVertex3f(tx + 0.5f, ty + 0.5f, tz + 0.5f);
    }
    GL11.glEnd();

    GL11.glPopAttrib();
    GL11.glPopMatrix();
}

From source file:net.BiggerOnTheInside.Binder.Binder.java

License:Open Source License

/**
 * <p>Sets up OpenGL.</p>/*from   w ww  . j a va2 s  .co m*/
 */
public void initGL() {
    int width = displayMode.getWidth();
    int height = displayMode.getHeight();

    /* Enable 2D texturing. */
    GL11.glEnable(GL11.GL_TEXTURE_2D);

    /* Make all models smoothly textured. */
    GL11.glShadeModel(GL11.GL_SMOOTH);

    /* Set the background color to that signature blue. */
    GL11.glClearColor(0.9f, 1.0f, 1.0f, 0.0f);

    /* Set the clear depth to all-the-way */
    GL11.glClearDepth(1.0);

    /* Enable the depth system. */
    GL11.glEnable(GL11.GL_DEPTH_TEST);

    /* Set the function for depth to GL_LEQUAL. */
    GL11.glDepthFunc(GL11.GL_LEQUAL);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    /* Enable face culling, basically don't render this face relative to the camera's position. */
    GL11.glEnable(GL11.GL_CULL_FACE);

    /* Set OpenGL to cull the back face of our spatials. */
    GL11.glCullFace(GL11.GL_BACK);

    /* Set the matrix mode to projection. */
    GL11.glMatrixMode(GL11.GL_PROJECTION);

    /* Reset the OpenGL configuration, loading our above prefrences. */
    //GL11.glLoadIdentity();

    /* Set the perspective. */
    GLU.gluPerspective(45.0f, (float) displayMode.getWidth() / (float) displayMode.getHeight(), 0.1f, 100.0f);

    /* Set the matrix mode to be model view. */
    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    /* Set the perspective correction hint to finest quality. */
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
}

From source file:net.phatcode.rel.multimedia.Renderer.java

License:Open Source License

Renderer(int screenWidth, int screenHeight) {
    try {/*from   w  w  w . ja v  a2s.  c o  m*/
        Display.setDisplayMode(new DisplayMode(screenWidth, screenHeight));
        Display.create();
        Display.setTitle("AnyaBasic 0.4.0 beta");
    } catch (LWJGLException e) {
        e.printStackTrace();
    }

    this.screenWidth = screenWidth;
    this.screenHeight = screenHeight;

    GL11.glViewport(0, 0, screenWidth, screenHeight);

    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();

    GL11.glOrtho(0, screenWidth, screenHeight, 0, 1, -1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    GL11.glLoadIdentity();

    GL11.glShadeModel(GL11.GL_SMOOTH); //set shading to smooth(try GL_FLAT)
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); //set Clear color to BLACK
    GL11.glClearDepth(1.0f); //Set Depth buffer to 1(z-Buffer)
    GL11.glDisable(GL11.GL_DEPTH_TEST); //Disable Depth Testing so that our z-buffer works

    GL11.glDepthFunc(GL11.GL_LEQUAL);

    GL11.glEnable(GL11.GL_COLOR_MATERIAL);

    GL11.glEnable(GL11.GL_TEXTURE_2D);

    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);

    GL11.glDisable(GL11.GL_CULL_FACE);

    GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL);

    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glTranslatef(0.375f, 0.375f, 0); // magic trick

}

From source file:net.smert.frameworkgl.opengl.OpenGL1.java

License:Apache License

public OpenGL1 setProjectionFrustum(double left, double right, double bottom, double top, double zNear,
        double zFar) {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity(); // glFrustum sadly doesn't set all rows and columns
    GL11.glFrustum(left, right, bottom, top, zNear, zFar);
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
    return this;
}

From source file:net.smert.frameworkgl.opengl.OpenGL1.java

License:Apache License

public OpenGL1 setProjectionOrtho(double left, double right, double bottom, double top, double zNear,
        double zFar) {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity(); // glOrtho sadly doesn't set all rows and columns
    GL11.glOrtho(left, right, bottom, top, zNear, zFar);
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
    return this;
}