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:com.google.gapid.glviewer.Viewer.java

License:Apache License

@Override
public void init() {
    float[] background = new float[] { .2f, .2f, .2f, 1f };

    LOG.log(FINE, "GL Version:   " + GL11.glGetString(GL11.GL_VERSION));
    LOG.log(FINE, "GLSL Version: " + GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION));

    shaders = Shaders.init();//ww  w.  j  a  v a 2 s. c o  m
    if (renderable != null) {
        renderable.init();
    }

    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glClearColor(background[0], background[1], background[2], background[3]);
    GL11.glPointSize(4);
    GL30.glBindVertexArray(GL30.glGenVertexArrays());
}

From source file:com.opengrave.og.MainThread.java

License:Open Source License

public void createConfig() {
    boolean isSet = config.getBoolean("set", false);
    System.out.println("Running OpenGL : " + GL11.glGetString(GL11.GL_VERSION));

    String glsl = GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION).split(" ")[0];
    System.out.println(glsl + " " + Float.parseFloat(glsl));
    if (Float.parseFloat(glsl) < 1.299f) { // Stupid float accuracy. < 1.30
        System.out.println("This program requires GLSL 1.30 as an absolute minimum");
        System.exit(130);//w  w w.j  a  va  2 s  .c  o m
    }
    if (!isSet) {
        int textures = GL11.glGetInteger(GL20.GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS) - 3;
        System.out.println("Maximum spare textures (minus reserved) : " + textures);
        config.setBoolean("shadows", true);
        if (textures < 4) {
            System.out.println("Setting no point-light shadows");
            config.setInteger("lightCount", 0);
        } else if (textures < 8) {
            System.out.println("Setting 4 point-lights with shadows");
            config.setInteger("lightCount", 4);
        } else if (textures < 16) {
            System.out.println("Setting 8 point-lights with shadows");
            config.setInteger("lightCount", 8);
        } else {
            System.out.println("Setting 16 point-lights with shadows");
            // config.setInteger("lightCount", 16);
            // TODO Create lighting-more
            config.setInteger("lightCount", 8);
        }

        // TODO Check for GL 3.0 and turn off shadows/lightCount if below
        // if (!GLContext.getCapabilities().OpenGL30) {
        // System.out.println("This program does not support OpenGL versions before 3.0. Setting absolute minimum detail");
        // if (!isSet) {
        // // We'll assume the worst.
        // config.setInteger("lightCount", 0);
        // config.setBoolean("shadows", false);
        // }
        // }
        Resources.removeShadersWithLighting();
        config.setBoolean("set", true);
    }
}

From source file:com.pesegato.mermaid.MermaidAppState.java

@Override
protected void initialize(Application app) {
    GuiGlobals.initialize(app);/*from ww  w. j  a v  a  2 s  . c o m*/
    Styles styles = GuiGlobals.getInstance().getStyles();
    Attributes attrs = styles.getSelector(Label.ELEMENT_ID, "prism");
    font1 = app.getAssetManager().loadFont("Interface/Fonts/" + GM.getString("FontA"));
    font1.getPage(0).setFloat("AlphaDiscardThreshold", 0.1f);
    attrs.set("font", font1);
    attrs.set("fontSize", GM.getIntXML("FontA"));

    a = GM.getColorRGBA("ColorA");
    b = GM.getColorRGBA("ColorB");
    c = GM.getColorRGBA("ColorC");

    ((SimpleApplication) app).getRootNode().attachChild(properties);

    matMermaid = new Material(app.getAssetManager(), "Common/MatDefs/Light/Lighting.j3md");
    matMermaid.setBoolean("UseMaterialColors", true);
    matMermaid.setColor("Diffuse", ColorRGBA.White.clone());
    matMermaid.setColor("Ambient", ColorRGBA.White.clone());
    matDebug = new Material(app.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
    matDebug.setColor("Color", new ColorRGBA(1, 0, 0, 0.17f));
    matDebug.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Alpha);

    String oglVersion = GL11.glGetString(GL11.GL_VERSION);

    int split = oglVersion.indexOf(' ');
    if (split >= 0) {
        oglVersion = oglVersion.substring(0, split);
    }
    String glslVersion = GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION);

    split = glslVersion.indexOf(' ');
    if (split >= 0) {
        glslVersion = glslVersion.substring(0, split);
    }
    miscSettings = new PPropertyPanel(LEMURSTYLE);
    miscSettings.attachChild(new PLabel(GL11.glGetString(GL11.GL_RENDERER), 0, -.5f));
    miscSettings.attachChild(new PLabel("Ver. " + Display.getVersion(), 0, -1));
    miscSettings.attachChild(new PLabel("OpenGL " + oglVersion + " GLSL " + glslVersion, 0, -1.5f));
    miscSettings.attachChild(
            new PLabel(System.getProperty("os.name") + " ver." + System.getProperty("os.version"), 0, -2));
    miscSettings.attachChild(new PLabel(
            "Java " + System.getProperty("java.version") + " " + System.getProperty("os.arch"), 0, -2.5f));
    miscSettings.attachChild(new PLabel("Jme " + JmeVersion.FULL_NAME.substring(14), 0, -3));
    miscSettings.attachChild(
            new PLabel("hash " + JmeVersion.GIT_SHORT_HASH + " " + JmeVersion.BUILD_DATE, 0, -3.5f));

}

From source file:com.runescape.client.revised.client.lwjgl.RenderUtilities.java

License:Open Source License

public static String getOpenGLVersion() {
    return GL11.glGetString(GL11.GL_VERSION);
}

From source file:com.surgeplay.visage.slave.VisageSlave.java

License:Open Source License

@Override
public void run() {
    System.setProperty("org.lwjgl.opengl.Display.allowSoftwareOpenGL",
            Boolean.toString(config.getBoolean("allowSoftware")));
    System.setProperty("org.lwjgl.opengl.Display.noinput", "true");
    try {/*from   w  w w  .ja  v  a  2  s  .  c  o m*/
        Visage.log.info("Setting up LWJGL");
        Pbuffer test = new Pbuffer(16, 16, new PixelFormat(8, 8, 0), null, null, new ContextAttribs(1, 2));
        test.makeCurrent();
        if (!GLContext.getCapabilities().GL_ARB_vertex_buffer_object) {
            Visage.log.severe(
                    "Your graphics driver does not support ARB_vertex_buffer_object. The slave cannot continue.");
            test.destroy();
            return;
        }
        String glV = GL11.glGetString(GL11.GL_VERSION);
        String os = System.getProperty("os.name");
        Visage.log.info("OpenGL " + glV + " on " + os);
        if (os.contains("Win")) {
            Visage.log.severe("Visage does not support Windows. Continue at your own peril!");
        }
        if (!glV.contains("Mesa")) {
            Visage.log.warning("You are using an unsupported graphics driver.");
        }
        if (os.equals("Linux") && glV.contains("Mesa")) {
            Visage.log.fine("Visage fully supports your OS and graphics driver.");
        }
        test.destroy();
        factory = new ConnectionFactory();
        factory.setHost(config.getString("rabbitmq.host"));
        factory.setPort(config.getInt("rabbitmq.port"));
        factory.setRequestedHeartbeat(10);
        if (config.hasPath("rabbitmq.user")) {
            if (Visage.debug)
                Visage.log.finer("Using authentication");
            factory.setUsername(config.getString("rabbitmq.user"));
            factory.setPassword(config.getString("rabbitmq.password"));
        }
        reconnect();

        Visage.log.info("Setting up " + config.getInt("renderers") + " render threads");
        for (int i = 0; i < config.getInt("renderers"); i++) {
            RenderThread rt = new RenderThread(this);
            threads.add(rt);
            rt.start();
        }

        QueueingConsumer consumer = new QueueingConsumer(channel);
        Map<String, Object> args = Maps.newHashMap();
        args.put("x-priority", config.getInt("weight"));
        channel.basicConsume(queue, false, args, consumer);
        Visage.log.info("Listening for jobs");
        try {
            while (run) {
                try {
                    Delivery delivery = consumer.nextDelivery();
                    if (Visage.debug)
                        Visage.log.finer("Received job, passing on to render thread");
                    RenderThread thread = threads.get(idx);
                    thread.process(delivery);
                    idx++;
                    if (idx >= threads.size()) {
                        idx = 0;
                    }
                } catch (ShutdownSignalException e) {
                    try {
                        conn.close();
                    } catch (Exception ex) {
                    }
                    reconnect();
                } catch (InterruptedException e) {
                    break;
                }
            }
        } catch (Exception e) {
            Visage.log.log(Level.SEVERE, "A fatal error has occurred in the slave run loop.", e);
        }
        try {
            Visage.log.info("Shutting down slave");
            for (RenderThread rt : threads) {
                rt.finish();
            }
            conn.close(5000);
        } catch (Exception e) {
            Visage.log.log(Level.SEVERE, "A fatal error has occurred while shutting down the slave.", e);
        }
    } catch (Exception e) {
        Visage.log.log(Level.SEVERE, "A fatal error has occurred while setting up the slave.", e);
    }
}

From source file:com.timvisee.voxeltex.engine.render.VoxelTexRenderer.java

License:Open Source License

/**
 * Initialize the renderer.//from  ww  w .  ja v  a 2s.  c  o m
 */
public void init() {
    // Show a status message
    System.out.println("Initializing " + VoxelTex.ENGINE_NAME + " renderer...");

    // Create and configure the error callback, make sure it was created successfully
    glfwSetErrorCallback(errorCallback = GLFWErrorCallback.createPrint(System.err));
    if (glfwInit() != GL11.GL_TRUE)
        throw new IllegalStateException("Unable to initialize GLFW");

    // Set the default window hints
    this.window.glDefaultWindowHints();

    // Set the visibility and resizability of the window
    this.window.setHintVisible(false);
    this.window.setHintResizable(true);

    // Create the window
    this.window.glCreateWindow();

    // Initialize the input manager for this window
    Input.init(this.window);

    // Create the framebuffer size callback
    glfwSetFramebufferSizeCallback(this.window.getWindowId(), fbCallback = new GLFWFramebufferSizeCallback() {
        @Override
        public void invoke(long windowId, int width, int height) {
            // Update the window size
            if (width > 0 && height > 0)
                window.setSize(width, height);
        }
    });

    // Center the window
    this.window.centerWindow();

    // Create an int buffer for the window
    IntBuffer framebufferSize = BufferUtils.createIntBuffer(2);
    nglfwGetFramebufferSize(this.window.getWindowId(), memAddress(framebufferSize),
            memAddress(framebufferSize) + 4);

    // Set the window size
    this.window.setSize(framebufferSize.get(0), framebufferSize.get(1));

    // Make the window context
    this.window.glMakeContextCurrent();

    // Set the swap interval (V-sync)
    glfwSwapInterval(0);

    // Show the window
    this.window.glShowWindow();

    // Center the cursor
    Input.centerMouseCursor();

    // Create the rendering capabilities, required by LWJGL
    GL.createCapabilities();

    // Print the OpenGL version
    System.out.println("OpenGL " + GL11.glGetString(GL11.GL_VERSION));

    // Set the clear color
    glClearColor(0.9f, 0.9f, 0.9f, 1.0f);

    // Enable depth testing
    glEnable(GL_DEPTH_TEST);

    // Load the engine shaders
    ShaderManager.load();

    // Initialize the Time object
    Time.init();

    // Show a status message
    System.out.println(VoxelTex.ENGINE_NAME + " renderer initialized successfully!");
}

From source file:com.unascribed.mavkit.Display.java

License:Open Source License

@UIEffect
private String getGLVersion(boolean es) {
    String fullVersion;/*from  ww w.  j  a v  a  2 s . c  o m*/
    String renderer;

    if (es) {
        GLES.createCapabilities();
        fullVersion = GLES20.glGetString(GLES20.GL_VERSION);
        renderer = GLES20.glGetString(GLES20.GL_RENDERER);
    } else {
        GL.createCapabilities();
        fullVersion = GL11.glGetString(GL11.GL_VERSION);
        renderer = GL11.glGetString(GL11.GL_RENDERER);
    }

    log.info("{}", fullVersion);
    log.info("{}", renderer);

    String version = fullVersion.split(" ", 2)[0];
    return version;
}

From source file:com.xrbpowered.gl.Client.java

License:Open Source License

public static void printInfo() {
    System.out.println("\n--------------------------------\nSYSTEM INFO\n--------------------------------");
    System.out.println("Device: " + GL11.glGetString(GL11.GL_RENDERER));
    System.out.println("Device vendor: " + GL11.glGetString(GL11.GL_VENDOR));
    System.out.println("OpenGL version: " + GL11.glGetString(GL11.GL_VERSION));

    System.out.printf("Max texture size: %d\n", GL11.glGetInteger(GL11.GL_MAX_TEXTURE_SIZE));
    System.out.printf("Max MSAA samples: %d\n", GL11.glGetInteger(GL30.GL_MAX_SAMPLES));
    System.out.printf("Max anisotropy: %d\n",
            GL11.glGetInteger(EXTTextureFilterAnisotropic.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT));
    System.out.printf("Max texture array layers: %d\n", GL11.glGetInteger(GL30.GL_MAX_ARRAY_TEXTURE_LAYERS));
    System.out.printf("Max vertex attribs: %d\n", GL11.glGetInteger(GL20.GL_MAX_VERTEX_ATTRIBS));
    System.out.printf("Max uniform components: %d\n", GL11.glGetInteger(GL20.GL_MAX_VERTEX_UNIFORM_COMPONENTS));
    System.out.printf("Available video memory (NVIDIA only): %.1f%%\n", getAvailMemoryNVidia() * 100f);
    System.out.println("--------------------------------");
    System.out.println();/*  w ww .  j  a  va  2s . com*/

    GL11.glGetError(); // clear errors
}

From source file:edu.pitt.atl23.LWJGLWindow.java

private void printInfo() {
    System.out.println();/*ww  w  .jav  a2 s  . c  om*/
    System.out.println("-----------------------------------------------------------");

    System.out.format("%-18s%s\n", "Running:", getClass().getName());
    System.out.println("GL_VENDOR: " + glGetString(GL11.GL_VENDOR));
    System.out.println("GL_RENDERER: " + glGetString(GL11.GL_RENDERER));
    System.out.println("GL_VERSION: " + glGetString(GL11.GL_VERSION));
    System.out.println("GL_SHADING_LANGUAGE: " + GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION));
}

From source file:espresso3d.engine.common.E3DFeatureChecker.java

License:Open Source License

private boolean checkFeature(String featureName) {
    //Only query it once per launch
    if (allExtensions == null)
        //        {
        allExtensions = GL11.glGetString(GL11.GL_EXTENSIONS);
    //          getEngine().getLogger().writeLine(E3DEngineLogger.SEVERITY_INFO, "Extensions supported === \n" + allExtensions);
    //      }//w ww.j  a v a  2 s  . c o m
    return allExtensions.indexOf(featureName) >= 0;

}