Search in sources :

Example 1 with JoglGLExt

use of com.jme3.renderer.jogl.JoglGLExt in project jmonkeyengine by jMonkeyEngine.

the class JoglContext method initContextFirstTime.

protected void initContextFirstTime() {
    if (GLContext.getCurrent().getGLVersionNumber().getMajor() < 2) {
        throw new RendererException("OpenGL 2.0 or higher is " + "required for jMonkeyEngine");
    }
    if (settings.getRenderer().startsWith("JOGL")) {
        com.jme3.renderer.opengl.GL gl = new JoglGL();
        GLExt glext = new JoglGLExt();
        GLFbo glfbo = new JoglGLFbo();
        if (settings.getBoolean("GraphicsDebug")) {
            gl = new GLDebugDesktop(gl, glext, glfbo);
            glext = (GLExt) gl;
            glfbo = (GLFbo) gl;
        }
        if (settings.getBoolean("GraphicsTiming")) {
            GLTimingState timingState = new GLTimingState();
            gl = (com.jme3.renderer.opengl.GL) GLTiming.createGLTiming(gl, timingState, GL.class, GL2.class, GL3.class, GL4.class);
            glext = (GLExt) GLTiming.createGLTiming(glext, timingState, GLExt.class);
            glfbo = (GLFbo) GLTiming.createGLTiming(glfbo, timingState, GLFbo.class);
        }
        if (settings.getBoolean("GraphicsTrace")) {
            gl = (com.jme3.renderer.opengl.GL) GLTracer.createDesktopGlTracer(gl, GL.class, GL2.class, GL3.class, GL4.class);
            glext = (GLExt) GLTracer.createDesktopGlTracer(glext, GLExt.class);
            glfbo = (GLFbo) GLTracer.createDesktopGlTracer(glfbo, GLFbo.class);
        }
        renderer = new GLRenderer(gl, glext, glfbo);
        renderer.initialize();
    } else {
        throw new UnsupportedOperationException("Unsupported renderer: " + settings.getRenderer());
    }
    if (GLContext.getCurrentGL().isExtensionAvailable("GL_ARB_debug_output") && settings.getBoolean("GraphicsDebug")) {
        GLContext.getCurrent().enableGLDebugMessage(true);
        GLContext.getCurrent().addGLDebugListener(new JoglGLDebugOutputHandler());
    }
    renderer.setMainFrameBufferSrgb(settings.isGammaCorrection());
    renderer.setLinearizeSrgbImages(settings.isGammaCorrection());
    // Init input
    if (keyInput != null) {
        keyInput.initialize();
    }
    if (mouseInput != null) {
        mouseInput.initialize();
    }
    if (joyInput != null) {
        joyInput.initialize();
    }
    if (settings.isOpenCLSupport()) {
        initOpenCL();
    }
}
Also used : JoglGLFbo(com.jme3.renderer.jogl.JoglGLFbo) GLFbo(com.jme3.renderer.opengl.GLFbo) GLRenderer(com.jme3.renderer.opengl.GLRenderer) JoglGLFbo(com.jme3.renderer.jogl.JoglGLFbo) GLExt(com.jme3.renderer.opengl.GLExt) JoglGLExt(com.jme3.renderer.jogl.JoglGLExt) JoglGLExt(com.jme3.renderer.jogl.JoglGLExt) RendererException(com.jme3.renderer.RendererException) GLDebugDesktop(com.jme3.renderer.opengl.GLDebugDesktop) GLTimingState(com.jme3.renderer.opengl.GLTimingState) JoglGL(com.jme3.renderer.jogl.JoglGL)

Aggregations

RendererException (com.jme3.renderer.RendererException)1 JoglGL (com.jme3.renderer.jogl.JoglGL)1 JoglGLExt (com.jme3.renderer.jogl.JoglGLExt)1 JoglGLFbo (com.jme3.renderer.jogl.JoglGLFbo)1 GLDebugDesktop (com.jme3.renderer.opengl.GLDebugDesktop)1 GLExt (com.jme3.renderer.opengl.GLExt)1 GLFbo (com.jme3.renderer.opengl.GLFbo)1 GLRenderer (com.jme3.renderer.opengl.GLRenderer)1 GLTimingState (com.jme3.renderer.opengl.GLTimingState)1