Example usage for org.lwjgl.opengl GL11 glGetString

List of usage examples for org.lwjgl.opengl GL11 glGetString

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glGetString.

Prototype

@Nullable
@NativeType("GLubyte const *")
public static String glGetString(@NativeType("GLenum") int name) 

Source Link

Document

Return strings describing properties of the current GL context.

Usage

From source file:org.free.jake2.render.lwjgl.Main.java

License:Open Source License

/**
 * R_Init2//  w  ww.  ja v a  2s .c  om
 */
protected boolean R_Init2() {
    VID.MenuInit();

    /*
     ** get our various GL strings
     */
    gl_config.vendor_string = GL11.glGetString(GL11.GL_VENDOR);
    VID.Printf(Defines.PRINT_ALL, "GL_VENDOR: " + gl_config.vendor_string + '\n');
    gl_config.renderer_string = GL11.glGetString(GL11.GL_RENDERER);
    VID.Printf(Defines.PRINT_ALL, "GL_RENDERER: " + gl_config.renderer_string + '\n');
    gl_config.version_string = GL11.glGetString(GL11.GL_VERSION);
    VID.Printf(Defines.PRINT_ALL, "GL_VERSION: " + gl_config.version_string + '\n');
    gl_config.extensions_string = GL11.glGetString(GL11.GL_EXTENSIONS);
    VID.Printf(Defines.PRINT_ALL, "GL_EXTENSIONS: " + gl_config.extensions_string + '\n');

    gl_config.parseOpenGLVersion();

    String renderer_buffer = gl_config.renderer_string.toLowerCase();
    String vendor_buffer = gl_config.vendor_string.toLowerCase();

    if (renderer_buffer.indexOf("voodoo") >= 0) {
        if (renderer_buffer.indexOf("rush") < 0) {
            gl_config.renderer = GL_RENDERER_VOODOO;
        } else {
            gl_config.renderer = GL_RENDERER_VOODOO_RUSH;
        }
    } else if (vendor_buffer.indexOf("sgi") >= 0) {
        gl_config.renderer = GL_RENDERER_SGI;
    } else if (renderer_buffer.indexOf("permedia") >= 0) {
        gl_config.renderer = GL_RENDERER_PERMEDIA2;
    } else if (renderer_buffer.indexOf("glint") >= 0) {
        gl_config.renderer = GL_RENDERER_GLINT_MX;
    } else if (renderer_buffer.indexOf("glzicd") >= 0) {
        gl_config.renderer = GL_RENDERER_REALIZM;
    } else if (renderer_buffer.indexOf("gdi") >= 0) {
        gl_config.renderer = GL_RENDERER_MCD;
    } else if (renderer_buffer.indexOf("pcx2") >= 0) {
        gl_config.renderer = GL_RENDERER_PCX2;
    } else if (renderer_buffer.indexOf("verite") >= 0) {
        gl_config.renderer = GL_RENDERER_RENDITION;
    } else {
        gl_config.renderer = GL_RENDERER_OTHER;
    }

    String monolightmap = gl_monolightmap.string.toUpperCase();
    if (monolightmap.length() < 2 || monolightmap.charAt(1) != 'F') {
        if (gl_config.renderer == GL_RENDERER_PERMEDIA2) {
            Cvar.Set("gl_monolightmap", "A");
            VID.Printf(Defines.PRINT_ALL, "...using gl_monolightmap 'a'\n");
        } else if ((gl_config.renderer & GL_RENDERER_POWERVR) != 0) {
            Cvar.Set("gl_monolightmap", "0");
        } else {
            Cvar.Set("gl_monolightmap", "0");
        }
    }

    // power vr can't have anything stay in the framebuffer, so
    // the screen needs to redraw the tiled background every frame
    if ((gl_config.renderer & GL_RENDERER_POWERVR) != 0) {
        Cvar.Set("scr_drawall", "1");
    } else {
        Cvar.Set("scr_drawall", "0");
    }

    // MCD has buffering issues
    if (gl_config.renderer == GL_RENDERER_MCD) {
        Cvar.SetValue("gl_finish", 1);
    }

    if ((gl_config.renderer & GL_RENDERER_3DLABS) != 0) {
        if (gl_3dlabs_broken.value != 0.0f) {
            gl_config.allow_cds = false;
        } else {
            gl_config.allow_cds = true;
        }
    } else {
        gl_config.allow_cds = true;
    }

    if (gl_config.allow_cds) {
        VID.Printf(Defines.PRINT_ALL, "...allowing CDS\n");
    } else {
        VID.Printf(Defines.PRINT_ALL, "...disabling CDS\n");
    }

    /*
     ** grab extensions
     */
    if (gl_config.extensions_string.indexOf("GL_EXT_compiled_vertex_array") >= 0
            || gl_config.extensions_string.indexOf("GL_SGI_compiled_vertex_array") >= 0) {
        VID.Printf(Defines.PRINT_ALL, "...enabling GL_EXT_compiled_vertex_array\n");
        //       qglLockArraysEXT = ( void * ) qwglGetProcAddress( "glLockArraysEXT" );
        if (gl_ext_compiled_vertex_array.value != 0.0f) {
            qglLockArraysEXT = true;
        } else {
            qglLockArraysEXT = false;
        }
        //       qglUnlockArraysEXT = ( void * ) qwglGetProcAddress( "glUnlockArraysEXT" );
        //qglUnlockArraysEXT = true;
    } else {
        VID.Printf(Defines.PRINT_ALL, "...GL_EXT_compiled_vertex_array not found\n");
        qglLockArraysEXT = false;
    }

    if (gl_config.extensions_string.indexOf("WGL_EXT_swap_control") >= 0) {
        qwglSwapIntervalEXT = true;
        VID.Printf(Defines.PRINT_ALL, "...enabling WGL_EXT_swap_control\n");
    } else {
        qwglSwapIntervalEXT = false;
        VID.Printf(Defines.PRINT_ALL, "...WGL_EXT_swap_control not found\n");
    }

    if (gl_config.extensions_string.indexOf("GL_EXT_point_parameters") >= 0) {
        if (gl_ext_pointparameters.value != 0.0f) {
            //          qglPointParameterfEXT = ( void (APIENTRY *)( GLenum, GLfloat ) ) qwglGetProcAddress( "glPointParameterfEXT" );
            qglPointParameterfEXT = true;
            //          qglPointParameterfvEXT = ( void (APIENTRY *)( GLenum, const GLfloat * ) ) qwglGetProcAddress( "glPointParameterfvEXT" );
            VID.Printf(Defines.PRINT_ALL, "...using GL_EXT_point_parameters\n");
        } else {
            VID.Printf(Defines.PRINT_ALL, "...ignoring GL_EXT_point_parameters\n");
        }
    } else {
        VID.Printf(Defines.PRINT_ALL, "...GL_EXT_point_parameters not found\n");
    }

    // #ifdef __linux__
    //    if ( strstr( gl_config.extensions_string, "3DFX_set_global_palette" ))
    //    {
    //       if ( gl_ext_palettedtexture->value )
    //       {
    //          VID.Printf( Defines.PRINT_ALL, "...using 3DFX_set_global_palette\n" );
    //          qgl3DfxSetPaletteEXT = ( void ( APIENTRY * ) (GLuint *) )qwglGetProcAddress( "gl3DfxSetPaletteEXT" );
    ////          qglColorTableEXT = Fake_glColorTableEXT;
    //       }
    //       else
    //       {
    //          VID.Printf( Defines.PRINT_ALL, "...ignoring 3DFX_set_global_palette\n" );
    //       }
    //    }
    //    else
    //    {
    //       VID.Printf( Defines.PRINT_ALL, "...3DFX_set_global_palette not found\n" );
    //    }
    // #endif

    if (!qglColorTableEXT && gl_config.extensions_string.indexOf("GL_EXT_paletted_texture") >= 0
            && gl_config.extensions_string.indexOf("GL_EXT_shared_texture_palette") >= 0) {
        if (gl_ext_palettedtexture.value != 0.0f) {
            VID.Printf(Defines.PRINT_ALL, "...using GL_EXT_shared_texture_palette\n");
            qglColorTableEXT = false; // true; TODO jogl bug
        } else {
            VID.Printf(Defines.PRINT_ALL, "...ignoring GL_EXT_shared_texture_palette\n");
            qglColorTableEXT = false;
        }
    } else {
        VID.Printf(Defines.PRINT_ALL, "...GL_EXT_shared_texture_palette not found\n");
    }

    if (gl_config.extensions_string.indexOf("GL_ARB_multitexture") >= 0) {
        VID.Printf(Defines.PRINT_ALL, "...using GL_ARB_multitexture\n");
        qglActiveTextureARB = true;
        GL_TEXTURE0 = ARBMultitexture.GL_TEXTURE0_ARB;
        GL_TEXTURE1 = ARBMultitexture.GL_TEXTURE1_ARB;
    } else {
        VID.Printf(Defines.PRINT_ALL, "...GL_ARB_multitexture not found\n");
    }

    if (!(qglActiveTextureARB)) {
        return false;
    }

    GL_SetDefaultState();

    GL_InitImages();
    Mod_Init();
    R_InitParticleTexture();
    Draw_InitLocal();

    int err = GL11.glGetError();
    if (err != GL11.GL_NO_ERROR) {
        VID.Printf(Defines.PRINT_ALL, "glGetError() = 0x%x\n\t%s\n",
                new Vargs(2).add(err).add("" + GL11.glGetString(err)));
    }

    return true;
}

From source file:org.jtrfp.mtmx.Engine.java

License:Open Source License

public void start(String title, boolean chooseDisplayMode) throws EngineException {
    try {//ww w .  j  a v a 2s  .  c o m
        if (chooseDisplayMode) {
            setupDisplay();
        } else {
            Display.setDisplayMode(new DisplayMode(640, 480));
        }
        Display.setTitle(title);
        Display.create();

        getLogger().log(Level.INFO, "GL_VENDOR: " + GL11.glGetString(GL11.GL_VENDOR));
        getLogger().log(Level.INFO, "GL_RENDERER: " + GL11.glGetString(GL11.GL_RENDERER));
        getLogger().log(Level.INFO, "GL_VERSION: " + GL11.glGetString(GL11.GL_VERSION));

        engineConfiguration.init(this);

        engineConfiguration.initResources();

        Keyboard.create();
        Keyboard.enableRepeatEvents(false);
        engineConfiguration.initKeyboard();

        engineConfiguration.initLight();

        DisplayMode displayMode = getDisplayMode();
        GL11.glViewport(0, 0, displayMode.getWidth(), displayMode.getHeight());
        engineConfiguration.initView();

        loop();

        destroy();
    } catch (LWJGLException e) {
        destroy();
        throw new EngineException("Failed to create display.", e);
    }
}

From source file:org.lwjgl.info.LWJGLInfoView.java

License:Open Source License

/**
 * @param i_canvas /*from   www  .j av  a2s. c  o  m*/
 * @return
 */
private static String gatherInformation() {
    StringBuffer strb = new StringBuffer();

    try {
        infoNL(strb, "LWJGL feature version", getFeatureVersion("org.lwjgl"));
    } catch (Exception ex) {
        warnNL(strb, "Error retrieving feature version: " + ex.getMessage());
    }

    infoNL(strb, "LWJGL version", Sys.getVersion() + (Sys.is64Bit() ? " (64bit)" : ""));

    infoNL(strb, "Java", System.getProperty("java.version"), System.getProperty("java.vendor"));
    infoNL(strb, "Platform", LWJGLUtil.getPlatformName());
    infoNL(strb, "Graphics card", Display.getAdapter());
    infoNL(strb, "Driver version", Display.getVersion());
    infoNL(strb, "OpenGL driver version", GL11.glGetString(GL11.GL_VERSION));

    infoNL(strb, "GLU version", Registry.gluGetString(GLU.GLU_VERSION));
    infoNL(strb, "GLU extensions", Registry.gluGetString(GLU.GLU_EXTENSIONS));

    ContextCapabilities caps = GLContext.getCapabilities();
    openGLVersions(strb, caps);

    strb.append(NL).append("Capabilities").append(NL);
    TreeMap<String, Boolean> capInfos = new TreeMap<String, Boolean>();
    gatherCapabilities(caps, capInfos);
    infoGroupedCaps(strb, capInfos);

    Display.destroy();

    return strb.toString();
}

From source file:org.meanworks.engine.core.Application.java

License:Open Source License

/**
 * The core application loop/*from   w  w  w  .j ava  2 s.co m*/
 */
public void run() {
    /*
     * Game Loop
     */
    int MAX_FRAMESKIP = 10;
    long last_game_tick = System.currentTimeMillis();
    long next_game_tick = last_game_tick;
    int loops;
    int fpsc = 0;
    int upsc = 0;
    long last_fps = System.currentTimeMillis();

    int SKIP_TICKS = 1000 / targetUps;

    int savedUps = 0;

    /*
     * Parse what version we are using
     */
    String s = GL11.glGetString(GL11.GL_VERSION);
    if (s.startsWith("2")) {
        // We have to use old
        EngineConfig.usingModernOpenGL = false;
    } else if (s.startsWith("3") || s.startsWith("4")) {
        EngineConfig.usingModernOpenGL = true;
    }

    // Create the timer
    // timer = new Timer();

    /*
     * Create the input handler
     */
    guiHandler = new Gui(this);
    /**
     * Add a console to the application
     */
    getGui().addComponent((console = new Console()));

    inputHandler = new Input();
    assetManager = new AssetManager();
    scene = new Scene();

    getInputHandler().addKeyListener(guiHandler);
    getInputHandler().addMouseListener(guiHandler);

    /*
     * Setup the default material
     */
    Material.DEFAULT_MATERIAL = null;

    if (EngineConfig.usingModernOpenGL) {
        Material.DEFAULT_MATERIAL = new Material("DEFAULT_MATERIAL",
                AssetManager.loadShader("./data/shaders/colorShader"));
    } else {
        Material.DEFAULT_MATERIAL = new Material("DEFAULT_MATERIAL",
                AssetManager.loadShader("./data/shaders/150colorShader"));
    }

    /*
     * Set camera details TODO: Cleanup here
     */
    Scene.setCamera(new FirstPersonCamera(Screen.getWidth(), Screen.getHeight(), 60, Screen.getAspect()));

    /*
     * Create our script handler
     */
    scriptHandler = new ScriptHandler();

    /*
     * Preload
     */
    preload();

    /*
     * Start the render/update loop
     */
    while (running) {
        /*
         * Logging
         */
        if (System.currentTimeMillis() - last_fps > 1000) {
            fps = fpsc;
            ups = upsc;
            upsc = 0;
            fpsc = 0;
            last_fps = System.currentTimeMillis();
            PerformanceGraph.tick(1, fps);
        }
        /*
         * Update
         */
        long renderStart = System.nanoTime();
        loops = 0;
        while (System.currentTimeMillis() > next_game_tick && loops < MAX_FRAMESKIP) {

            /*
             * Update the updates per second
             */
            if (savedUps != targetUps) {
                SKIP_TICKS = 1000 / targetUps;
                savedUps = targetUps;
            }

            /*
             * Check if we want to close the window
             */
            if (window.isCloseRequested()) {
                onWindowClose();
            }

            // UPDATE OUR ASSET MANAGER
            assetManager.update();

            // TEMP LWJGL FUNCTIONS
            Display.processMessages();
            // END OF TEMP LWJGL FUNCTIONS

            // Grab input keys
            inputHandler.update();
            // Parse input keys in the gui handler
            guiHandler.update();
            // Parse updates in the application
            update(); // Call the update function
            scene.update();

            //Post update for the gui handler
            guiHandler.postUpdate();

            next_game_tick += SKIP_TICKS;

            loops++;
            upsc++;
        }
        /*
         * Render and also store the time used to render the frame (Useful
         * for analyzing performance)
         */

        /*
         * Clear the statistics for the last frame
         */
        RenderState.clearRenderedVertices();

        // Clear render state for the next render loop
        RenderState.clearState();
        render(); // Call the render function

        // Clear render state for the scene render loop
        RenderState.clearState();
        scene.render();

        // Clear render state for the gui render loop
        RenderState.clearState();

        glDisable(GL_CULL_FACE);
        guiHandler.render();
        glEnable(GL_CULL_FACE);

        fpsc++;

        window.update();

        long renderEnd = System.nanoTime();
        long deltaRender = renderEnd - renderStart;
        frameTime = (double) (deltaRender * Math.pow(10, -9));
    }
}

From source file:org.ode4j.drawstuff.internal.LwJGL.java

License:Open Source License

private static void createMainWindow(int _width, int _height) {
    // create Window of size 300x300
    try {//w w  w .j  a v  a  2  s.c  o m
        Display.setLocation((Display.getDisplayMode().getWidth() - _width) / 2,
                (Display.getDisplayMode().getHeight() - _height) / 2);
    } catch (UnsatisfiedLinkError e) {
        System.err.println("Missing lwjgl native libraries.");
        System.err.println("If you are using maven, make sure to use "
                + "'-Djava.library.path=target/natives' as VM argument of your application.");
        System.err.println("For plain Eclipse, add the native library path to the included "
                + "lwjgl.jar in the definition of the Referenced Libraries.");
        throw e;
    }
    try {
        Display.setDisplayMode(new DisplayMode(_width, _height));
        Display.setTitle("Simulation");
        Display.setVSyncEnabled(true); //for VSync (TZ)
        Display.create();
    } catch (LWJGLException e) {
        throw new RuntimeException(e);
    }

    try {
        Keyboard.create();
        Mouse.create();
    } catch (LWJGLException e) {
        throw new RuntimeException(e);
    }

    if (firsttime) {
        System.err.println("GL_VENDOR:     " + GL11.glGetString(GL11.GL_VENDOR));
        System.err.println("GL_RENDERER:   " + GL11.glGetString(GL11.GL_RENDERER));
        System.err.println("GL_VERSION:    " + GL11.glGetString(GL11.GL_VERSION));
        System.err.println("LWJGL_VERSION: " + Sys.getVersion());
        System.err.println();
        System.err.println("glLoadTransposeMatrixfARB() supported: "
                + GLContext.getCapabilities().GL_ARB_transpose_matrix);
    }

    //   // create X11 display connection
    //  display = XOpenDisplay (null);
    //  if (!display) dsError ("can not open X11 display");
    //  screen = DefaultScreen(display);
    //
    //  // get GL visual
    //  static int attribList[] = {GLX_RGBA, GLX_DOUBLEBUFFER, GLX_DEPTH_SIZE,16,
    //              GLX_RED_SIZE,4, GLX_GREEN_SIZE,4,
    //              GLX_BLUE_SIZE,4, None};
    //  visual = glXChooseVisual (display,screen,attribList);
    //  if (!visual) dsError ("no good X11 visual found for OpenGL");

    // create colormap
    //  colormap = XCreateColormap (display,RootWindow(display,screen),
    //               visual.visual,AllocNone);

    // initialize variables
    //  win = 0;
    width = _width;
    height = _height;
    //  glx_context = 0;
    last_key_pressed = 0;

    if (width < 1 || height < 1)
        dsDebug("", "bad window width or height");

    // create the window
    //  XSetWindowAttributes attributes;
    //  attributes.background_pixel = BlackPixel(display,screen);
    //  attributes.colormap = colormap;
    //  attributes.event_mask = ButtonPressMask | ButtonReleaseMask |
    //    KeyPressMask | KeyReleaseMask | ButtonMotionMask | PointerMotionHintMask |
    //    StructureNotifyMask;
    //  win = XCreateWindow (display,RootWindow(display,screen),50,50,width,height,
    //             0,visual.depth, InputOutput,visual.visual,
    //             CWBackPixel | CWColormap | CWEventMask, attributes);

    // associate a GLX context with the window
    //  glx_context = glXCreateContext (display,visual,0,GL_TRUE);
    //  if (!glx_context) dsError ("can't make an OpenGL context");

    // set the window title
    //  XTextProperty window_name;
    //  window_name.value = "Simulation";//(unsigned char *) "Simulation";
    //  window_name.encoding = XA_STRING;
    //  window_name.format = 8;
    //  window_name.nitems = window_name.value.length;//strlen((char *) window_name.value);
    //  XSetWMName (display,win,window_name);

    // participate in the window manager 'delete yourself' protocol
    //  wm_protocols_atom = XInternAtom (display,"WM_PROTOCOLS",False);
    //  wm_delete_window_atom = XInternAtom (display,"WM_DELETE_WINDOW",False);
    //  if (XSetWMProtocols (display,win,wm_delete_window_atom,1)==0)
    //    dsError ("XSetWMProtocols() call failed");

    // pop up the window
    //  XMapWindow (display,win);
    //  XSync (display,win);
}

From source file:org.oscim.gdx.LwjglGL20.java

License:Apache License

public String getString(int name) {
    return GL11.glGetString(name);
}

From source file:org.spout.engine.SpoutClient.java

License:Open Source License

public void initRenderer() {
    createWindow();/*from  ww  w.j av a2 s .com*/

    //Mouse.setGrabbed(true);

    getLogger().info("SpoutClient Information");
    getLogger().info("Operating System: " + System.getProperty("os.name"));
    getLogger().info("Renderer Mode: " + this.getRenderMode().toString());
    getLogger().info("OpenGL Information");
    getLogger().info("Vendor: " + GL11.glGetString(GL11.GL_VENDOR));
    getLogger().info("OpenGL Version: " + GL11.glGetString(GL11.GL_VERSION));
    getLogger().info("GLSL Version: " + GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION));
    getLogger().info("Max Textures: " + GL11.glGetString(GL20.GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS));
    String extensions = "Extensions Supported: ";
    if (getArguments().renderMode == RenderMode.GL30) {
        for (int i = 0; i < GL11.glGetInteger(GL30.GL_NUM_EXTENSIONS); i++) {
            extensions += GL30.glGetStringi(GL11.GL_EXTENSIONS, i) + " ";
        }
    } else {
        extensions += GL11.glGetString(GL11.GL_EXTENSIONS);
    }
    getLogger().info(extensions);
    soundManager.init();
    Spout.getFilesystem().postStartup();

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glClearColor((135.f / 255.0f), 206.f / 255.f, 250.f / 255.f, 0);

    worldRenderer = new WorldRenderer(this);
    worldRenderer.setup();

    renderer = new PrimitiveBatch();
    mat = (RenderMaterial) this.getFilesystem()
            .getResource("material://Spout/resources/resources/materials/BasicMaterial.smt");
    renderer.begin();
    renderer.addCube(new Vector3(-0.5, -0.5, -0.5), Vector3.ONE, Color.RED, sides);
    renderer.end();

    gui = new SpriteBatch();
}

From source file:org.spout.engine.SpoutRenderer.java

License:Open Source License

public void initRenderer(Canvas parent) {
    createWindow(parent);/*from   ww w . j  a  v a2s  . c  om*/

    if (Spout.debugMode()) {
        client.getLogger().info("SpoutClient Information");
        client.getLogger().info("Operating System: " + System.getProperty("os.name"));
        client.getLogger().info("Renderer Mode: " + client.getRenderMode().toString());
        client.getLogger().info("GL21: " + GLContext.getCapabilities().OpenGL21 + " GL32: "
                + GLContext.getCapabilities().OpenGL32);
        client.getLogger().info("Resolution: " + Display.getWidth() + "x" + Display.getHeight());
        client.getLogger().info("OpenGL Information");
        client.getLogger().info("Vendor: " + GL11.glGetString(GL11.GL_VENDOR));
        client.getLogger().info("OpenGL Version: " + GL11.glGetString(GL11.GL_VERSION));
        client.getLogger().info("GLSL Version: " + GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION));
        client.getLogger().info("Max Textures: " + GL11.glGetInteger(GL20.GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS));
        String extensions = "Extensions Supported: ";
        if (client.getRenderMode() == RenderMode.GL30 || client.getRenderMode() == RenderMode.GL40) {
            for (int i = 0; i < GL11.glGetInteger(GL30.GL_NUM_EXTENSIONS); i++) {
                extensions += GL30.glGetStringi(GL11.GL_EXTENSIONS, i) + " ";
            }
        } else {
            extensions += GL11.glGetString(GL11.GL_EXTENSIONS);
        }
        client.getLogger().info(extensions);
    }

    SpoutRenderer.checkGLError();
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glFrontFace(GL11.GL_CW);
    GL11.glCullFace(GL11.GL_BACK);
    SpoutRenderer.checkGLError();

    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glClearColor((135.f / 255.0f), 206.f / 255.f, 250.f / 255.f, 1);
    SpoutRenderer.checkGLError();

    //Init pool of BatchVertexRenderer
    BatchVertexRenderer.initPool(GL11.GL_TRIANGLES, 500);

    if (useReflexion) {
        reflected = new ClientRenderTexture(true, false, true);
        reflected.writeGPU();
        // Test
        reflectedDebugBatch = new SpriteBatch();
        Shader s1 = client.getFileSystem().getResource("shader://Spout/shaders/diffuse.ssf");
        HashMap<String, Object> map1 = new HashMap<>();
        map1.put("Diffuse", reflected);
        reflectedDebugMat = new ClientRenderMaterial(s1, map1);
        RenderPart screenPart1 = new RenderPart();
        screenPart1.setSprite(new Rectangle(-1, -1, 0.5f, 0.5f));
        screenPart1.setSource(new Rectangle(0, 1, 1, -1));
        RenderPartPack pack1 = new RenderPartPack(reflectedDebugMat);
        pack1.add(screenPart1);
        reflectedDebugBatch.flush(pack1);
        // Test end
    }

    screenBatcher = new SpriteBatch();
    t = new ClientRenderTexture(true, false, true);
    t.writeGPU();
    Shader s = client.getFileSystem().getResource("shader://Spout/shaders/diffuse.ssf");
    HashMap<String, Object> map = new HashMap<>();
    map.put("Diffuse", t);
    mat = new ClientRenderMaterial(s, map);
    RenderPart screenPart = new RenderPart();
    screenPart.setSprite(new Rectangle(-1, -1, 2, 2));
    screenPart.setSource(new Rectangle(0, 1, 1, -1));
    RenderPartPack pack = new RenderPartPack(mat);
    pack.add(screenPart);
    screenBatcher.flush(pack);
}

From source file:org.spout.reactsandbox.Sandbox.java

License:Open Source License

private static void startupLog() {
    System.out.println("Starting up");
    System.out.println("Render Mode: " + glVersion);
    System.out.println("OpenGL Version: " + GL11.glGetString(GL11.GL_VERSION));
}

From source file:org.spoutcraft.client.config.Configuration.java

License:Open Source License

public static boolean isOpenGL(int v) {
    try {/*from w  ww .j a va 2 s  .  co  m*/
        String version = GL11.glGetString(GL11.GL_VERSION);
        return Integer.parseInt(String.valueOf(version.charAt(0))) >= v;
    } catch (Exception e) {
        return false;
    }
}