Java 类org.lwjgl.opengl.GL32 实例源码

项目:LowPolyWater    文件:ShaderProgram.java   
public ShaderProgram(MyFile vertexFile, MyFile geometryFile, MyFile fragmentFile, String... inVariables) {
    int vertexShaderID = loadShader(vertexFile, GL20.GL_VERTEX_SHADER);
    int geometryShaderID = loadShader(geometryFile, GL32.GL_GEOMETRY_SHADER);
    int fragmentShaderID = loadShader(fragmentFile, GL20.GL_FRAGMENT_SHADER);
    programID = GL20.glCreateProgram();
    GL20.glAttachShader(programID, vertexShaderID);
    GL20.glAttachShader(programID, geometryShaderID);
    GL20.glAttachShader(programID, fragmentShaderID);
    bindAttributes(inVariables);
    GL20.glLinkProgram(programID);
    GL20.glDetachShader(programID, vertexShaderID);
    GL20.glDetachShader(programID, geometryShaderID);
    GL20.glDetachShader(programID, fragmentShaderID);
    GL20.glDeleteShader(vertexShaderID);
    GL20.glDeleteShader(geometryShaderID);
    GL20.glDeleteShader(fragmentShaderID);
}
项目:LowPolyTerrain    文件:ShaderProgram.java   
public ShaderProgram(MyFile vertexFile, MyFile geometryFile, MyFile fragmentFile, String... inVariables) {
    int vertexShaderID = loadShader(vertexFile, GL20.GL_VERTEX_SHADER);
    int geometryShaderID = loadShader(geometryFile, GL32.GL_GEOMETRY_SHADER);
    int fragmentShaderID = loadShader(fragmentFile, GL20.GL_FRAGMENT_SHADER);
    programID = GL20.glCreateProgram();
    GL20.glAttachShader(programID, vertexShaderID);
    GL20.glAttachShader(programID, geometryShaderID);
    GL20.glAttachShader(programID, fragmentShaderID);
    bindAttributes(inVariables);
    GL20.glLinkProgram(programID);
    GL20.glDetachShader(programID, vertexShaderID);
    GL20.glDetachShader(programID, geometryShaderID);
    GL20.glDetachShader(programID, fragmentShaderID);
    GL20.glDeleteShader(vertexShaderID);
    GL20.glDeleteShader(geometryShaderID);
    GL20.glDeleteShader(fragmentShaderID);
}
项目:EcoSystem-Official    文件:ShaderProgram.java   
public ShaderProgram(MyFile vertexFile, MyFile geometryFile, MyFile fragmentFile, String... inVariables) {
    int vertexShaderID = loadShader(vertexFile, GL20.GL_VERTEX_SHADER);
    int geometryShaderID = loadShader(geometryFile, GL32.GL_GEOMETRY_SHADER);
    int fragmentShaderID = loadShader(fragmentFile, GL20.GL_FRAGMENT_SHADER);
    programID = GL20.glCreateProgram();
    GL20.glAttachShader(programID, vertexShaderID);
    GL20.glAttachShader(programID, geometryShaderID);
    GL20.glAttachShader(programID, fragmentShaderID);
    bindAttributes(inVariables);
    GL20.glLinkProgram(programID);
    GL20.glDetachShader(programID, vertexShaderID);
    GL20.glDetachShader(programID, geometryShaderID);
    GL20.glDetachShader(programID, fragmentShaderID);
    GL20.glDeleteShader(vertexShaderID);
    GL20.glDeleteShader(geometryShaderID);
    GL20.glDeleteShader(fragmentShaderID);
}
项目:warp    文件:ExtendedGLSLProgramCompiler.java   
private ExtendedGLSLProgram compileGLSL(
        String vertexShaderCode,
        String fragmentShaderCode,
        String geometryShaderCode,
        String tcsShaderCode,
        String tesShaderCode,
        ProgramAssemblyInfo assemblyInfo) {
    int vertexShader = compileShader(GL20.GL_VERTEX_SHADER, vertexShaderCode, assemblyInfo);
    int fragmentShader = compileShader(GL20.GL_FRAGMENT_SHADER, fragmentShaderCode, assemblyInfo);
    int geometryShader = compileShader(GL32.GL_GEOMETRY_SHADER, geometryShaderCode, assemblyInfo);
    int tcsShader = compileShader(GL40.GL_TESS_CONTROL_SHADER, tcsShaderCode, assemblyInfo);
    int tesShader = compileShader(GL40.GL_TESS_EVALUATION_SHADER, tesShaderCode, assemblyInfo);
    int program;
    String[] outNames = ProgramOutputResolver.getOutput(fragmentShaderCode);
    program = GLSLShaderCompiler.createProgram(
            new int[]{vertexShader, tcsShader, tesShader, geometryShader, fragmentShader}, outNames, assemblyInfo.getProgramName()
    );
    return new ExtendedGLSLProgram(fragmentShader, vertexShader, geometryShader, tcsShader, tesShader, program);
}
项目:geoxygene    文件:GLShader.java   
public GLShader(String _name, String type_as_string) {
    this.name = _name;
    switch (type_as_string) {
    case "GL_VERTEX_SHADER":
        this.type = GL20.GL_VERTEX_SHADER;
        break;
    case "GL_FRAGMENT_SHADER":
        this.type = GL20.GL_FRAGMENT_SHADER;
        break;
    case "GL_GEOMETRY_SHADER":
        this.type = GL32.GL_GEOMETRY_SHADER;
        break;
    default:
        Logger.getRootLogger().error("Unknow GL_TYPE " + type_as_string);
        break;
    }
}
项目:Null-Engine    文件:DeferredRenderer.java   
public void cancel() {
    if (hitIdSync != -1) {
        GL32.glDeleteSync(hitIdSync);
        hitIdSync = -1;
    }

    if (worldPositionSync != -1) {
        GL32.glDeleteSync(worldPositionSync);
        worldPositionSync = -1;
    }

    if (localPositionSync != -1) {
        GL32.glDeleteSync(localPositionSync);
        localPositionSync = -1;
    }

    if (workingPboIndex != -1) {
        renderer.freePbos.add(workingPboIndex);
    }
}
项目:Null-Engine    文件:FramebufferDeferred.java   
private void recreate() {
    frameBufferID = GL30.glGenFramebuffers();

    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, frameBufferID);
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, colorTextureID, 0);
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT1, GL11.GL_TEXTURE_2D, positionTextureID, 0);
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT2, GL11.GL_TEXTURE_2D, normalTextureID, 0);
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT3, GL11.GL_TEXTURE_2D, specularTextureID, 0);
    GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, depthTexutreID, 0);

    if (GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER) != GL30.GL_FRAMEBUFFER_COMPLETE) {
        Logs.e("Framebuffer error: " + GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER));
        throw new RuntimeException("Frame buffer is not complete");
    }

    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);
}
项目:Null-Engine    文件:FramebufferMousePick.java   
private void recreate() {
    frameBufferID = GL30.glGenFramebuffers();

    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, frameBufferID);
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, colorTextureID, 0);
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT1, GL11.GL_TEXTURE_2D, worldPositionTextureID, 0);
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT2, GL11.GL_TEXTURE_2D, localPositionTextureID, 0);
    GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, depthTexutreID, 0);

    if (GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER) != GL30.GL_FRAMEBUFFER_COMPLETE) {
        Logs.e("Framebuffer error: " + GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER));
        throw new RuntimeException("Frame buffer is not complete");
    }

    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);
}
项目:Argent    文件:GeometryShaderProgram.java   
protected void compileShaders(String vertexShader, String geometryShader, String fragmentShader) throws Exception {
    if(!isCompiled()) return;
    $setValue_vertexShaderHandle(loadShader(GL20.GL_VERTEX_SHADER, vertexShader));
    geometryShaderHandle = loadShader(GL32.GL_GEOMETRY_SHADER, geometryShader);
    $setValue_fragmentShaderHandle(loadShader(GL20.GL_FRAGMENT_SHADER, fragmentShader));

    if(geometryShaderHandle == -1) {
        $setValue_isCompiled(false);
        return;
    }
    int programId = linkProgram(createProgram());
    if(programId == -1) {
        $setValue_isCompiled(false);
        return;
    }
    $setValue_program(programId);
    $setValue_isCompiled(true);
}
项目:LWJGL-OpenGL-Utils    文件:TextureGenerator.java   
private static void throwIfLANotSupported() {
    if(!GLContext.getCapabilities().OpenGL30) {
        return;
    }

    if(!GLContext.getCapabilities().OpenGL32) {
        if(!GLContext.getCapabilities().GL_ARB_compatibility) {
            throw new ImageFormatUnsupportedException("Core OpenGL contexts cannot use Luminance/alpha.");
        }
    }
    else {
        int profileMask = glGetInteger(GL32.GL_CONTEXT_PROFILE_MASK);

        if((profileMask & GL32.GL_CONTEXT_CORE_PROFILE_BIT) != 0) {
            throw new ImageFormatUnsupportedException("Core OpenGL contexts cannot use Luminance/alpha.");

        }
    }
}
项目:LWJGL-OpenGL-Tutorials    文件:TextureGenerator.java   
private static void throwIfLANotSupported() {
    if(!GLContext.getCapabilities().OpenGL30) {
        return;
    }

    if(!GLContext.getCapabilities().OpenGL32) {
        if(!GLContext.getCapabilities().GL_ARB_compatibility) {
            throw new ImageFormatUnsupportedException("Core OpenGL contexts cannot use Luminance/alpha.");
        }
    }
    else {
        int profileMask = glGetInteger(GL32.GL_CONTEXT_PROFILE_MASK);

        if((profileMask & GL32.GL_CONTEXT_CORE_PROFILE_BIT) != 0) {
            throw new ImageFormatUnsupportedException("Core OpenGL contexts cannot use Luminance/alpha.");

        }
    }
}
项目:LowPolyWater    文件:RenderEngine.java   
/**
 * Prepares for a rendering pass. The depth and colour buffers of the
 * current framebuffer are cleared and a few other default settings are set.
 */
private void prepare() {
    GL11.glClearColor(1f, 1f, 1f, 1f);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    GL32.glProvokingVertex(GL32.GL_FIRST_VERTEX_CONVENTION);
    OpenGlUtils.cullBackFaces(true);
    OpenGlUtils.enableDepthTesting(true);
    OpenGlUtils.antialias(true);
}
项目:candlelight    文件:FBO.java   
public FBO attachTexture(Texture texture, int attachment, boolean updateViewPort)
{
    this.bind();
    this.texture = texture;
    this.viewport.setWidth((int) this.texture.width());
    this.viewport.setHeight((int) this.texture.height());
    GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, attachment, this.texture.handle(), 0);
    this.unbind();
    return this;
}
项目:LowPolyTerrain    文件:RenderEngine.java   
/**
 * A few general settings. Clears the colour and depth buffer before
 * rendering, turns on backface culling, enables depth testing, turns on
 * antialiasing and allows for wireframe rendering if the "G" key is
 * pressed. The provoking vertex convention is also set here, indicating
 * that the first vertex of each triangle should be the provoking vertex.
 * This is important when using the "flat" type qualifier in the shaders.
 */
private void prepare() {
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    GL32.glProvokingVertex(GL32.GL_FIRST_VERTEX_CONVENTION);
    OpenGlUtils.cullBackFaces(true);
    OpenGlUtils.enableDepthTesting(true);
    OpenGlUtils.antialias(true);
    if (Keyboard.isKeyDown(Keyboard.KEY_G)) {
        GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE);
    } else {
        GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
    }
}
项目:EcoSystem-Official    文件:RenderEngine.java   
/**
 * Prepares for a rendering pass. The depth and colour buffers of the
 * current framebuffer are cleared and a few other default settings are set.
 */
private void prepare() {
    GL11.glClearColor(0f, 0.66f, 0.94f, 1f);
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
    GL32.glProvokingVertex(GL32.GL_FIRST_VERTEX_CONVENTION);
    OpenGlUtils.cullBackFaces(true);
    OpenGlUtils.enableDepthTesting(true);
    OpenGlUtils.antialias(true);
}
项目:OcclusionQueries    文件:WaterFrameBuffers.java   
private int createTextureAttachment( int width, int height) {
    int texture = GL11.glGenTextures();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, width, height,
            0, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, (ByteBuffer) null);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0,
            texture, 0);
    return texture;
}
项目:OcclusionQueries    文件:WaterFrameBuffers.java   
private int createDepthTextureAttachment(int width, int height){
    int texture = GL11.glGenTextures();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL14.GL_DEPTH_COMPONENT32, width, height,
            0, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (ByteBuffer) null);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT,
            texture, 0);
    return texture;
}
项目:3d-Engine    文件:WaterFrameBuffers.java   
private int createTextureAttachment( int width, int height) {
    int texture = GL11.glGenTextures();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, width, height,
            0, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, (ByteBuffer) null);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0,
            texture, 0);
    return texture;
}
项目:3d-Engine    文件:WaterFrameBuffers.java   
private int createDepthTextureAttachment(int width, int height){
    int texture = GL11.glGenTextures();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL14.GL_DEPTH_COMPONENT32, width, height,
            0, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (ByteBuffer) null);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT,
            texture, 0);
    return texture;
}
项目:warp    文件:GBufferFramebuffer.java   
private void init() {
    bindDraw();
    GL32.glFramebufferTexture(GL30.GL_DRAW_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, gBuffer.getTextureName(3), 0);
    for(int i = 0; i < 3; i++) {
        int offset = GL30.GL_COLOR_ATTACHMENT0 + i;
        GL32.glFramebufferTexture(GL30.GL_DRAW_FRAMEBUFFER, offset, gBuffer.getTextureName(i), 0);
    }
    int buffers[] = {GL30.GL_COLOR_ATTACHMENT0, GL30.GL_COLOR_ATTACHMENT1, GL30.GL_COLOR_ATTACHMENT2};
    GL20.glDrawBuffers(buffers);
    int status = GL30.glCheckFramebufferStatus(GL30.GL_DRAW_FRAMEBUFFER);
    if(status == GL30.GL_FRAMEBUFFER_COMPLETE) complete = true;
    else throw new FramebufferException("Failed to assemble framebuffer: " + getName() + ". Status is: " + status);
}
项目:sandbox    文件:WaterFrameBuffers.java   
private int createTextureAttachment(int width, int height) {
    int texture = GL11.glGenTextures();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, width, height, 0, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE, (ByteBuffer) null);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    if (DisplayManager.hasAttribs()) GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, texture, 0);
    return texture;
}
项目:sandbox    文件:WaterFrameBuffers.java   
private int createDepthTextureAttachment(int width, int height) {
    int texture = GL11.glGenTextures();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL14.GL_DEPTH_COMPONENT32, width, height, 0, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (ByteBuffer) null);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    if (DisplayManager.hasAttribs()) GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, texture, 0);
    return texture;
}
项目:sandbox    文件:ShadowFrameBuffer.java   
private static int createDepthBufferAttachment(int width, int height) {
    int texture = GL11.glGenTextures();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL14.GL_DEPTH_COMPONENT16, width, height, 0, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (ByteBuffer) null);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
    if (DisplayManager.hasAttribs()) GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, texture, 0);
    return texture;
}
项目:Null-Engine    文件:FramebufferDeferred.java   
/**
 * Create a new framebuffer
 * @param width The width
 * @param height The height
 */
public FramebufferDeferred(int width, int height) {
    this.width = width;
    this.height = height;

    depthTexutreID = GL11.glGenTextures();
    frameBufferID = GL30.glGenFramebuffers();

    colorTextureID = genTexture(width, height);
    positionTextureID = genTextureDetailed(width, height);
    normalTextureID = genTextureDetailed(width, height);
    specularTextureID = genTextureDetailed(width, height);

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, depthTexutreID);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL30.GL_DEPTH_COMPONENT32F, width, height, 0, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (ByteBuffer) null);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);

    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, frameBufferID);
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, colorTextureID, 0);
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT1, GL11.GL_TEXTURE_2D, positionTextureID, 0);
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT2, GL11.GL_TEXTURE_2D, normalTextureID, 0);
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT3, GL11.GL_TEXTURE_2D, specularTextureID, 0);
    GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, depthTexutreID, 0);

    if (GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER) != GL30.GL_FRAMEBUFFER_COMPLETE) {
        Logs.d("Failed to create framebuffer of size " + width + "x" + height);
        throw new RuntimeException("Frame buffer is not complete");
    }

    GL20.glDrawBuffers(DRAW_BUFFERS);

    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);

    framebuffers.add(this);
}
项目:Null-Engine    文件:Framebuffer3D.java   
/**
 * Create a new framebuffer
 * @param width The width
 * @param height The height
 */
public Framebuffer3D(int width, int height) {
    this.width = width;
    this.height = height;

    colorTextureID = GL11.glGenTextures();
    depthTexutreID = GL11.glGenTextures();
    frameBufferID = GL30.glGenFramebuffers();

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, colorTextureID);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA8, width, height, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer) null);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, depthTexutreID);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL30.GL_DEPTH_COMPONENT32F, width, height, 0, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (ByteBuffer) null);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);

    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, frameBufferID);
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, colorTextureID, 0);
    GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, depthTexutreID, 0);

    if (GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER) != GL30.GL_FRAMEBUFFER_COMPLETE)
        throw new RuntimeException("Frame buffer is not complete");

    GL20.glDrawBuffers(GL30.GL_COLOR_ATTACHMENT0);

    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);

    framebuffers.add(this);
}
项目:Null-Engine    文件:Framebuffer3D.java   
private void recreate() {
    frameBufferID = GL30.glGenFramebuffers();

    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, frameBufferID);
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, colorTextureID, 0);
    GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, depthTexutreID, 0);

    if (GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER) != GL30.GL_FRAMEBUFFER_COMPLETE) {
        Logs.e("Framebuffer error: " + GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER));
        throw new RuntimeException("Frame buffer is not complete");
    }

    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);
}
项目:Null-Engine    文件:FramebufferMousePick.java   
/**
 * Create a new framebuffer
 * @param width The width
 * @param height The height
 */
public FramebufferMousePick(int width, int height) {
    this.width = width;
    this.height = height;

    depthTexutreID = GL11.glGenTextures();
    frameBufferID = GL30.glGenFramebuffers();

    colorTextureID = genTextureDetailed(width, height);
    worldPositionTextureID = genTextureDetailed(width, height);
    localPositionTextureID = genTextureDetailed(width, height);

    GL11.glBindTexture(GL11.GL_TEXTURE_2D, depthTexutreID);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL30.GL_DEPTH_COMPONENT32F, width, height, 0, GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (ByteBuffer) null);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);

    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, frameBufferID);
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, colorTextureID, 0);
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT1, GL11.GL_TEXTURE_2D, worldPositionTextureID, 0);
    GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT2, GL11.GL_TEXTURE_2D, localPositionTextureID, 0);
    GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, depthTexutreID, 0);

    if (GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER) != GL30.GL_FRAMEBUFFER_COMPLETE) {
        Logs.d("Failed to create framebuffer of size " + width + "x" + height);
        throw new RuntimeException("Frame buffer is not complete");
    }

    GL20.glDrawBuffers(DRAW_BUFFERS);

    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);

    framebuffers.add(this);
}
项目:Visage    文件:Errors.java   
private static void buildMapping() {
    if (mapping != null) return;
    Multimap<Integer, String> map = HashMultimap.create();
    List<Class<?>> classes = ImmutableList.of(
            GL11.class, GL12.class, GL13.class, GL14.class, GL15.class,
            GL20.class, GL21.class, GL30.class, GL31.class, GL32.class,
            GL33.class, GL40.class, GL41.class, GL42.class, GL43.class,
            GL44.class, GL45.class, GLFW.class
            );
    for (Class<?> clazz : classes) {
        for (Field f : clazz.getDeclaredFields()) {
            if (f.getName().toUpperCase(Locale.ROOT).equals(f.getName()) &&
                    f.getType() == int.class && Modifier.isPublic(f.getModifiers()) && Modifier.isStatic(f.getModifiers())) {
                List<String> li = Splitter.on('_').splitToList(f.getName());
                li = li.subList(1, li.size());
                String clean =
                    Joiner.on(' ').join(
                        li.stream()
                            .map(Errors::toTitleCase)
                            .iterator());
                try {
                    map.put(f.getInt(null), clean);
                } catch (Throwable t) {
                    t.printStackTrace();
                }
            }
        }
    }
    mapping = map;
}
项目:Mystic-Bastion    文件:ShadowFrameBuffer.java   
/**
 * Creates a depth buffer texture attachment.
 * 
 * @param width
 *            - the width of the texture.
 * @param height
 *            - the height of the texture.
 * @return The ID of the depth texture.
 */
private static int createDepthBufferAttachment(int width, int height) {
    int texture = GL11.glGenTextures();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL14.GL_DEPTH_COMPONENT16, width, height, 0,
            GL11.GL_DEPTH_COMPONENT, GL11.GL_FLOAT, (ByteBuffer) null);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
    GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, texture, 0);
    return texture;
}
项目:Mystic-Bastion    文件:WaterFrameBuffers.java   
private int createTextureAttachment(int width, int height) {
    int texture = GL11.glGenTextures();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, width, height, 0, GL11.GL_RGB, GL11.GL_UNSIGNED_BYTE,
            (ByteBuffer) null);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, texture, 0);
    return texture;
}
项目:Mystic-Bastion    文件:WaterFrameBuffers.java   
private int createDepthTextureAttachment(int width, int height) {
    int texture = GL11.glGenTextures();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL14.GL_DEPTH_COMPONENT32, width, height, 0, GL11.GL_DEPTH_COMPONENT,
            GL11.GL_FLOAT, (ByteBuffer) null);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, texture, 0);
    return texture;
}
项目:CubeEngine    文件:ProgramParticleBillboarded.java   
public ProgramParticleBillboarded() {
    super();
    this.addShader(GLH.glhLoadShader(R.getResPath("shaders/billboards.gs"), GL32.GL_GEOMETRY_SHADER));
    this.addShader(GLH.glhLoadShader(R.getResPath("shaders/billboards.vs"), GL20.GL_VERTEX_SHADER));
    this.addShader(GLH.glhLoadShader(R.getResPath("shaders/billboards.fs"), GL20.GL_FRAGMENT_SHADER));
    this.link();
}
项目:CubeEngine    文件:ProgramTexturedQuad.java   
public ProgramTexturedQuad() {
    super();
    this.addShader(GLH.glhLoadShader(R.getResPath("shaders/gui/quadTextured.fs"), GL20.GL_FRAGMENT_SHADER));
    this.addShader(GLH.glhLoadShader(R.getResPath("shaders/gui/quadTextured.gs"), GL32.GL_GEOMETRY_SHADER));
    this.addShader(GLH.glhLoadShader(R.getResPath("shaders/gui/quadTextured.vs"), GL20.GL_VERTEX_SHADER));
    this.link();
}
项目:CubeEngine    文件:ProgramColoredQuad.java   
public ProgramColoredQuad() {
    super();
    this.addShader(GLH.glhLoadShader(R.getResPath("shaders/gui/quadColored.fs"), GL20.GL_FRAGMENT_SHADER));
    this.addShader(GLH.glhLoadShader(R.getResPath("shaders/gui/quadColored.gs"), GL32.GL_GEOMETRY_SHADER));
    this.addShader(GLH.glhLoadShader(R.getResPath("shaders/gui/quadColored.vs"), GL20.GL_VERTEX_SHADER));
    this.link();
}
项目:CubeEngine    文件:GLProgramPostProcessing.java   
public GLProgramPostProcessing(String filepath) {
    super();

    if (vertex_shader == null) {
        vertex_shader = GLH.glhLoadShader(R.getResPath("shaders/post_process/post_processing.vs"),
                GL20.GL_VERTEX_SHADER);
        geometry_shader = GLH.glhLoadShader(R.getResPath("shaders/post_process/post_processing.gs"),
                GL32.GL_GEOMETRY_SHADER);
    }

    this.addShader(GLH.glhLoadShader(filepath, GL20.GL_FRAGMENT_SHADER));
    this.addShader(geometry_shader);
    this.addShader(vertex_shader);
    this.link();
}
项目:jglrEngine    文件:OpenGLUtils.java   
public static void loadCapNames()
{
    loadCapNames(GL11.class);
    loadCapNames(GL20.class);
    loadCapNames(GL30.class);
    loadCapNames(GL32.class);
}
项目:item-render    文件:FBOHelper.java   
private void createFramebuffer() {
    framebufferID = GL30.glGenFramebuffers();
    textureID = GL11.glGenTextures();
    int currentFramebuffer = GL11.glGetInteger(GL30.GL_FRAMEBUFFER_BINDING);
    int currentTexture = GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D);

    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, framebufferID);

    // Set our texture up, empty.
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
    GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
    GL11.glTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, renderTextureSize, renderTextureSize, 0, GL12.GL_BGRA,
            GL11.GL_UNSIGNED_BYTE, (java.nio.ByteBuffer) null);

    // Restore old texture
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, currentTexture);

    // Create depth buffer
    depthbufferID = GL30.glGenRenderbuffers();
    GL30.glBindRenderbuffer(GL30.GL_RENDERBUFFER, depthbufferID);
    GL30.glRenderbufferStorage(GL30.GL_RENDERBUFFER, GL11.GL_DEPTH_COMPONENT, renderTextureSize, renderTextureSize);

    // Bind depth buffer to the framebuffer
    GL30.glFramebufferRenderbuffer(GL30.GL_FRAMEBUFFER, GL30.GL_DEPTH_ATTACHMENT, GL30.GL_RENDERBUFFER, depthbufferID);

    // Bind our texture to the framebuffer
    GL32.glFramebufferTexture(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, textureID, 0);

    // Revert to default framebuffer
    GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, currentFramebuffer);
}
项目:JCaelum    文件:GL3.java   
public static int glClientWaitSync(long sync, int flags, long timeout) throws GLException
{
    int ret = GL32.glClientWaitSync(sync, flags, timeout);

    RenderHelper.checkForGLError();

    return ret;
}
项目:JCaelum    文件:GL3.java   
public static long glFenceSync(int condition, int flags) throws GLException
{
    long ret = GL32.glFenceSync(condition, flags);

    RenderHelper.checkForGLError();

    return ret;
}
项目:JCaelum    文件:GL3.java   
public static long glGetBufferParameteri64(int target, int pname) throws GLException
{
    long ret = GL32.glGetBufferParameteri64(target, pname);

    RenderHelper.checkForGLError();

    return ret;
}