Example usage for org.lwjgl.opengl GL14 GL_FUNC_ADD

List of usage examples for org.lwjgl.opengl GL14 GL_FUNC_ADD

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL14 GL_FUNC_ADD.

Prototype

int GL_FUNC_ADD

To view the source code for org.lwjgl.opengl GL14 GL_FUNC_ADD.

Click Source Link

Document

Accepted by the mode parameter of BlendEquation.

Usage

From source file:fr.ign.cogit.geoxygene.appli.render.LwjglLayerRenderer.java

License:Open Source License

/**
 * Initialize layer FBO to receive GL primitives from a set of identical
 * symbolizers/* w  w w  .j a v a  2s .  c om*/
 * 
 * @param primitive
 * @param opacity
 * @param currentSymbolizer
 * @throws GLException
 */
private void clearFBOLayer() throws GLException {
    GLTools.glCheckError("preparing next FBO Layer");
    GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, this.getLayerViewPanel().getGLCanvas().getFboId());
    GL11.glDrawBuffer(GL30.GL_COLOR_ATTACHMENT0);

    GLTools.glCheckError("bind frame buffer");

    // Blending mode in FBO drawing.
    GLTools.glCheckError("finalizing FBO initialization");
    GL11.glClearColor(0f, 0f, 0f, 0f);
    GLTools.glCheckError("finalizing FBO initialization");
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);

    GLTools.glCheckError("finalizing FBO initialization");
    glEnable(GL11.GL_BLEND);
    GLTools.glCheckError("finalizing FBO initialization");
    GL20.glBlendEquationSeparate(GL14.GL_FUNC_ADD, GL14.GL_MAX);
    GLTools.glCheckError("finalizing FBO initialization");
    GL14.glBlendFuncSeparate(GL11.GL_ONE, GL11.GL_ZERO, GL11.GL_ZERO, GL11.GL_ZERO);
    GL30.glBindFramebuffer(GL30.GL_DRAW_FRAMEBUFFER, 0);
    GLTools.glCheckError("finalizing FBO initialization");
}

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

License:Open Source License

/**
 * Backup the current state of the relevant OpenGL state and change it to
 * what's needed to draw the curve./*  w  ww  .  jav  a 2  s. co m*/
 */
private RenderState startRender() {
    RenderState state = new RenderState();
    state.smoothedPoly = GL11.glGetBoolean(GL11.GL_POLYGON_SMOOTH);
    state.blendEnabled = GL11.glGetBoolean(GL11.GL_BLEND);
    state.depthEnabled = GL11.glGetBoolean(GL11.GL_DEPTH_TEST);
    state.depthWriteEnabled = GL11.glGetBoolean(GL11.GL_DEPTH_WRITEMASK);
    state.texEnabled = GL11.glGetBoolean(GL11.GL_TEXTURE_2D);
    state.texUnit = GL11.glGetInteger(GL13.GL_ACTIVE_TEXTURE);
    state.oldProgram = GL11.glGetInteger(GL20.GL_CURRENT_PROGRAM);
    state.oldArrayBuffer = GL11.glGetInteger(GL15.GL_ARRAY_BUFFER_BINDING);
    GL11.glDisable(GL11.GL_POLYGON_SMOOTH);
    GL11.glEnable(GL11.GL_BLEND);
    GL14.glBlendEquation(GL14.GL_FUNC_ADD);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthMask(true);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_TEXTURE_1D);
    GL11.glBindTexture(GL11.GL_TEXTURE_1D, staticState.gradientTexture);
    GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);

    GL20.glUseProgram(0);

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

    return state;
}

From source file:se.angergard.engine.display.Display.java

License:Apache License

public static void create(DisplayDef def) {

    glfwSetErrorCallback(errorCallback = errorCallbackPrint(System.err));

    if (glfwInit() != GL_TRUE) {
        throw new IllegalStateException("Unable to initialize GLFW");
    }//from   w ww  .j  av  a  2s . c  o m

    glfwDefaultWindowHints();
    glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
    glfwWindowHint(GLFW_RESIZABLE, GL_TRUE);
    glfwWindowHint(GLFW_DECORATED, GL_TRUE);
    // TODO: Fix this, important to MAC OS
    // glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);

    window = glfwCreateWindow(def.width, def.height, def.title, NULL, NULL);

    if (window == NULL) {
        throw new RuntimeException("Failed to create the GLFW window");
    }

    GLFW.glfwSetWindowSizeCallback(window, new GLFWWindowSizeCallback() {
        @Override
        public void invoke(long window, int width, int height) {
            System.out.println("Hej " + width + ", " + height);
            Display.width = width;
            Display.height = height;
        }
    });

    GLFW.glfwSetWindowCloseCallback(window, new GLFWWindowCloseCallback() {

        @Override
        public void invoke(long window) {
            RenderingEngine.dispose();
            glfwSetWindowShouldClose(window, GL11.GL_TRUE);
        }

    });

    glfwSetWindowPos(window, def.xPosition, def.yPosition);

    glfwMakeContextCurrent(window);
    glfwSwapInterval(1);

    glfwShowWindow(window);

    GLContext.createFromCurrent();

    // Only enable depth test if using 3d.

    glEnable(GL_TEXTURE_2D);

    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    GL14.glBlendEquation(GL14.GL_FUNC_ADD); // Not really neccessary

    RenderUtil.setClearColor(0.0f, 0.0f, 0.0f, 1.0f);

    Logger.log(Values.VERSION);
    Logger.log("Your OpenGL version is " + glGetString(GL_VERSION));
    Logger.log("Created Display with the following settings : " + def.toString());

}