Example usage for org.lwjgl.opengl GL11 glEnable

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

Introduction

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

Prototype

public static void glEnable(@NativeType("GLenum") int target) 

Source Link

Document

Enables the specified OpenGL state.

Usage

From source file:com.gameminers.mav.render.Rendering.java

License:Open Source License

public static void drawRectangle(float x, float y, float width, float height, float r, float g, float b,
        float a, float z) {
    GL11.glPushMatrix();//from w w  w  .j  a  v a  2s  .c  o m
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glTranslatef(0, 0, z);
    GL11.glColor4f(r, g, b, a);
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2f(x, y);
    GL11.glVertex2f(x + width, y);
    GL11.glVertex2f(x + width, y + height);
    GL11.glVertex2f(x, y + height);
    GL11.glEnd();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glPopMatrix();
}

From source file:com.gameminers.mav.render.Rendering.java

License:Open Source License

public static void setUpGL() {
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_DEPTH_TEST);//  w w  w  .j av  a2  s .c  o  m
    GL11.glDisable(GL11.GL_LIGHTING);

    GL11.glClearDepth(1);

    GL11.glShadeModel(GL11.GL_FLAT);

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

From source file:com.ggollmer.inevera.client.renderer.GreatwardComponentBlockRenderer.java

License:LGPL

@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId,
        RenderBlocks renderer) {/*from w  ww  .j a  va  2  s .  c  o  m*/
    if (!(block instanceof BlockGreatwardComponent)) {
        return false;
    }

    GL11.glEnable(GL11.GL_BLEND);
    renderInnerCube(world, x, y, z, block,
            ((BlockGreatwardComponent) block).getCoreIcon(world.getBlockMetadata(x, y, z)));
    renderer.renderStandardBlock(block, x, y, z);
    GL11.glDisable(GL11.GL_BLEND);

    return true;
}

From source file:com.github.kajdreef.mazerunnermvn.Launcher.java

/**
 * Initialize the display.//w  ww  . j  av a2s.  com
 */
public void initDisplayLWJGL() {
    PixelFormat pixelFormat = new PixelFormat();
    ContextAttribs contextAtrributes = new ContextAttribs(3, 2).withForwardCompatible(true)
            .withProfileCore(true);

    try {
        Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
        Display.setTitle("MazeRunner");
        Display.create(pixelFormat, contextAtrributes);
    } catch (LWJGLException e) {
        e.printStackTrace();
        System.exit(-1);
    }

    GL11.glClearColor(0.4f, 0.6f, 0.9f, 0f);
    GL11.glViewport(0, 0, WIDTH, HEIGHT);

    // Enable depth test so the objects are rendered in the right way.
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glDepthMask(true);

    GL11.glEnable(GL11.GL_CULL_FACE);
}

From source file:com.golden.gamedev.engine.lwjgl.LWJGLGraphics.java

License:Open Source License

public void drawLine(int x1, int y1, int x2, int y2) {
    GL11.glDisable(GL11.GL_TEXTURE_2D);//from   ww w .  j  ava  2  s.  c  o  m

    GL11.glColor4f((float) this.color.getRed() / 255f, (float) this.color.getGreen() / 255f,
            (float) this.color.getBlue() / 255f, (float) this.color.getAlpha() / 255f);
    GL11.glLineWidth(1.0f);

    GL11.glBegin(GL11.GL_LINES);
    GL11.glVertex2f(x1, y1);
    GL11.glVertex2f(x2, y2);
    GL11.glEnd();

    GL11.glColor3f(1.0f, 1.0f, 1.0f);

    GL11.glEnable(GL11.GL_TEXTURE_2D);
}

From source file:com.golden.gamedev.engine.lwjgl.LWJGLGraphics.java

License:Open Source License

public void setClip(int x, int y, int width, int height) {
    GL11.glGetInteger(GL11.GL_VIEWPORT, LWJGLGraphics.display);

    GL11.glEnable(GL11.GL_SCISSOR_TEST);
    GL11.glScissor(x, LWJGLGraphics.display.get(3) - y - height, width, height);

    if (this.clipArea == null) {
        this.clipArea = LWJGLGraphics.NULL_RECTANGLE;
    }//from   w w  w  . jav  a 2  s. c om

    this.clipArea.setBounds(x, y, width, height);
}

From source file:com.golden.gamedev.engine.lwjgl.LWJGLGraphics.java

License:Open Source License

private void drawRect(int x, int y, int width, int height, int type, Color col) {
    GL11.glDisable(GL11.GL_TEXTURE_2D);//from   w w w  . ja v  a  2  s.  c om

    GL11.glColor4f((float) col.getRed() / 255f, (float) col.getGreen() / 255f, (float) col.getBlue() / 255f,
            (float) col.getAlpha() / 255f);
    GL11.glLineWidth(1.0f);

    GL11.glBegin(type);
    GL11.glVertex2f(x, y);
    GL11.glVertex2f(x + width, y);
    GL11.glVertex2f(x + width, y + height);
    GL11.glVertex2f(x, y + height);
    GL11.glEnd();

    GL11.glColor3f(1.0f, 1.0f, 1.0f);

    GL11.glEnable(GL11.GL_TEXTURE_2D);
}

From source file:com.golden.gamedev.engine.lwjgl.LWJGLMode.java

License:Open Source License

private void initGL() {
    // init GL//from  w ww .j av a  2 s .  c  om
    // enable textures since we're going to use these for our sprites
    GL11.glEnable(GL11.GL_TEXTURE_2D);

    // disable the OpenGL depth test since we're rendering 2D graphics
    GL11.glDisable(GL11.GL_DEPTH_TEST);

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

    GL11.glOrtho(0, this.size.width, this.size.height, 0, -1, 1);

    // enable transparency
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}

From source file:com.google.gapid.glviewer.GeometryScene.java

License:Apache License

@Override
public void init(Renderer renderer) {
    float[] background = new float[] { .2f, .2f, .2f, 1f };

    LOG.log(FINE, "GL Version:   " + GL11.glGetString(GL11.GL_VERSION));
    LOG.log(FINE, "GLSL Version: " + GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION));

    shaders = Shaders.init(renderer);/*from   ww  w .ja  v a  2  s. c om*/
    if (renderable != null) {
        renderable.init(renderer);
    }

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glClearColor(background[0], background[1], background[2], background[3]);
    GL11.glPointSize(4);
    GL30.glBindVertexArray(GL30.glGenVertexArrays());
}

From source file:com.google.gapid.glviewer.Viewer.java

License:Apache License

@Override
public void init() {
    float[] background = new float[] { .2f, .2f, .2f, 1f };

    LOG.log(FINE, "GL Version:   " + GL11.glGetString(GL11.GL_VERSION));
    LOG.log(FINE, "GLSL Version: " + GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION));

    shaders = Shaders.init();// www.j  a v a 2 s.com
    if (renderable != null) {
        renderable.init();
    }

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glClearColor(background[0], background[1], background[2], background[3]);
    GL11.glPointSize(4);
    GL30.glBindVertexArray(GL30.glGenVertexArrays());
}