List of usage examples for org.lwjgl.opengl GL11 glGetString
@Nullable @NativeType("GLubyte const *") public static String glGetString(@NativeType("GLenum") int name)
From source file:com.badlogic.gdx.backends.lwjgl.LwjglGL10.java
License:Apache License
public final String glGetString(int name) { return GL11.glGetString(name); }
From source file:com.badlogic.gdx.backends.lwjgl.LwjglGraphics.java
License:Apache License
public void initiateGLInstances() { if (usingGL30) { gl30 = new LwjglGL30(); gl20 = gl30;/*from w w w . j a v a 2s. co m*/ } else { gl20 = new LwjglGL20(); } if (!isOpenGLOrHigher(2, 0)) throw new GdxRuntimeException( "OpenGL 2.0 or higher with the FBO extension is required. OpenGL version: " + GL11.glGetString(GL11.GL_VERSION) + "\n" + glInfo()); if (!supportsFBO()) { throw new GdxRuntimeException( "OpenGL 2.0 or higher with the FBO extension is required. OpenGL version: " + GL11.glGetString(GL11.GL_VERSION) + ", FBO extension: false\n" + glInfo()); } Gdx.gl = gl20; Gdx.gl20 = gl20; Gdx.gl30 = gl30; }
From source file:com.badlogic.gdx.backends.lwjgl.LwjglGraphics.java
License:Apache License
private String glInfo() { try {//from w w w . ja v a 2 s .com return GL11.glGetString(GL11.GL_VENDOR) + "\n" // + GL11.glGetString(GL11.GL_RENDERER) + "\n" // + GL11.glGetString(GL11.GL_VERSION); } catch (Throwable ignored) { } return ""; }
From source file:com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.java
License:Apache License
static long createGlfwWindow(Lwjgl3ApplicationConfiguration config, long sharedContextWindow) { GLFW.glfwDefaultWindowHints();/*from w w w. j av a 2s . com*/ GLFW.glfwWindowHint(GLFW.GLFW_VISIBLE, GLFW.GLFW_FALSE); GLFW.glfwWindowHint(GLFW.GLFW_RESIZABLE, config.windowResizable ? GLFW.GLFW_TRUE : GLFW.GLFW_FALSE); if (sharedContextWindow == 0) { GLFW.glfwWindowHint(GLFW.GLFW_RED_BITS, config.r); GLFW.glfwWindowHint(GLFW.GLFW_GREEN_BITS, config.g); GLFW.glfwWindowHint(GLFW.GLFW_BLUE_BITS, config.b); GLFW.glfwWindowHint(GLFW.GLFW_ALPHA_BITS, config.a); GLFW.glfwWindowHint(GLFW.GLFW_STENCIL_BITS, config.stencil); GLFW.glfwWindowHint(GLFW.GLFW_DEPTH_BITS, config.depth); GLFW.glfwWindowHint(GLFW.GLFW_SAMPLES, config.samples); } if (config.useGL30) { //GLFW.glfwWindowHint(GLFW.GLFW_CLIENT_API, GLFW.GLFW_OPENGL_API); GLFW.glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MAJOR, config.gles30ContextMajorVersion); GLFW.glfwWindowHint(GLFW.GLFW_CONTEXT_VERSION_MINOR, config.gles30ContextMinorVersion); GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_FORWARD_COMPAT, GLFW.GLFW_TRUE); GLFW.glfwWindowHint(GLFW.GLFW_OPENGL_PROFILE, GLFW.GLFW_OPENGL_CORE_PROFILE); } long windowHandle = 0; if (config.fullscreenMode != null) { // glfwWindowHint(GLFW.GLFW_REFRESH_RATE, config.fullscreenMode.refreshRate); windowHandle = GLFW.glfwCreateWindow(config.fullscreenMode.width, config.fullscreenMode.height, config.title, config.fullscreenMode.getMonitor(), sharedContextWindow); } else { GLFW.glfwWindowHint(GLFW.GLFW_DECORATED, config.windowDecorated ? GLFW.GLFW_TRUE : GLFW.GLFW_FALSE); windowHandle = GLFW.glfwCreateWindow(config.windowWidth, config.windowHeight, config.title, 0, sharedContextWindow); } if (windowHandle == 0) { throw new GdxRuntimeException("Couldn't create window"); } if (config.fullscreenMode == null) { if (config.windowX == -1 && config.windowY == -1) { GLFWVidMode vidMode = GLFW.glfwGetVideoMode(GLFW.glfwGetPrimaryMonitor()); GLFW.glfwSetWindowPos(windowHandle, vidMode.width() / 2 - config.windowWidth / 2, vidMode.height() / 2 - config.windowHeight / 2); } else { GLFW.glfwSetWindowPos(windowHandle, config.windowX, config.windowY); } } GLFW.glfwMakeContextCurrent(windowHandle); GLFW.glfwSwapInterval(config.vSyncEnabled ? 1 : 0); GL.createCapabilities(); extractVersion(); if (!isOpenGLOrHigher(2, 0)) throw new GdxRuntimeException( "OpenGL 2.0 or higher with the FBO extension is required. OpenGL version: " + GL11.glGetString(GL11.GL_VERSION) + "\n" + glInfo()); if (!supportsFBO()) { throw new GdxRuntimeException( "OpenGL 2.0 or higher with the FBO extension is required. OpenGL version: " + GL11.glGetString(GL11.GL_VERSION) + ", FBO extension: false\n" + glInfo()); } for (int i = 0; i < 2; i++) { GL11.glClearColor(config.initialBackgroundColor.r, config.initialBackgroundColor.g, config.initialBackgroundColor.b, config.initialBackgroundColor.a); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); GLFW.glfwSwapBuffers(windowHandle); } return windowHandle; }
From source file:com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.java
License:Apache License
private static void extractVersion() { // See https://www.opengl.org/wiki/GLAPI/glGetString, format is: // <major> "." <minor> ("." <release>) (<space> (<vendor_specific_info>)) String version = GL11.glGetString(GL11.GL_VERSION); try {/*from w w w. ja va 2 s. co m*/ String[] v = version.split(" ", 2)[0].split("\\.", 3); versionMajor = Integer.parseInt(v[0]); versionMinor = Integer.parseInt(v[1]); versionRelease = v.length > 2 ? Integer.parseInt(v[2]) : 0; } catch (Throwable t) { throw new GdxRuntimeException("Error extracting the OpenGL version: " + version, t); } }
From source file:com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.java
License:Apache License
private static String glInfo() { try {//from w ww . ja v a2s .c o m return GL11.glGetString(GL11.GL_VENDOR) + "\n" // + GL11.glGetString(GL11.GL_RENDERER) + "\n" // + GL11.glGetString(GL11.GL_VERSION); } catch (Throwable ignored) { } return ""; }
From source file:com.drazisil.opengl3demo.OpenGL3Demo.java
License:Apache License
private void initOpenGl() { System.out.println("Hello LWJGL " + Sys.getVersion() + "!"); // create and set the glfw error callback setupErrorCallback();/*from w w w . j a va 2 s. c om*/ // Initialize GLFW. Most GLFW functions will not work before doing this. if (glfwInit() != GL11.GL_TRUE) throw new IllegalStateException("Unable to initialize GLFW"); // create the window window = glfwCreateWindow(WIDTH, HEIGHT, title, 0, 0); // Check if window was created if (window == 0) { glfwTerminate(); exit(-1); } // Get the resolution of the primary monitor ByteBuffer vidmode = glfwGetVideoMode(glfwGetPrimaryMonitor()); // Center our window glfwSetWindowPos(window, (GLFWvidmode.width(vidmode) - WIDTH) / 2, (GLFWvidmode.height(vidmode) - HEIGHT) / 2); // Created and set the glfw key callback setupKeyCallback(); // make context current glfwMakeContextCurrent(window); // It is required to have an active OpenGL context GLContext.createFromCurrent(); System.out.println("OpenGL Version " + GL11.glGetString(GL11.GL_VERSION)); vertexArrays = glGenVertexArrays(); glBindVertexArray(vertexArrays); colorBufferObject = glGenBuffers(); }
From source file:com.github.begla.blockmania.rendering.manager.ShaderManager.java
License:Apache License
private ShaderManager() { Blockmania.getInstance().getLogger().log(Level.INFO, "Loading Blockmania shader manager..."); Blockmania.getInstance().getLogger().log(Level.INFO, "GL_VERSION: {0}", GL11.glGetString(GL11.GL_VERSION)); Blockmania.getInstance().getLogger().log(Level.INFO, "SHADING_LANGUAGE VERSION: {0}", GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION)); Blockmania.getInstance().getLogger().log(Level.INFO, "EXTENSIONS: {0}", GL11.glGetString(GL11.GL_EXTENSIONS)); initShaders();//www . ja v a 2 s.c o m }
From source file:com.github.begla.blockmania.rendering.ShaderManager.java
License:Apache License
private ShaderManager() { initShaders();/*w ww . j a v a 2 s . c o m*/ Blockmania.getInstance().getLogger().log(Level.INFO, "Loading Blockmania shader manager..."); Blockmania.getInstance().getLogger().log(Level.INFO, "GL_VERSION: {0}", GL11.glGetString(GL11.GL_VERSION)); Blockmania.getInstance().getLogger().log(Level.INFO, "SHADING_LANGUAGE VERSION: {0}", GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION)); Blockmania.getInstance().getLogger().log(Level.INFO, "EXTENSIONS: {0}", GL11.glGetString(GL11.GL_EXTENSIONS)); }
From source file:com.google.gapid.glviewer.GeometryScene.java
License:Apache License
@Override public void init(Renderer renderer) { 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(renderer);/*w w w. j a va 2s . c o m*/ if (renderable != null) { renderable.init(renderer); } GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glClearColor(background[0], background[1], background[2], background[3]); GL11.glPointSize(4); GL30.glBindVertexArray(GL30.glGenVertexArrays()); }