Module: SDL2::GL
- Defined in:
- gl.c,
gl.c
Overview
This module provides the initialize/shutdown functions of OpenGL.
Defined Under Namespace
Classes: Context
Constant Summary collapse
- RED_SIZE =
Returns index for OpenGL attribute - minimal bits of red channel in color buffer, default is 3.
INT2NUM(SDL_GL_RED_SIZE)
- GREEN_SIZE =
Returns index for OpenGL attribute - minimal bits of green channel in color buffer, default is 3.
INT2NUM(SDL_GL_GREEN_SIZE)
- BLUE_SIZE =
Returns index for OpenGL attribute - minimal bits of blue channel in color buffer, default is 2.
INT2NUM(SDL_GL_BLUE_SIZE)
- ALPHA_SIZE =
Returns index for OpenGL attribute - minimal bits of alpha channel in color buffer, default is 0.
INT2NUM(SDL_GL_ALPHA_SIZE)
- BUFFER_SIZE =
Returns index for OpenGL attribute - minimal bits of framebufer, default is 0.
INT2NUM(SDL_GL_BUFFER_SIZE)
- DOUBLEBUFFER =
Returns index for OpenGL attribute - whether the single buffer (0) or double buffer (1), default is double buffer.
INT2NUM(SDL_GL_DOUBLEBUFFER)
- DEPTH_SIZE =
Returns index for OpenGL attribute - bits of depth buffer, default is 16.
INT2NUM(SDL_GL_DEPTH_SIZE)
- STENCIL_SIZE =
Returns index for OpenGL attribute - bits of stencil buffer, default is 0.
INT2NUM(SDL_GL_STENCIL_SIZE)
- ACCUM_RED_SIZE =
Returns index for OpenGL attribute - minimal bits of red channel in accumlation buffer, default is 0.
INT2NUM(SDL_GL_ACCUM_RED_SIZE)
- ACCUM_GREEN_SIZE =
Returns index for OpenGL attribute - minimal bits of green channel in accumlation buffer, default is 0.
INT2NUM(SDL_GL_ACCUM_GREEN_SIZE)
- ACCUM_BLUE_SIZE =
Returns index for OpenGL attribute - minimal bits of blue channel in accumlation buffer, default is 0.
INT2NUM(SDL_GL_ACCUM_BLUE_SIZE)
- ACCUM_ALPHA_SIZE =
Returns index for OpenGL attribute - minimal bits of alpha channel in accumlation buffer, default is 0.
INT2NUM(SDL_GL_ACCUM_ALPHA_SIZE)
- STEREO =
Returns index for OpenGL attribute - whether output is stereo (1) or not (0), default is 0.
INT2NUM(SDL_GL_STEREO)
- MULTISAMPLEBUFFERS =
Returns index for OpenGL attribuite - the number of buffers used for multisampe anti-aliasing, default is 0.
INT2NUM(SDL_GL_MULTISAMPLEBUFFERS)
- MULTISAMPLESAMPLES =
Returns index for OpenGL attribute - the number of samples used around the current pixel use for multisample anti-aliasing, default is 0.
INT2NUM(SDL_GL_MULTISAMPLESAMPLES)
- ACCELERATED_VISUAL =
Returns index for OpenGL attribute - 1 for requiring hardware acceleration, 0 for software rendering, default is allowing either.
INT2NUM(SDL_GL_ACCELERATED_VISUAL)
- RETAINED_BACKING =
Returns index for OpenGL attribute - not used (deprecated).
INT2NUM(SDL_GL_RETAINED_BACKING)
- CONTEXT_MAJOR_VERSION =
Returns index for OpenGL attribute - OpenGL context major version.
INT2NUM(SDL_GL_CONTEXT_MAJOR_VERSION)
- CONTEXT_MINOR_VERSION =
Returns index for OpenGL attribute - OpenGL context minor version.
INT2NUM(SDL_GL_CONTEXT_MINOR_VERSION)
- CONTEXT_FLAGS =
default is 0
These flags are mapped to some OpenGL extensions. Please see the documentation of each constant for more details.
INT2NUM(SDL_GL_CONTEXT_FLAGS)
- CONTEXT_PROFILE_MASK =
defaults depends on platform
INT2NUM(SDL_GL_CONTEXT_PROFILE_MASK)
- SHARE_WITH_CURRENT_CONTEXT =
Returns index for OpenGL attribute - OpenGL context sharing, default is 0.
INT2NUM(SDL_GL_SHARE_WITH_CURRENT_CONTEXT)
- FRAMEBUFFER_SRGB_CAPABLE =
Returns index for OpenGL attribute - 1 for requesting sRGB capable visual, default to 0.
INT2NUM(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE)
- CONTEXT_EGL =
Returns index for OpenGL attribute - not used (deprecated).
INT2NUM(SDL_GL_CONTEXT_EGL)
- CONTEXT_DEBUG_FLAG =
Returns This flag maps to GLX_CONTEXT_DEBUG_BIT_ARB in the GLX_ARB_create_context extension for X11 and WGL_CONTEXT_DEBUG_BIT_ARB in the WGL_ARB_create_context extension for Windows.
INT2NUM(SDL_GL_CONTEXT_DEBUG_FLAG)
- CONTEXT_FORWARD_COMPATIBLE_FLAG =
Returns This flag maps to GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB in the GLX_ARB_create_context extension for X11 and WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB in the WGL_ARB_create_context extension for Windows.
INT2NUM(SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG)
- CONTEXT_ROBUST_ACCESS_FLAG =
Returns This flag maps to GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB in the GLX_ARB_create_context_robustness extension for X11 and WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB in the WGL_ARB_create_context_robustness extension for Windows.
INT2NUM(SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG)
- CONTEXT_RESET_ISOLATION_FLAG =
Returns This flag maps to GLX_CONTEXT_RESET_ISOLATION_BIT_ARB in the GLX_ARB_robustness_isolation extension for X11 and WGL_CONTEXT_RESET_ISOLATION_BIT_ARB in the WGL_ARB_create_context_robustness extension for Windows.
INT2NUM(SDL_GL_CONTEXT_RESET_ISOLATION_FLAG)
- CONTEXT_PROFILE_CORE =
Returns OpenGL core profile - deprecated functions are disabled.
INT2NUM(SDL_GL_CONTEXT_PROFILE_CORE)
- CONTEXT_PROFILE_COMPATIBILITY =
Returns OpenGL compatibility profile - deprecated functions are allowed.
INT2NUM(SDL_GL_CONTEXT_PROFILE_COMPATIBILITY)
- CONTEXT_PROFILE_ES =
Returns OpenGL ES profile - only a subset of the base OpenGL functionality is available.
INT2NUM(SDL_GL_CONTEXT_PROFILE_ES)
Class Method Summary collapse
-
.extension_supported?(extension) ⇒ Boolean
Return true if the current context supports extension.
-
.get_attribute(attr) ⇒ Integer
Get the acutal value for an attribute from current context.
-
.set_attribute(attr, value) ⇒ void
Set an OpenGL window attribute before window creation.
-
.swap_interval ⇒ Integer
Get the state of swap interval of the current context.
-
.swap_interval=(interval) ⇒ nil
Set the state of swap interval of the current context.
Class Method Details
.extension_supported?(extension) ⇒ Boolean
139 140 141 142 |
# File 'gl.c', line 139
static VALUE GL_s_extension_supported_p(VALUE self, VALUE extension)
{
return INT2BOOL(SDL_GL_ExtensionSupported(StringValueCStr(extension)));
}
|
.get_attribute(attr) ⇒ Integer
183 184 185 186 187 188 |
# File 'gl.c', line 183
static VALUE GL_s_get_attribute(VALUE self, VALUE attr)
{
int value;
HANDLE_ERROR(SDL_GL_GetAttribute(NUM2INT(attr), &value));
return INT2NUM(value);
}
|
.set_attribute(attr, value) ⇒ void
198 199 200 201 202 |
# File 'gl.c', line 198
static VALUE GL_s_set_attribute(VALUE self, VALUE attr, VALUE value)
{
HANDLE_ERROR(SDL_GL_SetAttribute(NUM2INT(attr), NUM2INT(value)));
return value;
}
|
.swap_interval ⇒ Integer
Get the state of swap interval of the current context.
153 154 155 156 |
# File 'gl.c', line 153
static VALUE GL_s_swap_interval(VALUE self)
{
return INT2NUM(SDL_GL_GetSwapInterval());
}
|
.swap_interval=(interval) ⇒ nil
170 171 172 173 174 |
# File 'gl.c', line 170
static VALUE GL_s_set_swap_interval(VALUE self, VALUE interval)
{
HANDLE_ERROR(SDL_GL_SetSwapInterval(NUM2INT(interval)));
return Qnil;
}
|