本文整理汇总了Java中org.lwjgl.opengl.ContextCapabilities类的典型用法代码示例。如果您正苦于以下问题:Java ContextCapabilities类的具体用法?Java ContextCapabilities怎么用?Java ContextCapabilities使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContextCapabilities类属于org.lwjgl.opengl包,在下文中一共展示了ContextCapabilities类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: preInit
import org.lwjgl.opengl.ContextCapabilities; //导入依赖的package包/类
@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;
}
示例2: addServerTypeToSnooper
import org.lwjgl.opengl.ContextCapabilities; //导入依赖的package包/类
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()));
}
示例3: initGradient
import org.lwjgl.opengl.ContextCapabilities; //导入依赖的package包/类
/**
* 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);
}
}
}
示例4: checkExtensions
import org.lwjgl.opengl.ContextCapabilities; //导入依赖的package包/类
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");
}
}
}
示例5: func_70001_b
import org.lwjgl.opengl.ContextCapabilities; //导入依赖的package包/类
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()));
}
示例6: addServerTypeToSnooper
import org.lwjgl.opengl.ContextCapabilities; //导入依赖的package包/类
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()));
}
示例7: setup
import org.lwjgl.opengl.ContextCapabilities; //导入依赖的package包/类
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;
}
示例8: init
import org.lwjgl.opengl.ContextCapabilities; //导入依赖的package包/类
/**
* 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.");
}
}
示例9: isFormatSupported
import org.lwjgl.opengl.ContextCapabilities; //导入依赖的package包/类
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;
}
}
示例10: init
import org.lwjgl.opengl.ContextCapabilities; //导入依赖的package包/类
/**
* 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.");
}
}
示例11: initGL
import org.lwjgl.opengl.ContextCapabilities; //导入依赖的package包/类
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");
}
示例12: create
import org.lwjgl.opengl.ContextCapabilities; //导入依赖的package包/类
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
);
}
示例13: RenderStreamPBODefault
import org.lwjgl.opengl.ContextCapabilities; //导入依赖的package包/类
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);
}
示例14: checkCapabilities
import org.lwjgl.opengl.ContextCapabilities; //导入依赖的package包/类
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.");
}
示例15: getRenderStreamImplementations
import org.lwjgl.opengl.ContextCapabilities; //导入依赖的package包/类
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;
}