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.spoutcraft.client.gui.error.GuiUnexpectedError.java

License:Open Source License

private void generateHastie() {
    if (generated) {
        hastebinLink.setText("Error Link: " + ChatColor.GREEN + hastebinURL);
        return;/*from w  ww .j a v  a 2  s.  c  om*/
    }
    try {
        StringBuilder builder = new StringBuilder("Spoutcraft Error Report:\n");
        builder.append("    Build: ").append(SpoutClient.getClientVersion()).append("\n");
        builder.append("-----------------------------------").append("\n");
        builder.append("Stack Trace:").append("\n");
        builder.append("    Exception: ").append(caused.getClass().getSimpleName()).append("\n");
        builder.append("    Message: ").append(caused.getMessage()).append("\n");
        builder.append("    Trace:").append("\n");

        StringWriter sw = new StringWriter();
        caused.printStackTrace(new PrintWriter(sw));
        String causeString = sw.toString();
        builder.append("       ").append(sw).append("\n");

        builder.append("-----------------------------------").append("\n");
        builder.append("Minecraft Information:\n");
        builder.append("    Texture Pack: ").append(
                Minecraft.theMinecraft.texturePackList.getSelectedTexturePack().getTexturePackFileName())
                .append("\n");
        //builder.append("    Texture Pack Res: ").append(TileSize.int_size + "x").append("\n");
        builder.append("    LWJGL Version: ").append(Sys.getVersion()).append("\n");

        builder.append("System Information:\n");
        builder.append("    Operating System: ").append(System.getProperty("os.name")).append("\n");
        builder.append("    Operating System Version: ").append(System.getProperty("os.version")).append("\n");
        builder.append("    Operating System Architecture: ").append(System.getProperty("os.arch"))
                .append("\n");
        builder.append("    Java version: ").append(System.getProperty("java.version")).append(" ")
                .append(System.getProperty("sun.arch.data.model", "32")).append(" bit").append("\n");
        builder.append("    Total Memory: ").append(Runtime.getRuntime().totalMemory() / 1024L / 1024L)
                .append(" MB\n");
        builder.append("    Max Memory: ").append(Runtime.getRuntime().maxMemory() / 1024L / 1024L)
                .append(" MB\n");
        builder.append("    Memory Free: ").append(Runtime.getRuntime().freeMemory() / 1024L / 1024L)
                .append(" MB\n");
        builder.append("    CPU Cores: ").append(Runtime.getRuntime().availableProcessors()).append("\n");
        builder.append("    OpenGL Version: ").append(GL11.glGetString(GL11.GL_VERSION)).append("\n");
        builder.append("    OpenGL Vendor: ").append(GL11.glGetString(GL11.GL_VENDOR)).append("\n");
        String message = builder.toString();

        PasteBinAPI pastebin = new PasteBinAPI("963f01dd506cb3f607a487bc34b60d16");
        String response = pastebin.makePaste(message, "ser_" + System.currentTimeMillis(), "text");
        System.out.println("pastebin response: " + response);
        if (!response.startsWith("http://pastebin.com")) {
            URL url = new URL("http://www.hastebin.com/documents");
            URLConnection conn = url.openConnection();
            conn.setDoOutput(true);
            OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
            wr.write(builder.toString());
            wr.flush();

            BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            String line = rd.readLine();
            hastebinURL = "hastebin.com/" + line.substring(8, line.length() - 2); // Get rid of the JSON stuff
            wr.close();
            rd.close();
        } else {
            hastebinURL = response;
        }
        hastebinLink.setText("Error: " + ChatColor.GREEN + hastebinURL);
        generated = true;
    } catch (Exception e) {
        hastebinLink.setText("Connection error!");
    }
}

From source file:org.terasology.logic.manager.ShaderManager.java

License:Apache License

private ShaderManager() {
    logger.info("Loading Terasology shader manager...");
    logger.info("GL_VERSION: {}", GL11.glGetString(GL11.GL_VERSION));
    logger.info("SHADING_LANGUAGE VERSION: {}", GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION));
    logger.info("EXTENSIONS: {}", GL11.glGetString(GL11.GL_EXTENSIONS));

    initShaders();//from  w  w w.jav a 2s.c  o  m
}

From source file:org.terasology.rendering.ShaderManager.java

License:Apache License

public ShaderManager() {
    logger.info("Loading Terasology shader manager...");
    logger.info("GL_VERSION: {}", GL11.glGetString(GL11.GL_VERSION));
    logger.info("SHADING_LANGUAGE VERSION: {}", GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION));
    logger.info("EXTENSIONS: {}", GL11.glGetString(GL11.GL_EXTENSIONS));
}

From source file:org.terasology.rendering.ShaderManagerLwjgl.java

License:Apache License

public ShaderManagerLwjgl() {
    logger.info("Loading Terasology shader manager...");
    logger.info("LWJGL: {} / {}", Sys.getVersion(), LWJGLUtil.getPlatformName());
    logger.info("GL_VENDOR: {}", GL11.glGetString(GL11.GL_VENDOR));
    logger.info("GL_RENDERER: {}", GL11.glGetString(GL11.GL_RENDERER));
    logger.info("GL_VERSION: {}", GL11.glGetString(GL11.GL_VERSION));
    logger.info("SHADING_LANGUAGE VERSION: {}", GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION));

    String extStr = GL11.glGetString(GL11.GL_EXTENSIONS);

    // log shader extensions in smaller packages, 
    // because the full string can be extremely long 
    int extsPerLine = 8;

    // starting with OpenGL 3.0, extensions can also listed using
    // GL_NUM_EXTENSIONS and glGetStringi(GL_EXTENSIONS, idx)
    String[] exts = extStr.split(" ");
    if (exts.length > 0) {
        StringBuilder bldr = new StringBuilder(exts[0]);
        for (int i = 1; i < exts.length; i++) {
            if (i % extsPerLine == 0) {
                logger.info("EXTENSIONS: {}", bldr.toString());
                bldr.setLength(0);/*from   w ww .  j  a v  a 2  s. c  o  m*/
            } else {
                bldr.append(" ");
            }
            bldr.append(exts[i]);
        }
        if (bldr.length() > 0) {
            logger.info("EXTENSIONS: {}", bldr.toString());
        }
    }
}

From source file:org.terasology.telemetry.metrics.SystemContextMetric.java

License:Apache License

public SystemContextMetric(Context context) {
    bindingMap = context.get(Config.class).getTelemetryConfig().getMetricsUserPermissionConfig()
            .getBindingMap();//  w w  w.  j  av a2 s  .c o m

    osName = System.getProperty("os.name");
    osVersion = System.getProperty("os.version");
    osArchitecture = System.getProperty("os.arch");
    javaVendor = System.getProperty("java.vendor");
    javaVersion = System.getProperty("java.version");
    jvmName = System.getProperty("java.vm.name");
    jvmVersion = System.getProperty("java.vm.version");
    contextInCoreRegistry = CoreRegistry.get(Context.class);
    DisplayDevice display = contextInCoreRegistry.get(DisplayDevice.class);
    if (!display.isHeadless()) {
        openGLVendor = GL11.glGetString(GL11.GL_VENDOR);
        openGLVersion = GL11.glGetString(GL11.GL_VERSION);
        openGLRenderer = GL11.glGetString(GL11.GL_RENDERER);
    } else {
        openGLVendor = "headless";
        openGLVersion = "headless";
        openGLRenderer = "headless";
    }
    processorNumbers = Runtime.getRuntime().availableProcessors();
    memoryMaxByte = Runtime.getRuntime().maxMemory();
}

From source file:processing.opengl.PLWJGL.java

License:Open Source License

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

From source file:ru.axialshift.display.GLInitializer.java

License:Apache License

public void set32GLDisplay(int width, int height) {
    System.out.println("Attempting to init GL3.2 LWJGL Display...");
    try {/*from  www.j  a  v a  2s  .c  om*/
        Display.setDisplayMode(new DisplayMode(width, height));
        Display.setTitle("AxialShift Rendering Engine");
        Display.create(pixelFormat, contextAttributes);
    } catch (LWJGLException e) {
        System.out.println("...Failure!");
        e.printStackTrace();
        System.exit(-1);
    }
    System.out.println("...Success!");
    System.out.println("OpenGL version: " + GL11.glGetString(GL11.GL_VERSION));
}

From source file:tectonicus.rasteriser.lwjgl.LwjglRasteriser.java

License:BSD License

@Override
public void printInfo() {
    System.out.println(" -- Lwjgl Rasteriser -- ");
    System.out.println("\tLWJGL version: " + Sys.getVersion());
    System.out.println("\ttype: " + type);
    System.out.println("\twidth: " + width);
    System.out.println("\theigth: " + height);
    System.out.println("\tpBuffer: " + pbuffer);

    System.out.println("\tOpenGL Vendor: " + GL11.glGetString(GL11.GL_VENDOR));
    System.out.println("\tOpenGL Renderer: " + GL11.glGetString(GL11.GL_RENDERER));
    System.out.println("\tOpenGL Version: " + GL11.glGetString(GL11.GL_VERSION));

    //   System.out.println();

    //   GL11.glGetString(GL11.GL_EXTENSIONS);
}

From source file:thebounzer.org.lwgldemo.OglBook.java

License:Open Source License

private void printOpenglInfo() {
    StringBuffer info = new StringBuffer();
    String newline = "\n";
    info.append(GL11.glGetString(GL11.GL_VERSION).concat(newline));
    info.append(GL11.glGetString(GL11.GL_VENDOR).concat(newline));
    info.append(GL11.glGetString(GL11.GL_RENDERER).concat(newline));
    //int extensions = GL11.glGetInteger(GL30.GL_NUM_EXTENSIONS);
    //info.append(getSupportedExtensions(extensions));
    logger.log(Level.INFO, "OpenGL version info: {0}", info);
}

From source file:tk.ivybits.engine.gl.GL.java

License:Open Source License

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