org.lwjgl.opengl.ContextCapabilities Java Examples
The following examples show how to use
org.lwjgl.opengl.ContextCapabilities.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CurveRenderState.java From opsu with GNU General Public License v3.0 | 6 votes |
/** * 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); } } }
Example #2
Source File: FramebufferBlitter.java From OpenModsLib with MIT License | 6 votes |
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; }
Example #3
Source File: Curve.java From opsu-dance with GNU General Public License v3.0 | 5 votes |
/** * Init curves for given circle diameter * Should be called before any curves are drawn. * @param circleDiameter the circle diameter * @param borderColor the curve border color */ public static void init(float circleDiameter, Color borderColor) { Curve.borderColor = borderColor; ContextCapabilities capabilities = GLContext.getCapabilities(); mmsliderSupported = capabilities.OpenGL30; if (mmsliderSupported) { CurveRenderState.init(circleDiameter); } else if (SkinService.skin.getSliderStyle() != Skin.STYLE_PEPPYSLIDER) { Log.warn("New slider style requires OpenGL 3.0."); } }
Example #4
Source File: Curve.java From opsu with GNU General Public License v3.0 | 5 votes |
/** * 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."); } }
Example #5
Source File: TextureUtil.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
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; } }
Example #6
Source File: ShaderHelper.java From OpenModsLib with MIT License | 4 votes |
static void initialize() { ContextCapabilities caps = GLContext.getCapabilities(); if (GL20ShaderMethods.isSupported(caps)) methods = new GL20ShaderMethods(); else if (ARBShaderMethods.isSupported(caps)) methods = new ARBShaderMethods(); }
Example #7
Source File: ShaderHelper.java From OpenModsLib with MIT License | 4 votes |
public static boolean isSupported(ContextCapabilities caps) { return caps.OpenGL20; }
Example #8
Source File: ShaderHelper.java From OpenModsLib with MIT License | 4 votes |
public static boolean isSupported(ContextCapabilities caps) { return caps.GL_ARB_shader_objects && caps.GL_ARB_vertex_shader && caps.GL_ARB_fragment_shader; }
Example #9
Source File: ArraysHelper.java From OpenModsLib with MIT License | 4 votes |
static void initialize() { ContextCapabilities caps = GLContext.getCapabilities(); if (GLArrayMethods.isSupported(caps)) methods = new GLArrayMethods(); else if (ARBArrayMethods.isSupported(caps)) methods = new ARBArrayMethods(); }
Example #10
Source File: ArraysHelper.java From OpenModsLib with MIT License | 4 votes |
public static boolean isSupported(ContextCapabilities caps) { return caps.OpenGL33; }
Example #11
Source File: ArraysHelper.java From OpenModsLib with MIT License | 4 votes |
public static boolean isSupported(ContextCapabilities caps) { return caps.GL_ARB_instanced_arrays && caps.GL_ARB_vertex_array_object; }
Example #12
Source File: BufferHelper.java From OpenModsLib with MIT License | 4 votes |
static void initialize() { ContextCapabilities caps = GLContext.getCapabilities(); if (GLBufferMethods.isSupported(caps)) methods = new GLBufferMethods(); else if (ARBBufferMethods.isSupported(caps)) methods = new ARBBufferMethods(); }
Example #13
Source File: BufferHelper.java From OpenModsLib with MIT License | 4 votes |
public static boolean isSupported(ContextCapabilities caps) { return caps.OpenGL15; }
Example #14
Source File: BufferHelper.java From OpenModsLib with MIT License | 4 votes |
public static boolean isSupported(ContextCapabilities caps) { return caps.OpenGL15; }