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:cuchaz.jfxgl.JFXGL.java

License:Open Source License

public static void renderLoop() {

    long appHwnd = JFXGLContexts.app.hwnd;

    GL11.glClearColor(0f, 0f, 0f, 1f);/*from www .  ja va  2s. co  m*/

    while (!GLFW.glfwWindowShouldClose(appHwnd)) {
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
        render();
        GLFW.glfwSwapBuffers(appHwnd);
        GLFW.glfwPollEvents();
    }
}

From source file:cuchaz.jfxgl.prism.JFXGLContext.java

License:Open Source License

@Override
public void clearBuffers(Color color, boolean clearColor, boolean clearDepth, boolean ignoreScissor) {

    clearBuffersState.backup();/*from   w  ww . jav a  2  s .co m*/

    if (ignoreScissor) {
        GL11.glDisable(GL11.GL_SCISSOR_TEST);
    }

    int clearFlags = 0;

    if (clearColor) {
        clearFlags |= GL11.GL_COLOR_BUFFER_BIT;
        GL11.glClearColor(color.getRedPremult(), color.getGreenPremult(), color.getBluePremult(),
                color.getAlpha());
    }

    if (clearDepth) {
        clearFlags |= GL11.GL_DEPTH_BUFFER_BIT;

        GL11.glDepthMask(true);
        GL11.glClear(clearFlags);

    } else {
        GL11.glClear(clearFlags);
    }

    clearBuffersState.restore();
}

From source file:Data.Building.java

License:Apache License

@Override
public void render() {

    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);

    // Bind to the VAO that has all the information about the quad vertices
    GL30.glBindVertexArray(vaoId);//from  w  w  w.ja v  a 2 s .co  m
    GL20.glEnableVertexAttribArray(0);

    // Draw the vertices
    GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, vertexCount);

    // Put everything back to default (deselect)
    GL20.glDisableVertexAttribArray(0);
    GL30.glBindVertexArray(0);

    Util.exitOnGLError("Error in Building render");

}

From source file:de.codesourcery.flocking.LWJGLRenderer.java

License:Apache License

private void renderWorld(World world) {
    final double modelMax = world.getSimulationParameters().modelMax;
    xInc = Display.getWidth() / modelMax;
    yInc = Display.getHeight() / modelMax;

    GL11.glEnable(GL11.GL_DEPTH_TEST);//from  www  . ja v  a2  s  .com
    GL11.glDepthMask(true);

    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glDepthMask(false);

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

    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);

    final int triangleCount = world.getPopulationCount();

    // setup vertex data       
    final int vertexArrayLen = triangleCount * 3 * 2; // one triangle = 3 vertices * 2 int's per vertex
    final MyIntBuffer vertexBuffer = getVertexBuffer(vertexArrayLen);

    final IntBuffer vertexIntBuffer = vertexBuffer.getBuffer();
    final IBoidVisitor visitor = new IBoidVisitor() {

        @Override
        public void visit(Boid boid) {
            drawBoid(boid, vertexIntBuffer);
        }
    };
    world.visitAllBoids(visitor);

    vertexBuffer.rewind();

    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vertexBuffer.getHandle());
    GL15.glBufferData(GL15.GL_ARRAY_BUFFER, vertexBuffer.getBuffer(), GL15.GL_DYNAMIC_DRAW);
    GL11.glVertexPointer(2, GL11.GL_INT, 0, 0);

    // setup index data
    MyIntBuffer indexBuffer = getIndexBuffer(triangleCount * 3);
    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, indexBuffer.getHandle());
    GL15.glBufferData(GL15.GL_ELEMENT_ARRAY_BUFFER, indexBuffer.getBuffer(), GL15.GL_STATIC_DRAW);

    GL11.glDrawElements(GL11.GL_TRIANGLES, triangleCount * 3, GL11.GL_UNSIGNED_INT, 0);

    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0);

    GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthMask(true);
}

From source file:de.ikosa.mars.viewer.glviewer.engine.GLRenderer2Stage.java

License:Open Source License

public void Draw() {
    // forward pass
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fbAId);
    GL20.glDrawBuffers(GL30.GL_COLOR_ATTACHMENT0);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

    scene.Pass(GLScene.PassType.Forward, camera);

    // post pass/* w w w. jav a  2s  .  c o m*/
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fbBId);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    ssqScene.Pass(GLScene.PassType.PostProcess);

    // post B pass
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    ssqScene.Pass(GLScene.PassType.PostProcess2);

}

From source file:de.ikosa.mars.viewer.glviewer.engine.GLRendererForward.java

License:Open Source License

public void Draw() {
    // forward pass
    GL20.glDrawBuffers(GL30.GL_COLOR_ATTACHMENT0);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

    scene.Pass(GLScene.PassType.Forward, camera);
}

From source file:de.sanandrew.core.manpack.mod.client.event.RenderPlayerEventHandler.java

License:Creative Commons License

@SubscribeEvent
@SuppressWarnings("unchecked")
public void onHandRender(RenderHandEvent event) {
    this.lazyLoad();

    GL11.glPushMatrix();//  ww w  .  j av a2 s. c o m
    Minecraft mc = Minecraft.getMinecraft();

    if (SAPUtils.isPlayerNameOrUuidEqual(mc.player, SANPLAYER_NAMES_UUID)) {
        event.setCanceled(true);
        GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
        RenderPlayer rend = (RenderPlayer) RenderManager.instance.getEntityRenderObject(mc.player);
        RenderManager.instance.entityRenderMap.put(mc.player.getClass(), this.sanPlayerModel);
        SAPReflectionHelper.invokeCachedMethod(EntityRenderer.class, mc.entityRenderer,
                ReflectionNames.RENDER_HAND.mcpName, ReflectionNames.RENDER_HAND.srgName,
                new Class[] { float.class, int.class }, new Object[] { event.partialTicks, event.renderPass });
        RenderManager.instance.entityRenderMap.put(mc.player.getClass(), rend);
    }

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glPopMatrix();
}

From source file:displayexample.Entities.Box2D.java

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

    // set the color of the quad (R,G,B,A)
    GL11.glColor3f(0.5f, 0.5f, 1.0f);/*from   www  . ja v  a  2  s  .  c o m*/

    // draw quad
    GL11.glBegin(GL11.GL_QUADS);
    GL11.glVertex2f(x, y);
    GL11.glVertex2f(x + size, y);
    GL11.glVertex2f(x + size, y + size);
    GL11.glVertex2f(x, y + size);
    GL11.glEnd();
}

From source file:dripdisplay.DripDisplayLWJGL.java

protected void renderGL(Point locs) {
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);

    GL11.glPushMatrix();/* www . j  a  v  a 2  s .  c  o  m*/
    {
        drawBackground(locs);
        drawForeGround();
        if (e.LEVEL_COMPLETE == false) {
            drawShadow(locs);
        }
        drawUI();
    }
    GL11.glPopMatrix();
}

From source file:edu.csun.ecs.cs.multitouchj.ui.graphic.WindowManager.java

License:Apache License

protected void clearOpenGl() {
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    GL11.glLoadIdentity();
}