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:jpcsp.graphics.RE.RenderingEngineLwjgl.java

License:Open Source License

protected void init() {
    String openGLVersion = GL11.glGetString(GL11.GL_VERSION);
    String openGLVendor = GL11.glGetString(GL11.GL_VENDOR);
    String openGLRenderer = GL11.glGetString(GL11.GL_RENDERER);
    log.info(String.format("OpenGL version: %s, vender: %s, renderer: %s", openGLVersion, openGLVendor,
            openGLRenderer));// w  w  w  . ja v  a  2s. c o m

    vendorIntel = "Intel".equalsIgnoreCase(openGLVendor);
    hasOpenGL30 = GLContext.getCapabilities().OpenGL30;

    if (GLContext.getCapabilities().OpenGL20) {
        String shadingLanguageVersion = GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION);
        log.info("Shading Language version: " + shadingLanguageVersion);
    }

    if (GLContext.getCapabilities().OpenGL30) {
        int contextFlags = GL11.glGetInteger(GL30.GL_CONTEXT_FLAGS);
        String s = String.format("GL_CONTEXT_FLAGS: 0x%X", contextFlags);
        if ((contextFlags & GL30.GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT) != 0) {
            s += " (GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)";
        }
        log.info(s);
    }

    if (GLContext.getCapabilities().OpenGL32) {
        int contextProfileMask = GL11.glGetInteger(GL32.GL_CONTEXT_PROFILE_MASK);
        String s = String.format("GL_CONTEXT_PROFILE_MASK: 0x%X", contextProfileMask);
        if ((contextProfileMask & GL32.GL_CONTEXT_CORE_PROFILE_BIT) != 0) {
            s += " (GL_CONTEXT_CORE_PROFILE_BIT)";
        }
        if ((contextProfileMask & GL32.GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) != 0) {
            s += " (GL_CONTEXT_COMPATIBILITY_PROFILE_BIT)";
        }
        log.info(s);
    }
}

From source file:jpcsp.graphics.RE.RenderingEngineLwjgl.java

License:Open Source License

@Override
public boolean isExtensionAvailable(String name) {
    String extensions = GL11.glGetString(GL11.GL_EXTENSIONS);
    if (extensions == null) {
        return false;
    }// ww w .j  a v  a2 s.co  m

    // Extensions are space separated
    return (" " + extensions + " ").indexOf(" " + name + " ") >= 0;
}

From source file:jpcsp.graphics.RE.RenderingEngineLwjgl.java

License:Open Source License

@Override
public String getShadingLanguageVersion() {
    if (GLContext.getCapabilities().OpenGL20) {
        return GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION);
    }//from w  w w . ja v a2 s .  co m

    return null;
}

From source file:kuake2.render.lwjgl.Main.java

License:Open Source License

/**
 * R_Init2/*w w  w . j  a  va 2  s.  c  o  m*/
 */
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:lessur.util.shader.ShaderManager.java

License:GNU General Public License

/**
 * Get's the OpenGL version//  ww w  . ja  v  a 2s . c o  m
 * @return A list with the GL version numbers. I.e. [2, 1, 0]
 */
public int getGLVersion() {
    return Integer.parseInt(Character.toString(GL11.glGetString(GL11.GL_VERSION).charAt(0)));
}

From source file:net.lyonlancer5.mcmp.karasu.client.gui.GuiOverlayDebug.java

License:Apache License

protected List<String> getDebugInfoRight() {
    long i = Runtime.getRuntime().maxMemory();
    long j = Runtime.getRuntime().totalMemory();
    long k = Runtime.getRuntime().freeMemory();
    long l = j - k;
    List<String> list = Lists.newArrayList(new String[] {
            String.format("Java: %s %dbit",
                    new Object[] { System.getProperty("java.version"),
                            Integer.valueOf(this.mc.isJava64bit() ? 64 : 32) }),
            String.format("Mem: % 2d%% %03d/%03dMB",
                    new Object[] { Long.valueOf(l * 100L / i), Long.valueOf(bytesToMb(l)),
                            Long.valueOf(bytesToMb(i)) }),
            String.format("Allocated: % 2d%% %03dMB",
                    new Object[] { Long.valueOf(j * 100L / i), Long.valueOf(bytesToMb(j)) }),
            "", String.format("CPU: %s", new Object[] { getCpu() }), "",
            String.format("Display: %dx%d (%s)",
                    new Object[] { Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()),
                            GL11.glGetString(GL11.GL_VENDOR) }),
            GL11.glGetString(GL11.GL_RENDERER), GL11.glGetString(GL11.GL_VERSION) });

    list.add("");

    //Compute start
    List<String> lst = Lists.newArrayList(FMLCommonHandler.instance().getBrandings(false));
    List<String> lst2 = lst.subList(0, lst.size() - 1);
    lst2.add("Project Karasu v" + Constants.VERSION);
    List<String> lst3 = lst.subList(lst.size() - 1, lst.size());
    lst2.addAll(lst3);/*from   ww w .j  av  a2 s  . c  om*/
    //Compute end

    list.addAll(lst2);

    if (this.isReducedDebug()) {
        return list;
    } else {
        if (this.mc.objectMouseOver != null
                && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
            BlockPos blockpos = new BlockPos(this.mc.objectMouseOver);
            BlockData state = WorldUtils.getBlockState(this.mc.theWorld, blockpos);

            list.add("");
            list.add(String.valueOf(Block.blockRegistry.getNameForObject(state.getBlock())));
            list.add("Metadata: " + String.valueOf(state.getMetadata()));

            if (state.getBlock() instanceof IBlockMetadata.Implementor) {
                IBlockMetadata.Implementor type = (IBlockMetadata.Implementor) state.getBlock();
                list.add("Variant: " + type.getMetaInfo(state.getMetadata()).getName());
            }
            //for (Entry<IProperty, Comparable> entry : iblockstate.getProperties().entrySet())
            //{
            //    String s = ((Comparable)entry.getValue()).toString();
            //    if (entry.getValue() == Boolean.TRUE)
            //    {
            //        s = EnumChatFormatting.GREEN + s;
            //    }
            //    else if (entry.getValue() == Boolean.FALSE)
            //    {
            //        s = EnumChatFormatting.RED + s;
            //    }
            //
            //    list.add(((IProperty)entry.getKey()).getName() + ": " + s);
            //}
        }

        return list;
    }
}

From source file:net.smert.frameworkgl.opengl.OpenGL1.java

License:Apache License

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

From source file:openglengine.OpenGLengine.java

public static void versionGL() {
    try {/*from w  w w.j a  v  a 2  s  . c om*/
        Display.create();
        System.out.println("Your OpenGL version is " + GL11.glGetString(GL11.GL_VERSION));
        Display.destroy();
    } catch (LWJGLException ex) {
        Logger.getLogger(OpenGLengine.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:org.evilco.emulator.ui.crash.collector.OpenGLInformationCollector.java

License:Apache License

/**
 * {@inheritDoc}/*from w  w w  . ja v a  2s . c  o m*/
 */
@Override
public String collect(ICrashReport crashReport) {
    try {
        return (GL11.glGetString(GL11.GL_RENDERER) + " version " + GL11.glGetString(GL11.GL_VERSION)
                + " provided by " + GL11.glGetString(GL11.GL_VENDOR));
    } catch (Exception ignore) {
        return null;
    }
}

From source file:org.fenggui.binding.render.lwjgl.LWJGLOpenGL.java

License:Open Source License

public String getString(Attribute attrib) {
    int pname = getAttrib(attrib);
    return GL11.glGetString(pname);
}