/** * Initialise offscreen rendering by checking what buffers are supported * by the card * * @throws SlickException Indicates no buffers are supported */ private static void init() throws SlickException { init = true; if (fbo) { fbo = GLContext.getCapabilities().GL_EXT_framebuffer_object; } pbuffer = (Pbuffer.getCapabilities() & Pbuffer.PBUFFER_SUPPORTED) != 0; pbufferRT = (Pbuffer.getCapabilities() & Pbuffer.RENDER_TEXTURE_SUPPORTED) != 0; if (!fbo && !pbuffer && !pbufferRT) { throw new SlickException("Your OpenGL card does not support offscreen buffers and hence can't handle the dynamic images required for this application."); } Log.info("Offscreen Buffers FBO="+fbo+" PBUFFER="+pbuffer+" PBUFFERRT="+pbufferRT); }
/** * Creates a GLFWWindow and gives it OpenGL context */ private void createWindow() { // Hide the window during application initialization Window.hint(GLFW.GLFW_VISIBLE, GL11.GL_FALSE); // Setup MSAA 4x Window.hint(GLFW.GLFW_SAMPLES, 4); WINDOW.create(config.width, config.height, config.title); // Make this thread and window the current context for OpenGL WINDOW.makeContextCurrent(); GLContext.createFromCurrent(); // Set other specified window configurations WINDOW.setVSyncEnabled(config.vSyncEnabled); WINDOW.setPosition(config.position); }
/** * Initialize default state. */ private void init() { if (glfwInit() != GL_TRUE) { throw new IllegalStateException("GLFW failed to initialize!"); } win = glfwCreateWindow(SCREEN_WIDTH, SCREEN_HEIGHT, TITLE, 0, 0); glfwShowWindow(win); glfwMakeContextCurrent(win); GLContext.createFromCurrent(); GL.createCapabilities(true); glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); }
public static void startup(Minecraft mc) { checkShadersModInstalled(); mc = Minecraft.getMinecraft(); capabilities = GLContext.getCapabilities(); glVersionString = GL11.glGetString(GL11.GL_VERSION); glVendorString = GL11.glGetString(GL11.GL_VENDOR); glRendererString = GL11.glGetString(GL11.GL_RENDERER); SMCLog.info("ShadersMod version: 2.4.12"); SMCLog.info("OpenGL Version: " + glVersionString); SMCLog.info("Vendor: " + glVendorString); SMCLog.info("Renderer: " + glRendererString); SMCLog.info("Capabilities: " + (capabilities.OpenGL20 ? " 2.0 " : " - ") + (capabilities.OpenGL21 ? " 2.1 " : " - ") + (capabilities.OpenGL30 ? " 3.0 " : " - ") + (capabilities.OpenGL32 ? " 3.2 " : " - ") + (capabilities.OpenGL40 ? " 4.0 " : " - ")); SMCLog.info("GL_MAX_DRAW_BUFFERS: " + GL11.glGetInteger(GL20.GL_MAX_DRAW_BUFFERS)); SMCLog.info("GL_MAX_COLOR_ATTACHMENTS_EXT: " + GL11.glGetInteger(36063)); SMCLog.info("GL_MAX_TEXTURE_IMAGE_UNITS: " + GL11.glGetInteger(GL20.GL_MAX_TEXTURE_IMAGE_UNITS)); hasGlGenMipmap = capabilities.OpenGL30; loadConfig(); }
public static void startup(Minecraft mc) { checkShadersModInstalled(); Shaders.mc = mc; mc = Minecraft.getMinecraft(); capabilities = GLContext.getCapabilities(); glVersionString = GL11.glGetString(GL11.GL_VERSION); glVendorString = GL11.glGetString(GL11.GL_VENDOR); glRendererString = GL11.glGetString(GL11.GL_RENDERER); SMCLog.info("ShadersMod version: 2.4.12"); SMCLog.info("OpenGL Version: " + glVersionString); SMCLog.info("Vendor: " + glVendorString); SMCLog.info("Renderer: " + glRendererString); SMCLog.info("Capabilities: " + (capabilities.OpenGL20 ? " 2.0 " : " - ") + (capabilities.OpenGL21 ? " 2.1 " : " - ") + (capabilities.OpenGL30 ? " 3.0 " : " - ") + (capabilities.OpenGL32 ? " 3.2 " : " - ") + (capabilities.OpenGL40 ? " 4.0 " : " - ")); SMCLog.info("GL_MAX_DRAW_BUFFERS: " + GL11.glGetInteger(GL20.GL_MAX_DRAW_BUFFERS)); SMCLog.info("GL_MAX_COLOR_ATTACHMENTS_EXT: " + GL11.glGetInteger(36063)); SMCLog.info("GL_MAX_TEXTURE_IMAGE_UNITS: " + GL11.glGetInteger(GL20.GL_MAX_TEXTURE_IMAGE_UNITS)); hasGlGenMipmap = capabilities.OpenGL30; loadConfig(); }
public GuiMainMenu() { this.openGLWarning2 = MORE_INFO_TEXT; IResource iresource = null; this.splashText = "uhoh"; this.splashText = Splashes.getSplashes()[new Random().nextInt(Splashes.getSplashes().length)]; this.updateCounter = RANDOM.nextFloat(); this.openGLWarning1 = ""; if (!GLContext.getCapabilities().OpenGL20 && !OpenGlHelper.areShadersSupported()) { this.openGLWarning1 = I18n.format("title.oldgl1", new Object[0]); this.openGLWarning2 = I18n.format("title.oldgl2", new Object[0]); this.openGLWarningLink = "https://help.mojang.com/customer/portal/articles/325948?ref=game"; } String s1 = System.getProperty("java.version"); if (s1 != null && (s1.startsWith("1.6") || s1.startsWith("1.7"))) { this.openGLWarning1 = I18n.format("title.oldjava1", new Object[0]); this.openGLWarning2 = I18n.format("title.oldjava2", new Object[0]); this.openGLWarningLink = "https://help.mojang.com/customer/portal/articles/2636196?ref=game"; } }
/** * @return Maxiumum anti-aliasing samples supported. Required to have the LWJGL libraries loaded before calling */ public static int getMaximumAntialiasingSamples() { int result = 0; try { Pbuffer pb = new Pbuffer( 10, 10, new PixelFormat( 24, 8, 24, 8, 0 ), null ); pb.makeCurrent(); boolean supported = GLContext.getCapabilities().GL_ARB_multisample; if ( supported ) { result = GL11.glGetInteger( GL30.GL_MAX_SAMPLES ); } pb.destroy(); } catch( LWJGLException e ) { //e.printStackTrace(); } return result; }
/** * @return Maxiumum anti-aliasing samples supported. Required to have the LWJGL libraries loaded before calling */ public static int getMaximumAntialiasingSamples() { int result = 0; try { Pbuffer pb = new Pbuffer( 10, 10, new PixelFormat( 32, 0, 24, 8, 0 ), null ); pb.makeCurrent(); boolean supported = GLContext.getCapabilities().GL_ARB_multisample; if ( supported ) { result = GL11.glGetInteger( GL30.GL_MAX_SAMPLES ); } pb.destroy(); } catch ( LWJGLException e ) { //e.printStackTrace(); } return result; }
/** * Initialize */ private static void init() throws Exception { System.out.println("Timer resolution: " + Sys.getTimerResolution()); // Go into orthographic projection mode. glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0, Display.getDisplayMode().getWidth(), 0, Display.getDisplayMode().getHeight()); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight()); if ( !GLContext.getCapabilities().GL_ARB_vertex_buffer_object ) { System.out.println("ARB VBO not supported!"); System.exit(1); } buffer_id = glGenBuffersARB(); glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffer_id); vertices = ByteBuffer.allocateDirect(2 * 4 * 4).order(ByteOrder.nativeOrder()).asFloatBuffer(); vertices.put(-50).put(-50).put(50).put(-50).put(50).put(50).put(-50).put(50); glBufferDataARB(GL_ARRAY_BUFFER_ARB, 2 * 4 * 4, GL_STREAM_DRAW_ARB); glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 0, 0); }
public void initialize() { //glDisable(GL_DEPTH_TEST); glShadeModel(GL_SMOOTH); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); if (GLContext.getCapabilities().GL_ARB_texture_non_power_of_two) { caps.add(Caps.NonPowerOfTwoTextures); } else { logger.log(Level.WARNING, "Your graphics card does not " + "support non-power-of-2 textures. " + "Some features might not work."); } if (GLContext.getCapabilities().OpenGL12){ gl12 = true; } }
protected void printContextInitInfo(){ logger.log(Level.FINE, "Running on thread: {0}", Thread.currentThread().getName()); logger.log(Level.INFO, "Adapter: {0}", Display.getAdapter()); logger.log(Level.INFO, "Driver Version: {0}", Display.getVersion()); String vendor = GL11.glGetString(GL11.GL_VENDOR); logger.log(Level.INFO, "Vendor: {0}", vendor); String version = GL11.glGetString(GL11.GL_VERSION); logger.log(Level.INFO, "OpenGL Version: {0}", version); String renderGl = GL11.glGetString(GL11.GL_RENDERER); logger.log(Level.INFO, "Renderer: {0}", renderGl); if (GLContext.getCapabilities().OpenGL20){ String shadingLang = GL11.glGetString(GL20.GL_SHADING_LANGUAGE_VERSION); logger.log(Level.INFO, "GLSL Ver: {0}", shadingLang); } }
public int loadTexture(String fileName) { Texture texture = null; try { texture = TextureLoader.getTexture("PNG", new FileInputStream(MainGameLoop.fileManager.getTextureFile(fileName))); GL30.glGenerateMipmap(GL11.GL_TEXTURE_2D); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR_MIPMAP_LINEAR); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL14.GL_TEXTURE_LOD_BIAS, 0); if (GLContext.getCapabilities().GL_EXT_texture_filter_anisotropic) { float amount = Math.min(4f, GL11.glGetFloat(EXTTextureFilterAnisotropic.GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT)); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, EXTTextureFilterAnisotropic.GL_TEXTURE_MAX_ANISOTROPY_EXT, amount); } else { System.out.println("Filter Anisotropic Not Supported"); } } catch (Exception e) { e.printStackTrace(); System.err.println("Tried to load texture " + fileName + ".png , didn't work"); System.exit(-1); } textures.add(texture.getTextureID()); return texture.getTextureID(); }
@Subscribe public void preInit(FMLPreInitializationEvent evt) { log = evt.getModLog(); ContextCapabilities caps = GLContext.getCapabilities(); copyImageSupported = caps.OpenGL43 || caps.GL_ARB_copy_image; if(!copyImageSupported) { log.warn("Fast animated textures require OpenGL 4.3 or ARB_copy_image extension, which were not detected. Using original slow path."); } else { log.info("Using fast animated textures."); } File configFile = evt.getSuggestedConfigurationFile(); Configuration config = new Configuration(configFile); boolean enableFastAnimation = config.getBoolean("enableFastAnimation", "animfix", true, "Enable the faster animation mode. Set to false only if true causes issues."); maxUpdateMip = config.getInt("maxUpdateMipLevel", "animfix", -1, -1, 4, "Set to a number to disable animation updates past that mip level. -1 means update all. Higher numbers update more levels."); if(config.hasChanged()) { config.save(); } copyImageEnabled = copyImageSupported && enableFastAnimation; }
public Window(String title, int width, int height) { Window.title = title; Window.width = width; Window.height = height; glfwInit(); //glfwWindowHint(GLFW_DECORATED, GL_FALSE); window = glfwCreateWindow(width, height, title, 0, 0); glfwMakeContextCurrent(window); GLContext.createFromCurrent(); glfwSwapInterval(1); keyCallback = new KeyCallback(); mousePosCallback = new MousePosCallback(); glfwSetKeyCallback(window, keyCallback); glfwSetCursorPosCallback(window, mousePosCallback); }
/** * Initializes the texture constants to be used when rendering lightmap values */ public static void initializeTextures() { Config.initDisplay(); useMultitextureARB = GLContext.getCapabilities().GL_ARB_multitexture && !GLContext.getCapabilities().OpenGL13; if (useMultitextureARB) { defaultTexUnit = 33984; lightmapTexUnit = 33985; } else { defaultTexUnit = 33984; lightmapTexUnit = 33985; } openGL14 = GLContext.getCapabilities().OpenGL14; framebufferSupported = openGL14 && GLContext.getCapabilities().GL_ARB_framebuffer_object; anisotropicFilteringSupported = GLContext.getCapabilities().GL_EXT_texture_filter_anisotropic; anisotropicFilteringMax = (int)(anisotropicFilteringSupported ? GL11.glGetFloat(34047) : 0.0F); GameSettings.Options.ANISOTROPIC_FILTERING.setValueMax((float)anisotropicFilteringMax); openGL21 = GLContext.getCapabilities().OpenGL21; shadersSupported = framebufferSupported && openGL21; }
public void addServerTypeToSnooper(PlayerUsageSnooper par1PlayerUsageSnooper) { par1PlayerUsageSnooper.addData("opengl_version", GL11.glGetString(GL11.GL_VERSION)); par1PlayerUsageSnooper.addData("opengl_vendor", GL11.glGetString(GL11.GL_VENDOR)); par1PlayerUsageSnooper.addData("client_brand", ClientBrandRetriever.getClientModName()); par1PlayerUsageSnooper.addData("launched_version", this.launchedVersion); ContextCapabilities var2 = GLContext.getCapabilities(); par1PlayerUsageSnooper.addData("gl_caps[ARB_multitexture]", Boolean.valueOf(var2.GL_ARB_multitexture)); par1PlayerUsageSnooper.addData("gl_caps[ARB_multisample]", Boolean.valueOf(var2.GL_ARB_multisample)); par1PlayerUsageSnooper.addData("gl_caps[ARB_texture_cube_map]", Boolean.valueOf(var2.GL_ARB_texture_cube_map)); par1PlayerUsageSnooper.addData("gl_caps[ARB_vertex_blend]", Boolean.valueOf(var2.GL_ARB_vertex_blend)); par1PlayerUsageSnooper.addData("gl_caps[ARB_matrix_palette]", Boolean.valueOf(var2.GL_ARB_matrix_palette)); par1PlayerUsageSnooper.addData("gl_caps[ARB_vertex_program]", Boolean.valueOf(var2.GL_ARB_vertex_program)); par1PlayerUsageSnooper.addData("gl_caps[ARB_vertex_shader]", Boolean.valueOf(var2.GL_ARB_vertex_shader)); par1PlayerUsageSnooper.addData("gl_caps[ARB_fragment_program]", Boolean.valueOf(var2.GL_ARB_fragment_program)); par1PlayerUsageSnooper.addData("gl_caps[ARB_fragment_shader]", Boolean.valueOf(var2.GL_ARB_fragment_shader)); par1PlayerUsageSnooper.addData("gl_caps[ARB_shader_objects]", Boolean.valueOf(var2.GL_ARB_shader_objects)); par1PlayerUsageSnooper.addData("gl_caps[ARB_vertex_buffer_object]", Boolean.valueOf(var2.GL_ARB_vertex_buffer_object)); par1PlayerUsageSnooper.addData("gl_caps[ARB_framebuffer_object]", Boolean.valueOf(var2.GL_ARB_framebuffer_object)); par1PlayerUsageSnooper.addData("gl_caps[ARB_pixel_buffer_object]", Boolean.valueOf(var2.GL_ARB_pixel_buffer_object)); par1PlayerUsageSnooper.addData("gl_caps[ARB_uniform_buffer_object]", Boolean.valueOf(var2.GL_ARB_uniform_buffer_object)); par1PlayerUsageSnooper.addData("gl_caps[ARB_texture_non_power_of_two]", Boolean.valueOf(var2.GL_ARB_texture_non_power_of_two)); par1PlayerUsageSnooper.addData("gl_caps[gl_max_vertex_uniforms]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_VERTEX_UNIFORM_COMPONENTS))); par1PlayerUsageSnooper.addData("gl_caps[gl_max_fragment_uniforms]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_FRAGMENT_UNIFORM_COMPONENTS))); par1PlayerUsageSnooper.addData("gl_max_texture_size", Integer.valueOf(getGLMaximumTextureSize())); }
public void func_70001_b(PlayerUsageSnooper p_70001_1_) { p_70001_1_.func_76472_a("opengl_version", GL11.glGetString(7938)); p_70001_1_.func_76472_a("opengl_vendor", GL11.glGetString(7936)); p_70001_1_.func_76472_a("client_brand", ClientBrandRetriever.getClientModName()); p_70001_1_.func_76472_a("launched_version", this.field_110447_Z); ContextCapabilities var2 = GLContext.getCapabilities(); p_70001_1_.func_76472_a("gl_caps[ARB_multitexture]", Boolean.valueOf(var2.GL_ARB_multitexture)); p_70001_1_.func_76472_a("gl_caps[ARB_multisample]", Boolean.valueOf(var2.GL_ARB_multisample)); p_70001_1_.func_76472_a("gl_caps[ARB_texture_cube_map]", Boolean.valueOf(var2.GL_ARB_texture_cube_map)); p_70001_1_.func_76472_a("gl_caps[ARB_vertex_blend]", Boolean.valueOf(var2.GL_ARB_vertex_blend)); p_70001_1_.func_76472_a("gl_caps[ARB_matrix_palette]", Boolean.valueOf(var2.GL_ARB_matrix_palette)); p_70001_1_.func_76472_a("gl_caps[ARB_vertex_program]", Boolean.valueOf(var2.GL_ARB_vertex_program)); p_70001_1_.func_76472_a("gl_caps[ARB_vertex_shader]", Boolean.valueOf(var2.GL_ARB_vertex_shader)); p_70001_1_.func_76472_a("gl_caps[ARB_fragment_program]", Boolean.valueOf(var2.GL_ARB_fragment_program)); p_70001_1_.func_76472_a("gl_caps[ARB_fragment_shader]", Boolean.valueOf(var2.GL_ARB_fragment_shader)); p_70001_1_.func_76472_a("gl_caps[ARB_shader_objects]", Boolean.valueOf(var2.GL_ARB_shader_objects)); p_70001_1_.func_76472_a("gl_caps[ARB_vertex_buffer_object]", Boolean.valueOf(var2.GL_ARB_vertex_buffer_object)); p_70001_1_.func_76472_a("gl_caps[ARB_framebuffer_object]", Boolean.valueOf(var2.GL_ARB_framebuffer_object)); p_70001_1_.func_76472_a("gl_caps[ARB_pixel_buffer_object]", Boolean.valueOf(var2.GL_ARB_pixel_buffer_object)); p_70001_1_.func_76472_a("gl_caps[ARB_uniform_buffer_object]", Boolean.valueOf(var2.GL_ARB_uniform_buffer_object)); p_70001_1_.func_76472_a("gl_caps[ARB_texture_non_power_of_two]", Boolean.valueOf(var2.GL_ARB_texture_non_power_of_two)); p_70001_1_.func_76472_a("gl_caps[gl_max_vertex_uniforms]", Integer.valueOf(GL11.glGetInteger('\u8b4a'))); p_70001_1_.func_76472_a("gl_caps[gl_max_fragment_uniforms]", Integer.valueOf(GL11.glGetInteger('\u8b49'))); p_70001_1_.func_76472_a("gl_max_texture_size", Integer.valueOf(func_71369_N())); }
public void setGdxScreenSize(int width, int height){ removeAll(); canvas.getCanvas().setSize(width, height); scrollPane = new JScrollPane(canvas.getCanvas()); scrollPane.setPreferredSize(new Dimension(width, height)); UIUtils.setDrawBorder(scrollPane, false); Style.setScreenSize(scrollPane.getPreferredSize().width, scrollPane.getPreferredSize().height); scrollPane.setPreferredSize(new Dimension(width, height)); centerPanel = new CenterPanel(scrollPane, true, false); centerPanel.setBackground(Color.black); UIUtils.setUndecorated(centerPanel, true); UIUtils.setMargin(centerPanel, new Insets(0,0,0,0)); add(centerPanel); validate(); Style.setScreenPosition(scrollPane.getLocation().x, scrollPane.getLocation().y); canvas.makeCurrent(); try { GLContext.useContext(canvas); } catch (LWJGLException e) { e.printStackTrace(); } }
public void addServerTypeToSnooper(PlayerUsageSnooper par1PlayerUsageSnooper) { par1PlayerUsageSnooper.addData("opengl_version", GL11.glGetString(GL11.GL_VERSION)); par1PlayerUsageSnooper.addData("opengl_vendor", GL11.glGetString(GL11.GL_VENDOR)); par1PlayerUsageSnooper.addData("client_brand", ClientBrandRetriever.getClientModName()); par1PlayerUsageSnooper.addData("launched_version", this.launchedVersion); ContextCapabilities contextcapabilities = GLContext.getCapabilities(); par1PlayerUsageSnooper.addData("gl_caps[ARB_multitexture]", Boolean.valueOf(contextcapabilities.GL_ARB_multitexture)); par1PlayerUsageSnooper.addData("gl_caps[ARB_multisample]", Boolean.valueOf(contextcapabilities.GL_ARB_multisample)); par1PlayerUsageSnooper.addData("gl_caps[ARB_texture_cube_map]", Boolean.valueOf(contextcapabilities.GL_ARB_texture_cube_map)); par1PlayerUsageSnooper.addData("gl_caps[ARB_vertex_blend]", Boolean.valueOf(contextcapabilities.GL_ARB_vertex_blend)); par1PlayerUsageSnooper.addData("gl_caps[ARB_matrix_palette]", Boolean.valueOf(contextcapabilities.GL_ARB_matrix_palette)); par1PlayerUsageSnooper.addData("gl_caps[ARB_vertex_program]", Boolean.valueOf(contextcapabilities.GL_ARB_vertex_program)); par1PlayerUsageSnooper.addData("gl_caps[ARB_vertex_shader]", Boolean.valueOf(contextcapabilities.GL_ARB_vertex_shader)); par1PlayerUsageSnooper.addData("gl_caps[ARB_fragment_program]", Boolean.valueOf(contextcapabilities.GL_ARB_fragment_program)); par1PlayerUsageSnooper.addData("gl_caps[ARB_fragment_shader]", Boolean.valueOf(contextcapabilities.GL_ARB_fragment_shader)); par1PlayerUsageSnooper.addData("gl_caps[ARB_shader_objects]", Boolean.valueOf(contextcapabilities.GL_ARB_shader_objects)); par1PlayerUsageSnooper.addData("gl_caps[ARB_vertex_buffer_object]", Boolean.valueOf(contextcapabilities.GL_ARB_vertex_buffer_object)); par1PlayerUsageSnooper.addData("gl_caps[ARB_framebuffer_object]", Boolean.valueOf(contextcapabilities.GL_ARB_framebuffer_object)); par1PlayerUsageSnooper.addData("gl_caps[ARB_pixel_buffer_object]", Boolean.valueOf(contextcapabilities.GL_ARB_pixel_buffer_object)); par1PlayerUsageSnooper.addData("gl_caps[ARB_uniform_buffer_object]", Boolean.valueOf(contextcapabilities.GL_ARB_uniform_buffer_object)); par1PlayerUsageSnooper.addData("gl_caps[ARB_texture_non_power_of_two]", Boolean.valueOf(contextcapabilities.GL_ARB_texture_non_power_of_two)); par1PlayerUsageSnooper.addData("gl_caps[gl_max_vertex_uniforms]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_VERTEX_UNIFORM_COMPONENTS))); par1PlayerUsageSnooper.addData("gl_caps[gl_max_fragment_uniforms]", Integer.valueOf(GL11.glGetInteger(GL20.GL_MAX_FRAGMENT_UNIFORM_COMPONENTS))); par1PlayerUsageSnooper.addData("gl_max_texture_size", Integer.valueOf(getGLMaximumTextureSize())); }
private static void checkExtensions() { ContextCapabilities c = GLContext.getCapabilities(); if (logger.isInfoEnabled()) { final String[] versionString = new String[] {"4.4","4.3","4.2","4.1","4.0","3.3","3.2","3.1","3.0","2.1","2.0","1.5","1.4","1.3","1.2","1.1"}; final boolean[] versionBool = new boolean[] {c.OpenGL44,c.OpenGL43,c.OpenGL42,c.OpenGL41,c.OpenGL40,c.OpenGL33,c.OpenGL32,c.OpenGL31,c.OpenGL30,c.OpenGL21,c.OpenGL20,c.OpenGL15,c.OpenGL14,c.OpenGL13,c.OpenGL12,c.OpenGL11}; if (versionString.length == versionBool.length) { for (int i = 0; i < versionString.length; i++) { if (versionBool[i]) { logger.info("Supported OpenGL version is " + versionString[i] + "."); break; } } } else { logger.error("versionString.length != versionBool.length"); } } }
private static void throwIfLANotSupported() { if(!GLContext.getCapabilities().OpenGL30) { return; } if(!GLContext.getCapabilities().OpenGL32) { if(!GLContext.getCapabilities().GL_ARB_compatibility) { throw new ImageFormatUnsupportedException("Core OpenGL contexts cannot use Luminance/alpha."); } } else { int profileMask = glGetInteger(GL32.GL_CONTEXT_PROFILE_MASK); if((profileMask & GL32.GL_CONTEXT_CORE_PROFILE_BIT) != 0) { throw new ImageFormatUnsupportedException("Core OpenGL contexts cannot use Luminance/alpha."); } } }
/** * Create a new graphics context around an FBO * * @param image The image we're rendering to * @throws SlickException Indicates a failure to use pbuffers */ public FBOGraphics(Image image) throws SlickException { super(image.getTexture().getTextureWidth(), image.getTexture().getTextureHeight()); this.image = image; Log.debug("Creating FBO "+image.getWidth()+"x"+image.getHeight()); boolean FBOEnabled = GLContext.getCapabilities().GL_EXT_framebuffer_object; if (!FBOEnabled) { throw new SlickException("Your OpenGL card does not support FBO and hence can't handle the dynamic images required for this application."); } init(); }
private static void writeToNewObj(ITexture texture, TextureData image){ Object code=texture.notifyLoading(); Game.glCtx(()->{ if(code!=texture.loadingKey()) return;//another loading process was called, this will have no effect hence it is pointless int id=glGenTextures(); /////////////////////////////////////////// glBindTexture(GL_TEXTURE_2D, id); LogUtil.println(image.data.toString()); glTexImage2D(GL_TEXTURE_2D, 0, image.internalFormat, image.width, image.height, 0, image.format, GL_UNSIGNED_BYTE, image.data); if(mergeParams(texture.params()).get(GL_TEXTURE_MIN_FILTER)!=GL_NEAREST){ glGenerateMipmap(GL_TEXTURE_2D); if(GLContext.getCapabilities().GL_EXT_texture_filter_anisotropic){ float ammount=Math.min(4, glGetFloat(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT)); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, ammount); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_LOD_BIAS, 0); } } CUSTOM_PARAMS.forEach((k, v)->glTexParameteri(GL_TEXTURE_2D, k, v)); glBindTexture(GL_TEXTURE_2D, 0); /////////////////////////////////////////// texture.load(id, image.width, image.height); LogUtil.println("Loaded texture:", texture.getPath()); }); }
private static void checkOpenGlCaps() { log(""); log(getVersion()); log("Build: " + getBuild()); log("OS: " + System.getProperty("os.name") + " (" + System.getProperty("os.arch") + ") version " + System.getProperty("os.version")); log("Java: " + System.getProperty("java.version") + ", " + System.getProperty("java.vendor")); log("VM: " + System.getProperty("java.vm.name") + " (" + System.getProperty("java.vm.info") + "), " + System.getProperty("java.vm.vendor")); log("LWJGL: " + Sys.getVersion()); openGlVersion = GL11.glGetString(GL11.GL_VERSION); openGlRenderer = GL11.glGetString(GL11.GL_RENDERER); openGlVendor = GL11.glGetString(GL11.GL_VENDOR); log("OpenGL: " + openGlRenderer + ", version " + openGlVersion + ", " + openGlVendor); log("OpenGL Version: " + getOpenGlVersionString()); if (!GLContext.getCapabilities().OpenGL12) { log("OpenGL Mipmap levels: Not available (GL12.GL_TEXTURE_MAX_LEVEL)"); } fancyFogAvailable = GLContext.getCapabilities().GL_NV_fog_distance; if (!fancyFogAvailable) { log("OpenGL Fancy fog: Not available (GL_NV_fog_distance)"); } occlusionAvailable = GLContext.getCapabilities().GL_ARB_occlusion_query; if (!occlusionAvailable) { log("OpenGL Occlussion culling: Not available (GL_ARB_occlusion_query)"); } int i = Minecraft.getGLMaximumTextureSize(); dbg("Maximum texture size: " + i + "x" + i); }
public static void applyAnisotropicLevel() { if (GLContext.getCapabilities().GL_EXT_texture_filter_anisotropic) { float f = GL11.glGetFloat(34047); float f1 = (float)Config.getAnisotropicFilterLevel(); f1 = Math.min(f1, f); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, 34046, f1); } }
private static void checkOpenGlCaps() { log(""); log(getVersion()); log("" + new Date()); log("OS: " + System.getProperty("os.name") + " (" + System.getProperty("os.arch") + ") version " + System.getProperty("os.version")); log("Java: " + System.getProperty("java.version") + ", " + System.getProperty("java.vendor")); log("VM: " + System.getProperty("java.vm.name") + " (" + System.getProperty("java.vm.info") + "), " + System.getProperty("java.vm.vendor")); log("LWJGL: " + Sys.getVersion()); openGlVersion = GL11.glGetString(GL11.GL_VERSION); openGlRenderer = GL11.glGetString(GL11.GL_RENDERER); openGlVendor = GL11.glGetString(GL11.GL_VENDOR); log("OpenGL: " + openGlRenderer + ", version " + openGlVersion + ", " + openGlVendor); log("OpenGL Version: " + getOpenGlVersionString()); if (!GLContext.getCapabilities().OpenGL12) { log("OpenGL Mipmap levels: Not available (GL12.GL_TEXTURE_MAX_LEVEL)"); } fancyFogAvailable = GLContext.getCapabilities().GL_NV_fog_distance; if (!fancyFogAvailable) { log("OpenGL Fancy fog: Not available (GL_NV_fog_distance)"); } occlusionAvailable = GLContext.getCapabilities().GL_ARB_occlusion_query; if (!occlusionAvailable) { log("OpenGL Occlussion culling: Not available (GL_ARB_occlusion_query)"); } int i = Minecraft.getGLMaximumTextureSize(); dbg("Maximum texture size: " + i + "x" + i); }