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:org.ode4j.drawstuff.internal.LwJGL.java

License:Open Source License

private static void createMainWindow(int _width, int _height) {
    // create Window of size 300x300
    try {/*from  ww  w.j av  a2s  . co 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.spout.engine.SpoutClient.java

License:Open Source License

public void initRenderer() {
    createWindow();//from  w  w w. j a va2s .co  m

    //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  w w w  . j a v  a  2 s  .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.spoutcraft.client.gui.error.GuiUnexpectedError.java

License:Open Source License

private void generateHastie() {
    if (generated) {
        hastebinLink.setText("Error Link: " + ChatColor.GREEN + hastebinURL);
        return;/* w  ww. j  av a  2 s  . co  m*/
    }
    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.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);/* w ww .jav a 2  s. c om*/
            } 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();/*ww w .j a va2  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: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:yugecin.opsudance.core.DisplayContainer.java

License:Open Source License

public void setup() throws Exception {
    width = height = -1;//from w w  w. j a  v  a 2s . c  o m
    Input.disableControllers();
    Display.setTitle("opsu!dance");
    setupResolutionOptionlist(nativeDisplayMode.getWidth(), nativeDisplayMode.getHeight());
    updateDisplayMode(OPTION_SCREEN_RESOLUTION.getValueString());
    Display.create();
    GLHelper.setIcons(new String[] { "icon16.png", "icon32.png" });
    initGL();
    glVersion = GL11.glGetString(GL11.GL_VERSION);
    glVendor = GL11.glGetString(GL11.GL_VENDOR);
    GLHelper.hideNativeCursor();
}