Example usage for org.lwjgl.opengl GL11 glClearColor

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

Introduction

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

Prototype

public static void glClearColor(@NativeType("GLfloat") float red, @NativeType("GLfloat") float green,
        @NativeType("GLfloat") float blue, @NativeType("GLfloat") float alpha) 

Source Link

Document

Sets the clear value for fixed-point and floating-point color buffers in RGBA mode.

Usage

From source file:shadowmage.meim.client.gui.GuiModelEditor.java

License:Open Source License

protected void doSelection() {
    int posX = Mouse.getX();
    int posY = Mouse.getY();

    GL11.glDisable(GL11.GL_TEXTURE_2D);//from www.  j  a  v a  2s  . c om
    GL11.glClearColor(1.f, 1.f, 1.f, 1.f);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    GuiModelEditor.model.renderForSelection();

    byte[] pixelColorsb = new byte[3];
    ByteBuffer pixelColors = ByteBuffer.allocateDirect(3);
    GL11.glReadPixels(posX, posY, 1, 1, GL11.GL_RGB, GL11.GL_BYTE, pixelColors);

    for (int i = 0; i < 3; i++) {
        pixelColorsb[i] = pixelColors.get(i);
    }

    int r = pixelColorsb[0];
    int g = pixelColorsb[1];
    int b = pixelColorsb[2];

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    AWLog.logDebug("colors clicked on: " + r + "," + g + "," + b);
    int color = (r << 16) | (g << 8) | b;
    AWLog.logDebug("color out: " + color);

    GL11.glClearColor(.2f, .2f, .2f, 1.f);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    Primitive p = model.getPrimitive(color);
    if (p == null) {
        this.setSelectedPiece(null);
        this.setSelectedPrimitive(null);
    } else {
        this.setSelectedPrimitive(p);
    }
}

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

License:Open Source License

public void renderDisplay() {

    initSettings();/*from   w  w w . j  a v  a  2  s  .  c  o m*/

    final Colour BC = backColour == null ? Colour.DARK_GREY : backColour;
    GL11.glClearColor(BC.r, BC.g, BC.b, BC.a);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

    port.applyView();
    lighting.bindLight(0);

    for (Client client : clients) {
        GL11.glColor4f(1, 1, 1, 1);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        final int disabled[] = client.GL_disables();
        if (disabled != null)
            for (int d : disabled)
                GL11.glDisable(d);
        client.renderTo(this);
        if (disabled != null)
            for (int d : disabled)
                GL11.glEnable(d);
    }
    clients.clear();

    if (HUD != null) {
        HUD.renderHUD(new Box2D().set(0, 0, viewWide, viewHigh));
    }

    //
    //  TODO:  Allow a custom image-tex?
    final Colour FC = foreColour == null ? Colour.NONE : foreColour;
    //final Colour FC = Colour.GREY ;
    FC.bindColour();

    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBegin(GL11.GL_QUADS);
    UINode.drawQuad(0, 0, viewWide, viewHigh, 0, 0, 1, 1, 0);
    GL11.glEnd();

    Display.update();
}

From source file:taiga.gpvm.render.ColoredSky.java

License:Open Source License

@Override
protected void renderSky(Matrix4 proj) {
    GL11.glClearColor(red, green, blue, 1f);
    GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_COLOR_BUFFER_BIT);
}

From source file:tectonicus.rasteriser.lwjgl.LwjglRasteriser.java

License:BSD License

@Override
public void clear(Color clearColour) {
    GL11.glClearColor(clearColour.getRed() / 255.0f, clearColour.getGreen() / 255.0f,
            clearColour.getBlue() / 255.0f, 0);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_STENCIL_BUFFER_BIT);
}

From source file:thebounzer.org.lwgldemo.OglBook.java

License:Open Source License

public OglBook() {
    // Initialize OpenGL (Display)
    this.setupOpenGL();
    this.printOpenglInfo();
    Util.checkGLError();/*from  w w w .  java  2  s  .co  m*/
    Chapter chapter = new Chapter5();
    chapter.configure();
    // Setup background color
    float[] color = new float[] { 0.0f, 0.0f, 0.0f, 1.0f };
    GL11.glClearColor(color[0], color[1], color[2], color[3]);
    while (!Display.isCloseRequested()) {
        // Do a single loop (logic/render)
        //GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
        chapter.loopCycle();
        // Force a maximum FPS of about 60
        Display.sync(60);
        // Let the CPU synchronize with the GPU if GPU is tagging behind
        Display.update();
    }

    // Destroy OpenGL (Display)
    chapter.destroy();
    this.destroyDisplay();

}

From source file:tk.ivybits.engine.gl.GL.java

License:Open Source License

public static void glClearColor(float a, float b, float c, float d) {
    GL11.glClearColor(a, b, c, d);
}

From source file:tk.jacklin213.voxelgale.rendering.BasicRenderer.java

License:Apache License

private void initGL() {
    GL11.glEnable(GL11.GL_TEXTURE_2D);//  w  w  w. java 2s. c  o  m
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glClearColor(0, 0, 0, 0);
    GL11.glClearDepth(1);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LEQUAL);

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

    GLU.gluPerspective(45, (float) displayMode.getWidth() / (float) displayMode.getHeight(), 0.1f, 100);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST);
}

From source file:uk.co.ifs_studios.engine.util.OpenGL.java

License:Open Source License

/**
 * Setup OpenGL./* w  ww . j  a v a2  s .  c  om*/
 * 
 * @param width
 *            - Width of screen.
 * @param height
 *            - Height of screen.
 */
public static void initialize(int width, int height) {
    GL11.glClearColor(0f, 0f, 0f, 0f);
    GL11.glViewport(0, 0, width, height);

    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glCullFace(GL11.GL_BACK);
}

From source file:us.illyohs.wumbo.client.render.RenderGuildCore.java

License:Creative Commons License

@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float tick) {
    TileGuildCore tgc = (TileGuildCore) tile;

    GL11.glPushMatrix();/*from w  ww .jav  a 2  s.c o  m*/
    GL11.glTranslated((float) x + 0.5, (float) y + 1.5, (float) z + 2.5);
    GL11.glScalef(1F, -1F, -1F);

    FMLClientHandler.instance().getClient().renderEngine.bindTexture(LibAssets.ASSET_GUILD_CORE_FRAME);
    frame.render(.0625F);
    //        core.render();
    //        GL11.glScalef(1F, -1F, -1F);
    GL11.glBlendFunc(0, 1);
    GL11.glClearColor(0.7f, 0.7f, 0.7f, 1.0f);

    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated((float) x + 1.0, (float) y + 2.0, (float) z + 1.0);
    GL11.glScalef(1F, -1F, -1F);

    core.render8();

    GL11.glPopMatrix();

}

From source file:us.samcraft.thaumickeeper.client.render.RenderKeeper.java

License:Creative Commons License

@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float tick) {
    TileSpaceKeeper tKeeper = (TileSpaceKeeper) tileentity;

    GL11.glPushMatrix();//from w w w.  j a  v a  2s .  co  m

    GL11.glTranslated((float) x + 0.5, (float) y + 1.5, (float) z + 0.5);
    GL11.glScalef(1F, -1F, -1F);
    Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE);
    model.render(.0625F);
    GL11.glScalef(1F, -1F, -1F);
    GL11.glBlendFunc(0, 1);
    GL11.glClearColor(0.7f, 0.7f, 0.7f, 1.0f);

    GL11.glPopMatrix();
}