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:io.flob.blackheart.DisplayDriver.java

License:Open Source License

private void init_GL() {
    GL11.glClearColor(0.1F, 0.1F, 0.1F, 1.0F);
    GL11.glEnable(GL11.GL_BLEND);/*from   w  w  w .  j a v  a  2  s  . co m*/
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GLU.gluPerspective(60.0f, ((float) Display.getWidth()) / ((float) Display.getHeight()), 0.1f, 40.0f);
}

From source file:io.flob.clicker.DisplayDriver.java

License:Open Source License

private void init_GL() {
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();// w w w. java  2  s  . c o m
    GL11.glOrtho(0, width, height, 0, -1, 1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glClearColor(0.1f, 0.1f, 0.1f, 1.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);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}

From source file:io.github.SolidStudiosTeam.Flicker.engine.GameLoop.java

License:Open Source License

@Override
public void initGL() {
    /* Enable 2D textures. */
    GL11.glEnable(GL11.GL_TEXTURE_2D);/* w  w  w . j  a  v  a 2s  . com*/

    /* 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:io.root.gfx.glutils.GL.java

License:Apache License

public static void glClearColor(float red, float green, float blue, float alpha) {
    GL11.glClearColor(red, green, blue, alpha);
}

From source file:ion2d.INDirector.java

License:Open Source License

protected void initGL() {
    setAlphaBlending(true);
    setDepthTest(true);
    setProjection(ProjectionFormat.DirectorProjection2D);

    GL11.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
}

From source file:ion2d.INGrabber.java

License:Open Source License

/**
 * Before Rendering of grabbing the screen
 *///from   w  w w.jav  a  2  s .co m
public void beforeRender() {
    GL11.glGetInteger(GL30.GL_FRAMEBUFFER_BINDING, this.oldBufferObject);
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, this.bufferObject.get(0));

    GL11.glClearColor(0, 0, 0, 0);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
}

From source file:itdelatrisu.opsu.render.CurveRenderState.java

License:Open Source License

/**
 * Draw a curve to the screen that's tinted with `color`. The first time
 * this is called this caches the image result of the curve and on subsequent
 * runs it just draws the cached copy to the screen.
 * @param color tint of the curve//  ww  w.  ja  v a 2  s.co  m
 * @param borderColor the curve border color
 * @param curve the points along the curve to be drawn
 */
public void draw(Color color, Color borderColor, Vec2f[] curve) {
    float alpha = color.a;

    // if this curve hasn't been drawn, draw it and cache the result
    if (fbo == null) {
        FrameBufferCache cache = FrameBufferCache.getInstance();
        Rendertarget mapping = cache.get(hitObject);
        if (mapping == null)
            mapping = cache.insert(hitObject);
        fbo = mapping;

        int oldFb = GL11.glGetInteger(EXTFramebufferObject.GL_FRAMEBUFFER_BINDING_EXT);
        int oldTex = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);

        //glGetInteger requires a buffer of size 16, even though just 4
        //values are returned in this specific case
        IntBuffer oldViewport = BufferUtils.createIntBuffer(16);
        GL11.glGetInteger(GL11.GL_VIEWPORT, oldViewport);
        EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, fbo.getID());
        GL11.glViewport(0, 0, fbo.width, fbo.height);
        GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
        Colors.WHITE_FADE.a = 1.0f;
        this.draw_curve(color, borderColor, curve);
        color.a = 1f;

        GL11.glBindTexture(GL11.GL_TEXTURE_2D, oldTex);
        EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, oldFb);
        GL11.glViewport(oldViewport.get(0), oldViewport.get(1), oldViewport.get(2), oldViewport.get(3));
        Colors.WHITE_FADE.a = alpha;
    }

    // draw a fullscreen quad with the texture that contains the curve
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_TEXTURE_1D);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, fbo.getTextureID());
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glColor4f(1.0f, 1.0f, 1.0f, alpha);
    GL11.glTexCoord2f(1.0f, 1.0f);
    GL11.glVertex2i(fbo.width, 0);
    GL11.glTexCoord2f(0.0f, 1.0f);
    GL11.glVertex2i(0, 0);
    GL11.glTexCoord2f(0.0f, 0.0f);
    GL11.glVertex2i(0, fbo.height);
    GL11.glTexCoord2f(1.0f, 0.0f);
    GL11.glVertex2i(fbo.width, fbo.height);
    GL11.glEnd();
}

From source file:jake2.desktop.LWJGLAdapter.java

License:Open Source License

@Override
public void glClearColor(float r, float g, float b, float a) {
    GL11.glClearColor(r, g, b, a);
}

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

License:Open Source License

@Override
public void clear(float red, float green, float blue, float alpha) {
    GL11.glClearColor(red, green, blue, alpha);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
}

From source file:junkdisplay.JunkDisplayLWJGL.java

protected void initGLLWJGL() {

    if (!LEVEL_EDITOR) {
        GL11.glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
    } else {//  w w  w.j a  va 2s  .  c om
        GL11.glViewport(0, 0, 1500, 800);
    }
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();

    if (!LEVEL_EDITOR) {
        GL11.glOrtho(0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 1, -1);
    } else {
        GL11.glOrtho(0, 1500, 800, 0, 1, -1);
    }
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();
    initTextures();
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    createModel();
}