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:a1.Main.java
License:Open Source License
public boolean initialize() { GameState = 0;//from ww w. j ava 2s .com Keyboard.enableRepeatEvents(true); input = new Input(GUI.getInstance()); Dialog.Init(); if (!initDisplay()) return false; last_fps_tick = last_tick = System.currentTimeMillis(); fps_counter = 0; FPS = 0; Render2D.LoadSystemFont(); SetIcon(); Log.info("adapter: " + Display.getAdapter()); Log.info("version: " + Display.getVersion()); Log.info("gl vendor: " + GL11.glGetString(GL11.GL_VENDOR)); if (GLContext.getCapabilities().GL_ARB_vertex_buffer_object) Log.info("gl: GL_ARB_vertex_buffer_object supported!"); else Log.info("gl: GL_ARB_vertex_buffer_object NOT supported!"); initGL(); setView(Config.getScreenWidth(), Config.getScreenHeight()); ResSources.Init(); skin = new Skin_MyGUI(); skin.Init(); return true; }
From source file:akarnokd.opengl.experiment.CheckVersion.java
License:Apache License
public static void main(String[] args) throws Exception { Display.setDisplayMode(new DisplayMode(100, 100)); Display.create();// w w w.ja v a 2s .co m System.out.println("OpenGL version: " + GL11.glGetString(GL11.GL_VERSION)); Display.destroy(); }
From source file:aphelion.client.Client.java
License:Open Source License
/** * @param uri if null, singleplayer * @param nickname /*from w w w. j a va 2s .c o m*/ * @throws LWJGLException * @throws IOException * @throws aphelion.server.ServerConfigException */ public void run(@Nullable URI uri, @Nonnull final String nickname) throws LWJGLException, IOException, ServerConfigException { if (uri == null) { Yaml yaml = new Yaml(new SafeConstructor()); Map<String, Object> singlePlayerConfig; try { singlePlayerConfig = (Map<String, Object>) yaml .load(new FileInputStream("./assets/singleplayer.yaml")); } catch (FileNotFoundException | ClassCastException | YAMLException ex) { // Note: YAMLException is a RunTimeException throw new ServerConfigException("Unable to read server config", ex); } // ignore bind-address and bind-port // share the assets directory singlePlayerConfig.put("assets-cache-path", new LocalUserStorage("assets").getDirectory().getAbsolutePath()); serverThread = new AphelionServerThread(false, singlePlayerConfig); serverThread.start(); try { uri = new URI("ws://127.0.0.1:" + serverThread.getHTTPListeningPort() + "/aphelion"); } catch (URISyntaxException ex) { log.log(Level.SEVERE, "Malformed URI", ex); throw new Error(ex); } } this.serverUri = uri; Display.setTitle("Aphelion"); ByteBuffer[] icons = new ByteBuffer[6]; aphelion.launcher.Main.getFrameIcons(icons); Display.setIcon(icons); Display.setFullscreen(false); Display.setVSyncEnabled(false); Display.setResizable(true); Display.setInitialBackground(0f, 0f, 0f); Display.setDisplayMode(new DisplayMode(1024, 768)); Display.create(); log.log(Level.INFO, "OpenGL version: {0}", GL11.glGetString(GL11.GL_VERSION)); Keyboard.create(); // use the default time source for now // availableProcessors is including HT (for example "8" on a quad core) int processors = Runtime.getRuntime().availableProcessors(); if (processors < 2) { processors = 2; } // minimum of two workers loop = new TickedEventLoop(EnvironmentConf.TICK_LENGTH, processors, null); resourceDB = new ResourceDB(loop); loop.addLoopEvent(resourceDB); resourceDB.addZip(new File("assets/gui.zip")); loop.setup(); connectLoop = new ConnectLoop(serverUri, resourceDB, loop, nickname); state = STATE.NONE; if (!connectLoop.loop()) { log.log(Level.SEVERE, "Connection failed"); NetworkedGame networkedGame = connectLoop.getNetworkedGame(); AuthenticateResponse.ERROR authError = networkedGame.getAuthError(); WS_CLOSE_STATUS closeStatus = networkedGame.getDisconnectCode(); breakdown(); if (authError != null) { String reason = networkedGame.getAuthErrorDesc(); if (reason == null) reason = ""; JOptionPane.showMessageDialog(null, "Unable to authenticate to " + uri + " (code:" + authError + ")\n\n" + reason, "Aphelion", JOptionPane.ERROR_MESSAGE); } else if (closeStatus != null) { String reason = networkedGame.getDisconnectReason(); if (reason == null) reason = ""; JOptionPane.showMessageDialog(null, "Unable to connect to " + uri + " (code:" + closeStatus + ")\n\n" + reason, "Aphelion", JOptionPane.ERROR_MESSAGE); } return; } loop.setClockSource(connectLoop.getSyncedClockSource()); log.log(Level.INFO, "Connected"); state = STATE.PLAYING; NetworkedGame netGame = connectLoop.getNetworkedGame(); InitializeLoop initLoop = new InitializeLoop(connectLoop); if (initLoop.loop()) { GameLoop gameLoop = new GameLoop(initLoop); initLoop = null; gameLoop.loop(); breakdown(); if (gameLoop.isConnectionError()) { WS_CLOSE_STATUS code = netGame.getDisconnectCode(); String reason = netGame.getDisconnectReason(); if (reason == null) reason = ""; JOptionPane.showMessageDialog(null, "Connection to the server suddenly dropped (" + uri + ") (code:" + code + ")\n\n" + reason, "Aphelion", JOptionPane.ERROR_MESSAGE); } } else { log.log(Level.SEVERE, "Initialize failed"); breakdown(); } }
From source file:cn.lambdalib.util.client.shader.ShaderProgram.java
License:MIT License
private boolean checkCapability() { String versionShort = GL11.glGetString(GL11.GL_VERSION).trim().substring(0, 3); return "2.1".compareTo(versionShort) <= 0; }
From source file:com.adavr.player.Application.java
License:Open Source License
private void loop() { GLContext.createFromCurrent();/*from w ww . j a v a 2 s. c o m*/ System.out.println("OpenGL version: " + GL11.glGetString(GL11.GL_VERSION)); System.out.println("App Context: " + appCtx.getClass().getName()); appCtx.setup(); hmdCtx.setup(); while (GLFW.glfwWindowShouldClose(window) == GL11.GL_FALSE) { counter.tick(); hmdCtx.loop(); if (vSync) { GLFW.glfwSwapBuffers(window); } GLFW.glfwPollEvents(); } if (mediaCtx != null) { mediaCtx.stop(); } hmdCtx.destroy(); appCtx.destroy(); }
From source file:com.ardor3d.renderer.lwjgl.LwjglContextCapabilities.java
License:Open Source License
public LwjglContextCapabilities(final org.lwjgl.opengl.ContextCapabilities caps) { final IntBuffer buf = BufferUtils.createIntBuffer(16); _supportsVBO = caps.GL_ARB_vertex_buffer_object; _supportsGL1_2 = caps.OpenGL12;/*from w w w .java 2 s . c o m*/ _supportsMultisample = caps.GL_ARB_multisample; _supportsDoubleCoefficientsInClipPlaneEquation = true; _supportsConstantColor = _supportsEq = caps.GL_ARB_imaging; _supportsSeparateFunc = caps.GL_EXT_blend_func_separate; _supportsSeparateEq = caps.GL_EXT_blend_equation_separate; _supportsMinMax = caps.GL_EXT_blend_minmax; _supportsSubtract = caps.GL_EXT_blend_subtract; _supportsFogCoords = caps.GL_EXT_fog_coord; _supportsFragmentProgram = caps.GL_ARB_fragment_program; _supportsVertexProgram = caps.GL_ARB_vertex_program; _supportsPointSprites = caps.GL_ARB_point_sprite; _supportsPointParameters = caps.GL_ARB_point_parameters; _supportsTextureLodBias = caps.GL_EXT_texture_lod_bias; if (_supportsTextureLodBias) { GL11.glGetInteger(EXTTextureLODBias.GL_MAX_TEXTURE_LOD_BIAS_EXT, buf); _maxTextureLodBias = buf.get(0); } else { _maxTextureLodBias = 0f; } GL11.glGetInteger(GL11.GL_MAX_CLIP_PLANES, buf); _maxUserClipPlanes = buf.get(0); _glslSupported = caps.GL_ARB_shader_objects && caps.GL_ARB_fragment_shader && caps.GL_ARB_vertex_shader && caps.GL_ARB_shading_language_100; _geometryShader4Supported = caps.GL_ARB_geometry_shader4 && _glslSupported; _geometryInstancingSupported = caps.GL_EXT_draw_instanced || caps.OpenGL31; if (_glslSupported) { GL11.glGetInteger(ARBVertexShader.GL_MAX_VERTEX_ATTRIBS_ARB, buf); _maxGLSLVertexAttribs = buf.get(0); } // Pbuffer _pbufferSupported = caps.GL_ARB_pixel_buffer_object; // FBO _fboSupported = caps.GL_EXT_framebuffer_object; if (_fboSupported) { _supportsFBOMultisample = caps.GL_EXT_framebuffer_multisample; _supportsFBOBlit = caps.GL_EXT_framebuffer_blit; if (caps.GL_ARB_draw_buffers) { GL11.glGetInteger(EXTFramebufferObject.GL_MAX_COLOR_ATTACHMENTS_EXT, buf); _maxFBOColorAttachments = buf.get(0); } else { _maxFBOColorAttachments = 1; } // Max multisample samples. if (caps.GL_EXT_framebuffer_multisample && caps.GL_EXT_framebuffer_blit) { GL11.glGetInteger(EXTFramebufferMultisample.GL_MAX_SAMPLES_EXT, buf); _maxFBOSamples = buf.get(0); } else { _maxFBOSamples = 0; } } else { _maxFBOColorAttachments = 0; } _twoSidedStencilSupport = caps.GL_EXT_stencil_two_side; _stencilWrapSupport = caps.GL_EXT_stencil_wrap; // number of available auxiliary draw buffers GL11.glGetInteger(GL11.GL_AUX_BUFFERS, buf); _numAuxDrawBuffers = buf.get(0); // max texture size. GL11.glGetInteger(GL11.GL_MAX_TEXTURE_SIZE, buf); _maxTextureSize = buf.get(0); // Check for support of multitextures. _supportsMultiTexture = caps.GL_ARB_multitexture; // Support for texture formats _supportsFloatTextures = caps.GL_ARB_texture_float; _supportsIntegerTextures = caps.GL_EXT_texture_integer; _supportsOneTwoComponentTextures = caps.GL_ARB_texture_rg; // Check for support of fixed function dot3 environment settings _supportsEnvDot3 = caps.GL_ARB_texture_env_dot3; // Check for support of fixed function dot3 environment settings _supportsEnvCombine = caps.GL_ARB_texture_env_combine; // Check for support of automatic mipmap generation _automaticMipMaps = caps.GL_SGIS_generate_mipmap; _supportsDepthTexture = caps.GL_ARB_depth_texture; _supportsShadow = caps.GL_ARB_shadow; // If we do support multitexturing, find out how many textures we // can handle. if (_supportsMultiTexture) { GL11.glGetInteger(ARBMultitexture.GL_MAX_TEXTURE_UNITS_ARB, buf); _numFixedTexUnits = buf.get(0); } else { _numFixedTexUnits = 1; } // Go on to check number of texture units supported for vertex and // fragment shaders if (caps.GL_ARB_shader_objects && caps.GL_ARB_vertex_shader && caps.GL_ARB_fragment_shader) { GL11.glGetInteger(ARBVertexShader.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, buf); _numVertexTexUnits = buf.get(0); GL11.glGetInteger(ARBFragmentShader.GL_MAX_TEXTURE_IMAGE_UNITS_ARB, buf); _numFragmentTexUnits = buf.get(0); GL11.glGetInteger(ARBFragmentShader.GL_MAX_TEXTURE_COORDS_ARB, buf); _numFragmentTexCoordUnits = buf.get(0); } else { // based on nvidia dev doc: // http://developer.nvidia.com/object/General_FAQ.html#t6 // "For GPUs that do not support GL_ARB_fragment_program and // GL_NV_fragment_program, those two limits are set equal to // GL_MAX_TEXTURE_UNITS." _numFragmentTexCoordUnits = _numFixedTexUnits; _numFragmentTexUnits = _numFixedTexUnits; // We'll set this to 0 for now since we do not know: _numVertexTexUnits = 0; } // ARBShaderObjects.GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB // caps.GL_EXT_bindable_uniform // EXTBindableUniform.GL_MAX_BINDABLE_UNIFORM_SIZE_EXT; // Now determine the maximum number of supported texture units _numTotalTexUnits = Math.max(_numFragmentTexCoordUnits, Math.max(_numFixedTexUnits, Math.max(_numFragmentTexUnits, _numVertexTexUnits))); // Check for S3 texture compression capability. _supportsS3TCCompression = caps.GL_EXT_texture_compression_s3tc; // Check for LA texture compression capability. _supportsLATCCompression = caps.GL_EXT_texture_compression_latc; // Check for generic texture compression capability. _supportsGenericCompression = caps.GL_ARB_texture_compression; // Check for 3D texture capability. _supportsTexture3D = caps.OpenGL12; // Check for cubemap capability. _supportsTextureCubeMap = caps.GL_ARB_texture_cube_map; // See if we support anisotropic filtering _supportsAniso = caps.GL_EXT_texture_filter_anisotropic; if (_supportsAniso) { // Due to LWJGL buffer check, you can't use smaller sized // buffers (min_size = 16 for glGetFloat()). final FloatBuffer max_a = BufferUtils.createFloatBuffer(16); max_a.rewind(); // Grab the maximum anisotropic filter. GL11.glGetFloat(EXTTextureFilterAnisotropic.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, max_a); // set max. _maxAnisotropic = max_a.get(0); } // See if we support textures that are not power of 2 in size. _supportsNonPowerTwo = caps.GL_ARB_texture_non_power_of_two; // See if we support textures that do not have width == height. _supportsRectangular = caps.GL_ARB_texture_rectangle; _supportsMirroredRepeat = caps.GL_ARB_texture_mirrored_repeat; _supportsMirrorClamp = _supportsMirrorEdgeClamp = _supportsMirrorBorderClamp = caps.GL_EXT_texture_mirror_clamp; _supportsBorderClamp = caps.GL_ARB_texture_border_clamp; _supportsEdgeClamp = _supportsGL1_2; try { _displayVendor = GL11.glGetString(GL11.GL_VENDOR); } catch (final Exception e) { _displayVendor = "Unable to retrieve vendor."; } try { _displayRenderer = GL11.glGetString(GL11.GL_RENDERER); } catch (final Exception e) { _displayRenderer = "Unable to retrieve adapter details."; } try { _displayVersion = GL11.glGetString(GL11.GL_VERSION); } catch (final Exception e) { _displayVersion = "Unable to retrieve API version."; } try { _shadingLanguageVersion = GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION); } catch (final Exception e) { _shadingLanguageVersion = "Unable to retrieve shading language version."; } }
From source file:com.ardor3d.scene.state.lwjgl.LwjglFragmentProgramStateUtil.java
License:Open Source License
/** * Queries OpenGL for errors in the fragment program. Errors are logged as SEVERE, noting both the line number and * message.//ww w .j a v a 2s. c o m */ private static void checkProgramError() { if (GL11.glGetError() == GL11.GL_INVALID_OPERATION) { // retrieve the error position final IntBuffer errorloc = BufferUtils.createIntBuffer(16); GL11.glGetInteger(ARBProgram.GL_PROGRAM_ERROR_POSITION_ARB, errorloc); logger.severe("Error " + GL11.glGetString(ARBProgram.GL_PROGRAM_ERROR_STRING_ARB) + " in fragment program on line " + errorloc.get(0)); } }
From source file:com.ardor3d.scene.state.lwjgl.LwjglVertexProgramStateUtil.java
License:Open Source License
/** * Queries OpenGL for errors in the vertex program. Errors are logged as SEVERE, noting both the line number and * message.// w w w .j av a2 s .c om */ private static void checkProgramError() { if (GL11.glGetError() == GL11.GL_INVALID_OPERATION) { // retrieve the error position final IntBuffer errorloc = BufferUtils.createIntBuffer(16); GL11.glGetInteger(ARBProgram.GL_PROGRAM_ERROR_POSITION_ARB, errorloc); logger.severe("Error " + GL11.glGetString(ARBProgram.GL_PROGRAM_ERROR_STRING_ARB) + " in vertex program on line " + errorloc.get(0)); } }
From source file:com.badlogic.gdx.backends.jglfw.JglfwGL20.java
License:Apache License
public String glGetString(int name) { return GL11.glGetString(name); }
From source file:com.badlogic.gdx.backends.jglfw.JglfwGraphics.java
License:Apache License
public JglfwGraphics(JglfwApplicationConfiguration config) { // Store values from config. bufferFormat = new BufferFormat(config.r, config.g, config.b, config.a, config.depth, config.stencil, config.samples, false);/*from w w w .ja va2 s . c o m*/ title = config.title; resizable = config.resizable; undecorated = config.undecorated; x = config.x; y = config.y; vSync = config.vSync; // FIXME: This needs smarts usingGL30 = config.useGL30; initialBackgroundColor = config.initialBackgroundColor; if (config.fullscreenMonitorIndex != -1) { // Use monitor specified in config if it is valid. PointerBuffer monitors = glfwGetMonitors(); long count = monitors.get(); if (config.fullscreenMonitorIndex < count) fullscreenMonitor = monitors.get(config.fullscreenMonitorIndex + 1); } // Create window. if (!createWindow(config.width, config.height, config.fullscreen)) { throw new GdxRuntimeException("Unable to create window: " + config.width + "x" + config.height + ", fullscreen: " + config.fullscreen); } GL.createCapabilities(); // Create GL. String version = GL11.glGetString(GL20.GL_VERSION); glMajorVersion = Integer.parseInt("" + version.charAt(0)); glMinorVersion = Integer.parseInt("" + version.charAt(2)); if (glMajorVersion <= 1) throw new GdxRuntimeException( "OpenGL 2.0 or higher with the FBO extension is required. OpenGL version: " + version); if (glMajorVersion == 2 || version.contains("2.1")) { if (!supportsExtension("GL_EXT_framebuffer_object") && !supportsExtension("GL_ARB_framebuffer_object")) { throw new GdxRuntimeException( "OpenGL 2.0 or higher with the FBO extension is required. OpenGL version: " + version + ", FBO extension: false"); } } if (usingGL30) { gl30 = new JglfwGL30(); gl20 = gl30; } else { gl20 = new JglfwGL20(); } Gdx.gl = gl20; Gdx.gl20 = gl20; Gdx.gl30 = gl30; if (!config.hidden) show(); }