uk.co.ifs_studios.engine.util.OpenGL.java Source code

Java tutorial

Introduction

Here is the source code for uk.co.ifs_studios.engine.util.OpenGL.java

Source

/*
Copyright (C) 2013 IFS Studios
    
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
    
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
    
You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package uk.co.ifs_studios.engine.util;

import org.lwjgl.opengl.GL11;

/**
 * A utilities class for OpenGL.
 * 
 * @author BleedObsidian (Jesse Prescott)
 */
public class OpenGL {

    /**
     * Setup OpenGL.
     * 
     * @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);
    }

    /**
     * OpenGL methods that need to be called every frame.
     */
    public static void update() {
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
    }
}