Java 类org.lwjgl.opengl.ContextCapabilities 实例源码

项目:animated-texture-fix    文件:AnimfixModContainer.java   
@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;
}
项目:Resilience-Client-Source    文件:Minecraft.java   
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()));
}
项目:opsu    文件:CurveRenderState.java   
/**
 * Reads the first row of the slider gradient texture and upload it as
 * a 1D texture to OpenGL if it hasn't already been done.
 */
public void initGradient() {
    if (gradientTexture == 0) {
        Image slider = GameImage.SLIDER_GRADIENT.getImage().getScaledCopy(1.0f / GameImage.getUIscale());
        staticState.gradientTexture = GL11.glGenTextures();
        ByteBuffer buff = BufferUtils.createByteBuffer(slider.getWidth() * 4);
        for (int i = 0; i < slider.getWidth(); ++i) {
            Color col = slider.getColor(i, 0);
            buff.put((byte) (255 * col.r));
            buff.put((byte) (255 * col.g));
            buff.put((byte) (255 * col.b));
            buff.put((byte) (255 * col.a));
        }
        buff.flip();
        GL11.glBindTexture(GL11.GL_TEXTURE_1D, gradientTexture);
        GL11.glTexImage1D(GL11.GL_TEXTURE_1D, 0, GL11.GL_RGBA, slider.getWidth(), 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, buff);
        ContextCapabilities capabilities = GLContext.getCapabilities();
        if (capabilities.OpenGL30) {
            GL30.glGenerateMipmap(GL11.GL_TEXTURE_1D);
        } else if (capabilities.GL_EXT_framebuffer_object) {
            EXTFramebufferObject.glGenerateMipmapEXT(GL11.GL_TEXTURE_1D);
        } else {
            GL11.glTexParameteri(GL11.GL_TEXTURE_1D, GL14.GL_GENERATE_MIPMAP, GL11.GL_TRUE);
        }
    }
}
项目:Wicken    文件:RenderSystem.java   
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");
        }
    }
}
项目:RuneCraftery    文件:Minecraft.java   
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()));
}
项目:RuneCraftery    文件:Minecraft.java   
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()));
}
项目:BetterNutritionMod    文件:Minecraft.java   
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()));
}
项目:OpenModsLib    文件:FramebufferBlitter.java   
public static boolean setup() {
    if (OpenGlHelper.framebufferSupported) {
        final ContextCapabilities caps = GLContext.getCapabilities();

        if (caps.OpenGL30) {
            Log.debug("Using OpenGL 3.0 FB blit");
            INSTANCE = new GL30Impl();
            return true;
        }

        if (caps.GL_EXT_framebuffer_blit) {
            Log.debug("Using EXT FB blit");
            INSTANCE = new ExtImpl();
            return true;
        }
    }

    Log.debug("FB blit not supported");
    return false;
}
项目:opsu-dance    文件:Curve.java   
/**
 * Set the width and height of the container that Curves get drawn into.
 * Should be called before any curves are drawn.
 * @param width the container width
 * @param height the container height
 * @param circleDiameter the circle diameter
 * @param borderColor the curve border color
 */
public static void init(int width, int height, float circleDiameter, Color borderColor) {
    Curve.borderColor = borderColor;

    ContextCapabilities capabilities = GLContext.getCapabilities();
    mmsliderSupported = capabilities.OpenGL30;
    if (mmsliderSupported) {
        CurveRenderState.init(width, height, circleDiameter);
    } else if (SkinService.skin.getSliderStyle() != Skin.STYLE_PEPPYSLIDER) {
        Log.warn("New slider style requires OpenGL 3.0.");
    }
}
项目:PhET    文件:TextureUtil.java   
private static boolean isFormatSupported(Format fmt, ContextCapabilities caps){
    switch (fmt){
        case ARGB4444:
            return false;
        case BGR8:
            return caps.OpenGL12 || caps.GL_EXT_bgra;
        case DXT1:
        case DXT1A:
        case DXT3:
        case DXT5:
            return caps.GL_EXT_texture_compression_s3tc;
        case Depth:
        case Depth16:
        case Depth24:
        case Depth32:
            return caps.OpenGL14 || caps.GL_ARB_depth_texture;
        case Depth32F:
        case Luminance16F:
        case Luminance16FAlpha16F:
        case Luminance32F:
        case RGBA16F:
        case RGBA32F:
            return caps.OpenGL30 || caps.GL_ARB_texture_float;
        case LATC:
        case LTC:
            return caps.GL_EXT_texture_compression_latc;
        case RGB9E5:
        case RGB16F_to_RGB9E5:
            return caps.OpenGL30 || caps.GL_EXT_texture_shared_exponent;
        case RGB111110F:
        case RGB16F_to_RGB111110F:
            return caps.OpenGL30 || caps.GL_EXT_packed_float;
        default:
            return true;
    }
}
项目:opsu    文件:Curve.java   
/**
 * Set the width and height of the container that Curves get drawn into.
 * Should be called before any curves are drawn.
 * @param width the container width
 * @param height the container height
 * @param circleDiameter the circle diameter
 * @param borderColor the curve border color
 */
public static void init(int width, int height, float circleDiameter, Color borderColor) {
    Curve.borderColor = borderColor;

    ContextCapabilities capabilities = GLContext.getCapabilities();
    mmsliderSupported = capabilities.OpenGL30;
    if (mmsliderSupported) {
        CurveRenderState.init(width, height, circleDiameter);
        LegacyCurveRenderState.init(width, height, circleDiameter);
    } else {
        if (Options.getSkin().getSliderStyle() != Skin.STYLE_PEPPYSLIDER)
            Log.warn("New slider style requires OpenGL 3.0.");
    }
}
项目:Lime    文件:Window.java   
public static void initGL()
{
    Lime.LOGGER.F("Checking GL context capabilities");
    GLContext context = GLContext.createFromCurrent();
    ContextCapabilities capabilities = context.getCapabilities();

    if (!capabilities.GL_EXT_framebuffer_object)
    {
        Lime.LOGGER.C("GL_XBT_framebuffer_object not supported");
        throw new IllegalStateException("GL context not capable: GL_XBT_framebuffer_object");
    }

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f);

    glMatrixMode(GL_MODELVIEW);
    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

    glEnable(GL_TEXTURE_2D);

    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    updateViewport();

    Lime.LOGGER.F("GL initialized");
}
项目:cnctools    文件:RenderStreamPBODefault.java   
public RenderStream create(final StreamHandler handler, final int samples, final int transfersToBuffer) {
    final ContextCapabilities caps = GLContext.getCapabilities();

    return new RenderStreamPBODefault(
        handler, samples, transfersToBuffer,
        // Detect NVIDIA and use GetTexImage instead of ReadPixels
        StreamUtil.isNVIDIA(caps) ? ReadbackType.GET_TEX_IMAGE : ReadbackType.READ_PIXELS
    );
}
项目:cnctools    文件:RenderStreamPBODefault.java   
RenderStreamPBODefault(final StreamHandler handler, final int samples, final int transfersToBuffer, final ReadbackType readbackType) {
    super(handler, samples, transfersToBuffer, readbackType);

    final ContextCapabilities caps = GLContext.getCapabilities();

    USE_COPY_BUFFER_SUB_DATA = (caps.OpenGL31 || caps.GL_ARB_copy_buffer) &&
                               // Disable on ATI/AMD GPUs: ARB_copy_buffer is unoptimized on current
                               // drivers and kills performance. TODO: Fix?
                               !StreamUtil.isAMD(caps);
}
项目:cnctools    文件:StreamUtil.java   
private static void checkCapabilities(final ContextCapabilities caps) {
    if ( !caps.OpenGL15 )
        throw new UnsupportedOperationException("Support for OpenGL 1.5 or higher is required.");

    if ( !(caps.OpenGL20 || caps.GL_ARB_texture_non_power_of_two) )
        throw new UnsupportedOperationException("Support for npot textures is required.");

    if ( !(caps.OpenGL30 || caps.GL_ARB_framebuffer_object || caps.GL_EXT_framebuffer_object) )
        throw new UnsupportedOperationException("Framebuffer object support is required.");
}
项目:cnctools    文件:StreamUtil.java   
public static List<RenderStreamFactory> getRenderStreamImplementations() {
    final ContextCapabilities caps = GLContext.getCapabilities();

    checkCapabilities(caps);

    final List<RenderStreamFactory> list = new ArrayList<RenderStreamFactory>();

    addIfSupported(caps, list, RenderStreamPBOAMD.FACTORY);
    addIfSupported(caps, list, RenderStreamPBOCopy.FACTORY);
    addIfSupported(caps, list, RenderStreamINTEL.FACTORY);
    addIfSupported(caps, list, RenderStreamPBODefault.FACTORY);

    return list;
}
项目:cnctools    文件:StreamUtil.java   
static int checkSamples(final int samples, final ContextCapabilities caps) {
    if ( samples <= 1 )
        return samples;

    if ( !(caps.OpenGL30 || (caps.GL_EXT_framebuffer_multisample && caps.GL_EXT_framebuffer_blit)) )
        throw new UnsupportedOperationException("Multisampled rendering on framebuffer objects is not supported.");

    return Math.min(samples, glGetInteger(GL_MAX_SAMPLES));
}
项目:cnctools    文件:RenderStreamPBOCopy.java   
public boolean isSupported(final ContextCapabilities caps) {
    return RenderStreamPBODefault.FACTORY.isSupported(caps)
           && caps.GL_ARB_copy_buffer
           && caps.GL_NV_gpu_program5 // Nvidia only
           && (caps.OpenGL40 || caps.GL_ARB_tessellation_shader) // Fermi+
        ;
}
项目:MikuMikuStudio    文件:TextureUtil.java   
private static boolean isFormatSupported(Format fmt, ContextCapabilities caps){
    switch (fmt){
        case ARGB4444:
            return false;
        case BGR8:
            return caps.OpenGL12 || caps.GL_EXT_bgra;
        case DXT1:
        case DXT1A:
        case DXT3:
        case DXT5:
            return caps.GL_EXT_texture_compression_s3tc;
        case Depth:
        case Depth16:
        case Depth24:
        case Depth32:
            return caps.OpenGL14 || caps.GL_ARB_depth_texture;
        case Depth32F:
        case Luminance16F:
        case Luminance16FAlpha16F:
        case Luminance32F:
        case RGBA16F:
        case RGBA32F:
            return caps.OpenGL30 || caps.GL_ARB_texture_float;
        case LATC:
        case LTC:
            return caps.GL_EXT_texture_compression_latc;
        case RGB9E5:
        case RGB16F_to_RGB9E5:
            return caps.OpenGL30 || caps.GL_EXT_texture_shared_exponent;
        case RGB111110F:
        case RGB16F_to_RGB111110F:
            return caps.OpenGL30 || caps.GL_EXT_packed_float;
        default:
            return true;
    }
}
项目:CodeChickenLib    文件:OpenGLUtils.java   
public static void loadCaps() {
    ContextCapabilities caps = GLContext.getCapabilities();
    openGL20 = caps.OpenGL20;
    openGL32 = caps.OpenGL32;
    openGL40 = caps.OpenGL40;
}
项目:Wolf_game    文件:SpriteShootoutCL.java   
private void initGL() throws LWJGLException {
    Display.setLocation((Display.getDisplayMode().getWidth() - SCREEN_WIDTH) / 2,
                        (Display.getDisplayMode().getHeight() - SCREEN_HEIGHT) / 2);
    Display.setDisplayMode(new DisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT));
    Display.setTitle("Sprite Shootout - CL");
    Display.create();

    final ContextCapabilities caps = GLContext.getCapabilities();
    if ( !caps.OpenGL20 )
        throw new RuntimeException("OpenGL 2.0 is required for this demo.");

    // Setup viewport

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, SCREEN_WIDTH, 0, SCREEN_HEIGHT, -1.0, 1.0);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);

    glClearColor(1.0f, 1.0f, 1.0f, 0.0f);

    // Create textures

    try {
        texSmallID = createTexture("res/ball_sm.png");
        texBigID = createTexture("res/ball.png");
    } catch (IOException e) {
        e.printStackTrace();
        System.exit(-1);
    }
    texID = texBigID;

    // Setup rendering state

    glEnable(GL_BLEND);
    glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);

    glEnable(GL_ALPHA_TEST);
    glAlphaFunc(GL_GREATER, 0.0f);

    glColorMask(colorMask, colorMask, colorMask, false);
    glDepthMask(false);
    glDisable(GL_DEPTH_TEST);

    if ( caps.GL_ARB_compatibility || !caps.OpenGL31 )
        glEnable(GL_POINT_SPRITE);

    // Setup geometry

    org.lwjgl.opengl.Util.checkGLError();
}
项目:GPVM    文件:SpriteShootoutCL.java   
private void initGL() throws LWJGLException {
    Display.setLocation((Display.getDisplayMode().getWidth() - SCREEN_WIDTH) / 2,
                        (Display.getDisplayMode().getHeight() - SCREEN_HEIGHT) / 2);
    Display.setDisplayMode(new DisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT));
    Display.setTitle("Sprite Shootout - CL");
    Display.create();

    final ContextCapabilities caps = GLContext.getCapabilities();
    if ( !caps.OpenGL20 )
        throw new RuntimeException("OpenGL 2.0 is required for this demo.");

    // Setup viewport

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, SCREEN_WIDTH, 0, SCREEN_HEIGHT, -1.0, 1.0);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);

    glClearColor(1.0f, 1.0f, 1.0f, 0.0f);

    // Create textures

    try {
        texSmallID = createTexture("res/ball_sm.png");
        texBigID = createTexture("res/ball.png");
    } catch (IOException e) {
        e.printStackTrace();
        System.exit(-1);
    }
    texID = texBigID;

    // Setup rendering state

    glEnable(GL_BLEND);
    glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);

    glEnable(GL_ALPHA_TEST);
    glAlphaFunc(GL_GREATER, 0.0f);

    glColorMask(colorMask, colorMask, colorMask, false);
    glDepthMask(false);
    glDisable(GL_DEPTH_TEST);

    if ( caps.GL_ARB_compatibility || !caps.OpenGL31 )
        glEnable(GL_POINT_SPRITE);

    // Setup geometry

    org.lwjgl.opengl.Util.checkGLError();
}
项目:GPVM    文件:SpriteShootoutCL.java   
private void initGL() throws LWJGLException {
    Display.setLocation((Display.getDisplayMode().getWidth() - SCREEN_WIDTH) / 2,
                        (Display.getDisplayMode().getHeight() - SCREEN_HEIGHT) / 2);
    Display.setDisplayMode(new DisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT));
    Display.setTitle("Sprite Shootout - CL");
    Display.create();

    final ContextCapabilities caps = GLContext.getCapabilities();
    if ( !caps.OpenGL20 )
        throw new RuntimeException("OpenGL 2.0 is required for this demo.");

    // Setup viewport

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, SCREEN_WIDTH, 0, SCREEN_HEIGHT, -1.0, 1.0);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);

    glClearColor(1.0f, 1.0f, 1.0f, 0.0f);

    // Create textures

    try {
        texSmallID = createTexture("res/ball_sm.png");
        texBigID = createTexture("res/ball.png");
    } catch (IOException e) {
        e.printStackTrace();
        System.exit(-1);
    }
    texID = texBigID;

    // Setup rendering state

    glEnable(GL_BLEND);
    glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);

    glEnable(GL_ALPHA_TEST);
    glAlphaFunc(GL_GREATER, 0.0f);

    glColorMask(colorMask, colorMask, colorMask, false);
    glDepthMask(false);
    glDisable(GL_DEPTH_TEST);

    if ( caps.GL_ARB_compatibility || !caps.OpenGL31 )
        glEnable(GL_POINT_SPRITE);

    // Setup geometry

    org.lwjgl.opengl.Util.checkGLError();
}
项目:SpaceStationAlpha    文件:SpriteShootoutCL.java   
private void initGL() throws LWJGLException {
    Display.setLocation((Display.getDisplayMode().getWidth() - SCREEN_WIDTH) / 2,
                        (Display.getDisplayMode().getHeight() - SCREEN_HEIGHT) / 2);
    Display.setDisplayMode(new DisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT));
    Display.setTitle("Sprite Shootout - CL");
    Display.create();

    final ContextCapabilities caps = GLContext.getCapabilities();
    if ( !caps.OpenGL20 )
        throw new RuntimeException("OpenGL 2.0 is required for this demo.");

    // Setup viewport

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, SCREEN_WIDTH, 0, SCREEN_HEIGHT, -1.0, 1.0);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);

    glClearColor(1.0f, 1.0f, 1.0f, 0.0f);

    // Create textures

    try {
        texSmallID = createTexture("res/ball_sm.png");
        texBigID = createTexture("res/ball.png");
    } catch (IOException e) {
        e.printStackTrace();
        System.exit(-1);
    }
    texID = texBigID;

    // Setup rendering state

    glEnable(GL_BLEND);
    glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);

    glEnable(GL_ALPHA_TEST);
    glAlphaFunc(GL_GREATER, 0.0f);

    glColorMask(colorMask, colorMask, colorMask, false);
    glDepthMask(false);
    glDisable(GL_DEPTH_TEST);

    if ( caps.GL_ARB_compatibility || !caps.OpenGL31 )
        glEnable(GL_POINT_SPRITE);

    // Setup geometry

    org.lwjgl.opengl.Util.checkGLError();
}
项目:TeacherSmash    文件:SpriteShootoutCL.java   
private void initGL() throws LWJGLException {
    Display.setLocation((Display.getDisplayMode().getWidth() - SCREEN_WIDTH) / 2,
                        (Display.getDisplayMode().getHeight() - SCREEN_HEIGHT) / 2);
    Display.setDisplayMode(new DisplayMode(SCREEN_WIDTH, SCREEN_HEIGHT));
    Display.setTitle("Sprite Shootout - CL");
    Display.create();

    final ContextCapabilities caps = GLContext.getCapabilities();
    if ( !caps.OpenGL20 )
        throw new RuntimeException("OpenGL 2.0 is required for this demo.");

    // Setup viewport

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, SCREEN_WIDTH, 0, SCREEN_HEIGHT, -1.0, 1.0);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glViewport(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);

    glClearColor(1.0f, 1.0f, 1.0f, 0.0f);

    // Create textures

    try {
        texSmallID = createTexture("res/ball_sm.png");
        texBigID = createTexture("res/ball.png");
    } catch (IOException e) {
        e.printStackTrace();
        System.exit(-1);
    }
    texID = texBigID;

    // Setup rendering state

    glEnable(GL_BLEND);
    glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);

    glEnable(GL_ALPHA_TEST);
    glAlphaFunc(GL_GREATER, 0.0f);

    glColorMask(colorMask, colorMask, colorMask, false);
    glDepthMask(false);
    glDisable(GL_DEPTH_TEST);

    if ( caps.GL_ARB_compatibility || !caps.OpenGL31 )
        glEnable(GL_POINT_SPRITE);

    // Setup geometry

    org.lwjgl.opengl.Util.checkGLError();
}
项目:cnctools    文件:RenderStreamPBODefault.java   
public boolean isSupported(final ContextCapabilities caps) {
    return caps.OpenGL21 || caps.GL_ARB_pixel_buffer_object || caps.GL_EXT_pixel_buffer_object;
}
项目:cnctools    文件:StreamUtil.java   
static boolean isAMD(final ContextCapabilities caps) {
    return caps.GL_ATI_fragment_shader || caps.GL_ATI_texture_compression_3dc || caps.GL_AMD_debug_output;
}
项目:cnctools    文件:StreamUtil.java   
static boolean isNVIDIA(final ContextCapabilities caps) {
    return caps.GL_NV_vertex_program || caps.GL_NV_register_combiners || caps.GL_NV_gpu_program4;
}
项目:cnctools    文件:StreamUtil.java   
private static <T extends StreamFactory<?>> void addIfSupported(final ContextCapabilities caps, final List<T> list, final T factory) {
    if ( factory.isSupported(caps) )
        list.add(factory);
}
项目:cnctools    文件:TextureStreamINTEL.java   
public boolean isSupported(final ContextCapabilities caps) {
    // TODO: We currently require BlitFramebuffer. Relax and implement manually?
    return caps.GL_INTEL_map_texture && (caps.OpenGL30 || caps.GL_ARB_framebuffer_object || caps.GL_EXT_framebuffer_blit);
}
项目:cnctools    文件:TextureStreamPBODefault.java   
public boolean isSupported(final ContextCapabilities caps) {
    return caps.OpenGL21 || caps.GL_ARB_pixel_buffer_object || caps.GL_EXT_pixel_buffer_object;
}
项目:cnctools    文件:TextureStreamPBORange.java   
public boolean isSupported(final ContextCapabilities caps) {
    return TextureStreamPBODefault.FACTORY.isSupported(caps) && (caps.OpenGL30 || caps.GL_ARB_map_buffer_range);
}
项目:cnctools    文件:RenderStreamPBOAMD.java   
public boolean isSupported(final ContextCapabilities caps) {
    return TextureStreamPBODefault.FACTORY.isSupported(caps) && caps.GL_AMD_pinned_memory && (caps.OpenGL32 || caps.GL_ARB_sync);
}
项目:cnctools    文件:RenderStreamINTEL.java   
public boolean isSupported(final ContextCapabilities caps) {
    // TODO: We currently require BlitFramebuffer. Relax and implement manually?
    return caps.GL_INTEL_map_texture && (caps.OpenGL30 || caps.GL_ARB_framebuffer_object || caps.GL_EXT_framebuffer_blit);
}
项目:cnctools    文件:RenderStreamINTEL.java   
RenderStreamINTEL(final StreamHandler handler, final int samples, final int transfersToBuffer) {
    super(handler, transfersToBuffer);

    final ContextCapabilities caps = GLContext.getCapabilities();

    this.strideBuffer = BufferUtils.createIntBuffer(1);
    this.layoutBuffer = BufferUtils.createIntBuffer(1);

    fboUtil = StreamUtil.getFBOUtil(caps);
    renderFBO = fboUtil.genFramebuffers();

    resolveFBO = fboUtil.genFramebuffers();
    resolveBuffers = new int[transfersToBuffer];

    this.samples = StreamUtil.checkSamples(samples, caps);
}
项目:OpenModsLib    文件:ShaderHelper.java   
static void initialize() {
    ContextCapabilities caps = GLContext.getCapabilities();

    if (GL20ShaderMethods.isSupported(caps)) methods = new GL20ShaderMethods();
    else if (ARBShaderMethods.isSupported(caps)) methods = new ARBShaderMethods();
}
项目:OpenModsLib    文件:ShaderHelper.java   
public static boolean isSupported(ContextCapabilities caps) {
    return caps.OpenGL20;
}
项目:OpenModsLib    文件:ShaderHelper.java   
public static boolean isSupported(ContextCapabilities caps) {
    return caps.GL_ARB_shader_objects && caps.GL_ARB_vertex_shader && caps.GL_ARB_fragment_shader;
}
项目:OpenModsLib    文件:ArraysHelper.java   
static void initialize() {
    ContextCapabilities caps = GLContext.getCapabilities();
    if (GLArrayMethods.isSupported(caps)) methods = new GLArrayMethods();
    else if (ARBArrayMethods.isSupported(caps)) methods = new ARBArrayMethods();
}
项目:OpenModsLib    文件:ArraysHelper.java   
public static boolean isSupported(ContextCapabilities caps) {
    return caps.OpenGL33;
}