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:net.smert.frameworkgl.opengl.OpenGL1.java

License:Apache License

public OpenGL1 clear() {
    GL11.glClear(clearBits);
    return this;
}

From source file:net.smert.frameworkgl.opengl.OpenGL1.java

License:Apache License

public OpenGL1 clearColorBuffer() {
    GL11.glClear(ClearBits.COLOR_BUFFER_BIT);
    return this;
}

From source file:net.smert.frameworkgl.opengl.OpenGL1.java

License:Apache License

public OpenGL1 clearDepthBuffer() {
    GL11.glClear(ClearBits.DEPTH_BUFFER_BIT);
    return this;
}

From source file:net.smert.frameworkgl.opengl.OpenGL1.java

License:Apache License

public OpenGL1 clearStencilBuffer() {
    GL11.glClear(ClearBits.STENCIL_BUFFER_BIT);
    return this;
}

From source file:net._5tingr4y.openrpg.GameController.java

License:Open Source License

private void loop() {
    try {/*from   w  w  w . ja va 2s.  co  m*/
        while (running && glfwWindowShouldClose(oglHandler.getWindowID()) == GLFW_FALSE) {
            GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); // clear the framebuffer
            glfwSwapBuffers(oglHandler.getWindowID()); // swap the color buffers

            //window handling
            glfwPollEvents();

            //updating
            gameData.updateWorlds();

            //rendering
            gameData.renderWorld();

            //increment the tick counter
            currentTick++;
        }
    } finally {
        running = false;
        Log.info(this, "LWJGL cleanup starting");
        oglHandler.cleanupOpenGL();
        Log.info(this, "LWJGL cleanup complete");
    }
}

From source file:opengl.test.Demo.java

@Override
protected void render() {

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

    Matrix4F view = Matrix4F.move(yControl, zControl, xControl)
            .nhanMaTran(Matrix4F.rotateOY(this.DeltaY).nhanMaTran(Matrix4F.rotateOX(this.DeltaX)));

    this.c.setViewMatrix(view);
    this.caro.setViewMatrix(view);
    this.gt.setViewMatrix(view);
    this.table.setViewMatrix(view);
    this.tivi.setViewMatrix(view);

    this.gt.draw();
    this.c.render();
    this.table.render();
    this.tivi.render();
    caro.draw();//from   w  w w  .j av  a2 s.  c  o  m

}

From source file:org.agpu.oc.common.tileentity.AdvancedMonitor.java

public void startDrawing3D(int x, int y, int width, int height, float fov, float zNear, float zFar) {
    if (worldObj.isRemote) {
        GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, frameBufferID);

        GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
        GL11.glViewport(0, 0, width, height);

        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glPushMatrix();//from   w  w  w . ja v a2s . com
        GL11.glLoadIdentity();
        GLU.gluPerspective(fov, (float) width / (float) height, zNear, zFar);

        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glPushMatrix();
        GL11.glLoadIdentity();

        GL11.glClearColor(cr, cg, cb, ca);
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    }
}

From source file:org.agpu.oc.common.tileentity.AdvancedMonitor.java

public void startDrawing2D(int x, int y, int width, int height) {
    if (worldObj.isRemote) {
        GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, frameBufferID);

        GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
        GL11.glViewport(x, y, width, height);

        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glPushMatrix();/* w  ww. j av  a2  s .  c  om*/
        GL11.glLoadIdentity();
        GL11.glOrtho(0, width, height, 0, 1, -1);

        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glPushMatrix();
        GL11.glLoadIdentity();

        GL11.glClearColor(cr, cg, cb, ca);
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    }
}

From source file:org.bonsaimind.badgersvoyage.tools.planetstudio.Studio.java

License:Open Source License

public void run() {
    GL11.glClearColor(0.2f, 0.5f, 1f, 0f);
    GL11.glViewport(0, 0, Display.getWidth(), Display.getHeight());

    //GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);

    while (!Display.isCloseRequested() && !closeRequested) {
        processKeyboard();/*  www.  j a  v  a  2 s  . c om*/
        ErrorChecker.exitOnOpenGlError("After processKeyboard.");

        camera.startTranslate();
        sphere.translate();
        camera.endTranslate();
        ErrorChecker.exitOnOpenGlError("End of Translate.");

        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);

        GL20.glUseProgram(programId);
        sphere.render();

        GL20.glDisableVertexAttribArray(0);
        GL30.glDeleteVertexArrays(0);

        GL20.glUseProgram(0);

        Display.sync(60);
        Display.update();

        ErrorChecker.exitOnOpenGlError("End of main loop.");

    }

    Display.destroy();

}

From source file:org.cogaen.lwjgl.scene.SceneService.java

License:Open Source License

public void renderScene() {

    // quite and dirty frame counter
    this.clock.tick();
    this.fpsSum += this.clock.getDelta();
    if (++this.fpsCnt >= this.fpsAvg) {
        this.fpsCnt = 0;
        this.fps = String.format("FPS: %2.2f", (1.0 / (this.fpsSum / this.fpsAvg)));
        this.fpsSum = 0.0;
    }//  w w w  .j  a va 2  s  .c  o  m

    // Clear the screen and depth buffer
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);

    // render layers in each camera
    for (Camera camera : cameras) {
        if (!camera.isActive()) {
            continue;
        }

        camera.applyTransform();
        for (int i = this.layers.size() - 1; i >= 0; --i) {
            this.layers.get(i).render(camera.getMask());
        }

        for (RenderSubsystem rs : this.subSystems) {
            rs.render(camera.getMask());
        }
    }

    // draw overlays
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0, 1.0, 0, 1.0 / getAspectRatio(), 1, -1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glViewport(0, 0, this.config.getWidth(), this.config.getHeight());

    this.overlayRoot.renderWithAspectRatio(0xFFFFFFFF, getAspectRatio());
    //      this.overlayRoot.render(0xFFFFFFFF);

    // render frame counter
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glLoadIdentity();
    GL11.glOrtho(0, this.config.getWidth(), this.config.getHeight(), 0, 1, -1);
    GL11.glMatrixMode(GL11.GL_MODELVIEW);

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glColor4d(1, 0, 1, 1);
    font.drawString(5, this.config.getHeight() - 20, this.fps);

    Display.update();

    if (Display.isCloseRequested()) {
        this.evtSrv.dispatchEvent(new SimpleEvent(WINDOW_CLOSE_REQUEST));
    }
}