Example usage for org.lwjgl.opengl GL11 GL_VENDOR

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

Introduction

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

Prototype

int GL_VENDOR

To view the source code for org.lwjgl.opengl GL11 GL_VENDOR.

Click Source Link

Document

StringName

Usage

From source file:io.flob.clicker.DisplayDriver.java

License:Open Source License

public DisplayDriver() throws Exception {
    init_display();/* www.j  av  a  2 s .c o m*/
    init_GL();
    System.out.println("GL_VENDOR: " + GL11.glGetString(GL11.GL_VENDOR));
    System.out.println("GL_RENDERER: " + GL11.glGetString(GL11.GL_RENDERER));
    System.out.println("GL_VERSION: " + GL11.glGetString(GL11.GL_VERSION));
    System.out.println("#####################################");
}

From source file:ivorius.ivtoolkit.rendering.IvShaderInstance.java

License:Apache License

public static void outputShaderInfo(Logger logger) {
    String renderer = GL11.glGetString(GL11.GL_RENDERER);
    String vendor = GL11.glGetString(GL11.GL_VENDOR);
    String version = GL11.glGetString(GL11.GL_VERSION);
    boolean fboSupported = OpenGlHelper.framebufferSupported;

    String majorVersion;/*from   www  .j a  v  a 2 s.c o m*/
    String minorVersion;

    String glslVersion;

    try {
        glslVersion = GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION);
    } catch (Exception ex) {
        glslVersion = "? (No GL20)";
    }

    try {
        minorVersion = "" + GL11.glGetInteger(GL30.GL_MINOR_VERSION);
        majorVersion = "" + GL11.glGetInteger(GL30.GL_MAJOR_VERSION);
    } catch (Exception ex) {
        minorVersion = "?";
        majorVersion = "? (No GL 30)";
    }

    printAlignedInfo("Vendor", vendor, logger);
    printAlignedInfo("Renderer", renderer, logger);
    printAlignedInfo("Version", version, logger);
    printAlignedInfo("Versions", getGLVersions(GLContext.getCapabilities()), logger);
    printAlignedInfo("Version Range", String.format("%s - %s", minorVersion, majorVersion), logger);
    printAlignedInfo("GLSL Version", glslVersion, logger);
    printAlignedInfo("Frame buffer object", fboSupported ? "Supported" : "Unsupported", logger);
}

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  .j  a  va 2  s  . co 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:kuake2.render.lwjgl.Main.java

License:Open Source License

/**
 * R_Init2/*from  w w  w.  ja va2s.  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: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);/* w  ww  . j  a v a 2 s . com*/
    //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:org.evilco.emulator.ui.crash.collector.OpenGLInformationCollector.java

License:Apache License

/**
 * {@inheritDoc}// w w w.  ja  v  a2s.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.free.jake2.render.lwjgl.Main.java

License:Open Source License

/**
 * R_Init2//from  w ww. j av a2  s  .  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.fusfoundation.kranion.Main.java

License:Open Source License

public void create() throws LWJGLException {

    model = new Model();

    controller = new DefaultController();
    controller.setModel(model);//from w  ww  .  j  a v a  2s  .  c  om

    view = new DefaultView();

    view.setModel(model);
    view.setPropertyPrefix("Model.Attribute");
    view.setController(controller);
    view.setTag("DefaultView");

    controller.setView(view);

    //Display
    DisplayMode[] modes = Display.getAvailableDisplayModes();

    DisplayMode chosenMode = null;
    int maxDisplayWidth = 0;
    for (int i = 0; i < modes.length; i++) {
        DisplayMode current = modes[i];
        System.out.println(current.getWidth() + "x" + current.getHeight() + "x" + current.getBitsPerPixel()
                + " " + current.getFrequency() + "Hz");
        if (current.getBitsPerPixel() == 32 && current.getWidth() == 2560 && current.getHeight() == 1440
                && current.getFrequency() == 60) {
            chosenMode = current;
        } else if (current.getBitsPerPixel() == 32 && current.getFrequency() >= 60) {
            if (current.getWidth() > maxDisplayWidth) {
                maxDisplayWidth = current.getWidth();
                chosenMode = current;
                if (maxDisplayWidth >= DISPLAY_WIDTH) {
                    break;
                }
            }
        }
    }
    DisplayMode mode = null;

    if (chosenMode == null) {
        mode = new DisplayMode(DISPLAY_WIDTH, DISPLAY_HEIGHT);
    } else {
        mode = chosenMode;
    }

    //        mode = chosenMode;
    System.out.println("Display: " + mode.getBitsPerPixel() + " bpp");
    Display.setDisplayMode(mode);
    //        Display.setFullscreen(true);
    System.out.println("Display: mode set");
    Display.setResizable(true);
    Display.setTitle("Kranion");

    System.out.println("Setting pixel format...");
    PixelFormat pixelFormat = new PixelFormat(24, 8, 24, 8, 1);
    org.lwjgl.opengl.ContextAttribs contextAtribs = new ContextAttribs(2, 1);
    contextAtribs.withForwardCompatible(true);

    try {
        ByteBuffer[] list = new ByteBuffer[3];
        InputStream rstm = this.getClass().getResourceAsStream("/org/fusfoundation/kranion/images/icon32.png");
        BufferedImage img = ImageIO.read(rstm);
        list[0] = this.convertToByteBuffer(img);
        rstm = this.getClass().getResourceAsStream("/org/fusfoundation/kranion/images/icon64.png");
        img = ImageIO.read(rstm);
        list[1] = this.convertToByteBuffer(img);
        rstm = this.getClass().getResourceAsStream("/org/fusfoundation/kranion/images/icon256.png");
        img = ImageIO.read(rstm);
        list[2] = this.convertToByteBuffer(img);
        Display.setIcon(list);
    } catch (Exception e) {
        System.out.println("Failed to set window icon.");
    }

    System.out.println("Creating display...");
    Display.create(pixelFormat, contextAtribs);
    //Display.create();

    System.out.println("GL Vendor: " + org.lwjgl.opengl.GL11.glGetString(org.lwjgl.opengl.GL11.GL_VENDOR));
    System.out.println("GL Version: " + org.lwjgl.opengl.GL11.glGetString(org.lwjgl.opengl.GL11.GL_VERSION));
    System.out.println("GLSL Language Version: "
            + org.lwjgl.opengl.GL11.glGetString(org.lwjgl.opengl.GL20.GL_SHADING_LANGUAGE_VERSION));
    System.out.println("GL Renderer: " + org.lwjgl.opengl.GL11.glGetString(org.lwjgl.opengl.GL11.GL_RENDERER));

    checkGLSupport();

    checkCLSupport();

    //Keyboard
    Keyboard.create();

    //Mouse
    Mouse.setGrabbed(false);
    Mouse.create();

    //OpenGL
    initGL();
    resizeGL();

    view.create();

    // load plugins
    try {
        PluginFinder pluginFinder = new PluginFinder();
        pluginFinder.search("plugins");
        plugins = pluginFinder.getPluginCollection();
        for (int i = 0; i < plugins.size(); i++) {
            plugins.get(i).init(controller);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    resizeGL();
    //        resizeGL();

}

From source file:org.fusfoundation.kranion.Main.java

License:Open Source License

private void checkGLSupport() {
    String vendor = org.lwjgl.opengl.GL11.glGetString(org.lwjgl.opengl.GL11.GL_VENDOR);
    String version = org.lwjgl.opengl.GL11.glGetString(org.lwjgl.opengl.GL11.GL_VERSION);
    int nMaxTexUnits = org.lwjgl.opengl.GL11.glGetInteger(org.lwjgl.opengl.GL20.GL_MAX_TEXTURE_IMAGE_UNITS);
    int nMaxCombinedTexUnits = org.lwjgl.opengl.GL11
            .glGetInteger(org.lwjgl.opengl.GL20.GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS);

    try {// w  w  w  .j a v  a2 s  .  c  om
        float versionVal = 0f;
        System.out.println(
                "  Texture unit count = " + nMaxTexUnits + ", Max combined textures = " + nMaxCombinedTexUnits);
        StringTokenizer tok = new StringTokenizer(version, ". ");
        if (tok.hasMoreElements()) {
            versionVal = Float.parseFloat(tok.nextToken());
        }
        if (tok.hasMoreElements()) {
            versionVal += Float.parseFloat(tok.nextToken()) / 10f;
        }

        Main.OpenGLVersion = versionVal;

        if (versionVal < 4.5f) {
            JOptionPane.showMessageDialog(null,
                    "OpenGL 4.5 or later required.\n\nYou have:\n" + vendor + "\n" + version);
            //            System.exit(1);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

}

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

License:Open Source License

public void start(String title, boolean chooseDisplayMode) throws EngineException {
    try {/*from w  w  w.  j a  v a 2s  .c  om*/
        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);
    }
}