Example usage for org.lwjgl.opengl GL32 GL_DEPTH_CLAMP

List of usage examples for org.lwjgl.opengl GL32 GL_DEPTH_CLAMP

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL32 GL_DEPTH_CLAMP.

Prototype

int GL_DEPTH_CLAMP

To view the source code for org.lwjgl.opengl GL32 GL_DEPTH_CLAMP.

Click Source Link

Document

Accepted by the cap parameter of Enable, Disable, and IsEnabled, and by the pname parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev.

Usage

From source file:org.jge.render.RenderEngine.java

License:Open Source License

public void init() {
    try {/*from  w w  w .j a  v  a 2s.c om*/
        beforeRenders = new Stack<Runnable>();
        this.setBoolean("normalMapping", true);
        this.setParallaxDispMapping(true);
        this.setLighting(true);
        this.setShadowing(true);
        postFilters = new ArrayList<Shader>();

        lightMatrix = new Matrix4().initScale(0, 0, 0);
        ambientShader = new Shader(new ResourceLocation("shaders", "forward-ambient"));
        renderToTextShader = new Shader(new ResourceLocation("shaders", "renderToText"));
        shadowMapShader = new Shader(new ResourceLocation("shaders", "shadowMapGen"));
        nullFilterShader = new Shader(new ResourceLocation("shaders", "filter-null"));
        gausBlurFilterShader = new Shader(new ResourceLocation("shaders", "filter-gausBlur7x1"));

        setClearColor(0, 0, 0, 0);
        glFrontFace(GL_CW);
        glCullFace(GL_BACK);
        enableGLCap(GL_CULL_FACE);
        enableGLCap(GL_DEPTH_TEST);
        enableGLCap(GL32.GL_DEPTH_CLAMP);

        glShadeModel(GL_SMOOTH);
        setVector3("ambient", Vector3.get(0.75f, 0.75f, 0.75f));
        shadowMaps = new Texture[ShadowMapSize.values().length];
        shadowMapTempTargets = new Texture[ShadowMapSize.values().length];
        for (int i = 0; i < ShadowMapSize.values().length; i++) {
            shadowMaps[i] = new Texture(ShadowMapSize.values()[i].getSize(),
                    ShadowMapSize.values()[i].getSize(), null, GL_TEXTURE_2D, GL_LINEAR, GL_COLOR_ATTACHMENT0,
                    GL_RG32F, GL_RGBA, true);
            shadowMapTempTargets[i] = new Texture(ShadowMapSize.values()[i].getSize(),
                    ShadowMapSize.values()[i].getSize(), null, GL_TEXTURE_2D, GL_LINEAR, GL_COLOR_ATTACHMENT0,
                    GL_RG32F, GL_RGBA, true);
        }

        lights = new ArrayList<BaseLight>();

        glClampColor(GL_CLAMP_FRAGMENT_COLOR, GL_FALSE);
        glClampColor(GL_CLAMP_READ_COLOR, GL_FALSE);
        glClampColor(GL_CLAMP_VERTEX_COLOR, GL_FALSE);

        double width = (double) Window.getCurrent().getWidth() / 1.0;
        double height = (double) Window.getCurrent().getHeight() / 1.0;

        renderToTextTarget = new Texture((int) width, (int) height, null, GL_TEXTURE_2D, GL_NEAREST,
                GL30.GL_COLOR_ATTACHMENT0, GL30.GL_RGBA32F, GL_RGBA, false);
        renderToTextTargetTemp = new Texture((int) width, (int) height, null, GL_TEXTURE_2D, GL_NEAREST,
                GL30.GL_COLOR_ATTACHMENT0, GL30.GL_RGBA32F, GL_RGBA, false);
        planeMaterial = new Material();
        planeMaterial.setFloat("specularIntensity", 1);
        planeMaterial.setFloat("specularPower", 8);
        planeMaterial.setTexture("diffuse", renderToTextTarget);
        altTransform = new Transform();
        altCamera = new Camera(initMatrix = new Matrix4().initIdentity());
        altCamera.setName("alternative camera");
        renderToTextCameraObject = new DummySceneObject(altCamera);
        renderToTextCameraObject.getTransform().rotate(Vector3.get(0, 1, 0), (float) Maths.toRadians(180));

        altTransform.rotate(Vector3.get(1, 0, 0), (float) Maths.toRadians(90));
        altTransform.rotate(Vector3.get(0, 1, 0), (float) Maths.toRadians(180));
        planeMesh = new Mesh(JGEngine.getClasspathResourceLoader()
                .getResource(new ResourceLocation("models", "planePrimitive.obj")));

        setVector3("shadowColor", Vector3.get(0, 0, 0));
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:ovh.tgrhavoc.gameengine.core.RenderUtil.java

License:Open Source License

public static void initGraphics() {
    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

    glFrontFace(GL_CW);/*from w ww  .j  a v a  2  s  .  com*/
    glCullFace(GL_BACK);
    glEnable(GL_CULL_FACE);

    glEnable(GL_TEXTURE_2D);
    glEnable(GL_DEPTH_TEST);

    glEnable(GL32.GL_DEPTH_CLAMP);

    //glEnable(GL30.GL_FRAMEBUFFER_SRGB);
}