Example usage for org.lwjgl.opengl GL11 glClear

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

Introduction

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

Prototype

public static void glClear(@NativeType("GLbitfield") int mask) 

Source Link

Document

Sets portions of every pixel in a particular buffer to the same value.

Usage

From source file:ion2d.INGrabber.java

License:Open Source License

/**
 * Before Rendering of grabbing the screen
 *///from  ww w  . ja v  a  2 s.  c  o 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.  j a  v a  2 s . c o  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 glClear(int bits) {
    GL11.glClear(bits);
}

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 renderGL(Point locs) {
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);

    GL11.glPushMatrix();/*from  w  ww  .j ava 2s . com*/
    {
        drawBackground(locs);
        drawForeGround();
        if (LEVEL_EDITOR == false) {
            if (e.LEVEL_COMPLETE == false) {
                //drawShadow(locs);
            }
        }
        if (DEBUG) {
            drawDebug();
        }
        drawUI();
    }
    GL11.glPopMatrix();
}

From source file:kuake2.render.lwjgl.Main.java

License:Open Source License

/**
 * R_SetupFrame/*from w ww  .  j  a va2 s  . co  m*/
 */
void R_SetupFrame() {
    r_framecount++;

    //   build the transformation matrix for the given view angles
    Math3D.VectorCopy(r_newrefdef.vieworg, r_origin);

    Math3D.AngleVectors(r_newrefdef.viewangles, vpn, vright, vup);

    //   current viewcluster
    mleaf_t leaf;
    if ((r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) == 0) {
        r_oldviewcluster = r_viewcluster;
        r_oldviewcluster2 = r_viewcluster2;
        leaf = Mod_PointInLeaf(r_origin, r_worldmodel);
        r_viewcluster = r_viewcluster2 = leaf.cluster;

        // check above and below so crossing solid water doesn't draw wrong
        if (leaf.contents == 0) { // look down a bit
            Math3D.VectorCopy(r_origin, temp);
            temp[2] -= 16;
            leaf = Mod_PointInLeaf(temp, r_worldmodel);
            if ((leaf.contents & Defines.CONTENTS_SOLID) == 0 && (leaf.cluster != r_viewcluster2))
                r_viewcluster2 = leaf.cluster;
        } else { // look up a bit
            Math3D.VectorCopy(r_origin, temp);
            temp[2] += 16;
            leaf = Mod_PointInLeaf(temp, r_worldmodel);
            if ((leaf.contents & Defines.CONTENTS_SOLID) == 0 && (leaf.cluster != r_viewcluster2))
                r_viewcluster2 = leaf.cluster;
        }
    }

    for (int i = 0; i < 4; i++)
        v_blend[i] = r_newrefdef.blend[i];

    c_brush_polys = 0;
    c_alias_polys = 0;

    // clear out the portion of the screen that the NOWORLDMODEL defines
    if ((r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) != 0) {
        GL11.glEnable(GL11.GL_SCISSOR_TEST);
        GL11.glClearColor(0.3f, 0.3f, 0.3f, 1.0f);
        GL11.glScissor(r_newrefdef.x, vid.height - r_newrefdef.height - r_newrefdef.y, r_newrefdef.width,
                r_newrefdef.height);
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
        GL11.glClearColor(1.0f, 0.0f, 0.5f, 0.5f);
        GL11.glDisable(GL11.GL_SCISSOR_TEST);
    }
}

From source file:kuake2.render.lwjgl.Main.java

License:Open Source License

/**
 * R_Clear//  ww  w .j  av a2s.  c  om
 */
void R_Clear() {
    if (gl_ztrick.value != 0.0f) {

        if (gl_clear.value != 0.0f) {
            GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
        }

        trickframe++;
        if ((trickframe & 1) != 0) {
            gldepthmin = 0;
            gldepthmax = 0.49999f;
            GL11.glDepthFunc(GL11.GL_LEQUAL);
        } else {
            gldepthmin = 1;
            gldepthmax = 0.5f;
            GL11.glDepthFunc(GL11.GL_GEQUAL);
        }
    } else {
        if (gl_clear.value != 0.0f)
            GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
        else
            GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);

        gldepthmin = 0;
        gldepthmax = 1;
        GL11.glDepthFunc(GL11.GL_LEQUAL);
    }
    GL11.glDepthRange(gldepthmin, gldepthmax);
}

From source file:kuake2.render.lwjgl.Main.java

License:Open Source License

/**
 * R_SetPalette// w ww.  j  a va2s. co  m
 */
protected void R_SetPalette(byte[] palette) {
    // 256 RGB values (768 bytes)
    // or null
    int i;
    int color = 0;

    if (palette != null) {
        int j = 0;
        for (i = 0; i < 256; i++) {
            color = (palette[j++] & 0xFF) << 0;
            color |= (palette[j++] & 0xFF) << 8;
            color |= (palette[j++] & 0xFF) << 16;
            color |= 0xFF000000;
            r_rawpalette[i] = color;
        }
    } else {
        for (i = 0; i < 256; i++) {
            r_rawpalette[i] = d_8to24table[i] | 0xff000000;
        }
    }
    GL_SetTexturePalette(r_rawpalette);

    GL11.glClearColor(0, 0, 0, 0);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
    GL11.glClearColor(1f, 0f, 0.5f, 0.5f);
}

From source file:launcher.Main.java

private void draw() {
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    drawWorld();
    drawPlayer();
}

From source file:lwjgl29.GlobalClass.Quad.java

@Override
public void clear() {
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
}