Class: SDL2::GL::Context
- Inherits:
-
Object
- Object
- SDL2::GL::Context
- Defined in:
- gl.c
Class Method Summary (collapse)
-
+ (SDL2::GL::Context) create(window)
Create an OpenGL context for use with an OpenGL window, and make it current.
-
+ (SDL2::GL::Context?) current
Get the current OpenGL context.
Instance Method Summary (collapse)
-
- (nil) destroy
Delete the OpenGL context.
- - (Boolean) destroy?
-
- (nil) make_current(window)
Set the OpenGL context for rendering into an OpenGL window.
Class Method Details
+ (SDL2::GL::Context) create(window)
40 41 42 43 44 45 46 47 |
# File 'gl.c', line 40
static VALUE GLContext_s_create(VALUE self, VALUE window)
{
SDL_GLContext context = SDL_GL_CreateContext(Get_SDL_Window(window));
if (!context)
SDL_ERROR();
return (current_context = GLContext_new(context));
}
|
+ (SDL2::GL::Context?) current
Get the current OpenGL context.
87 88 89 90 |
# File 'gl.c', line 87
static VALUE GLContext_s_current(VALUE self)
{
return current_context;
}
|
Instance Method Details
- (nil) destroy
Delete the OpenGL context.
56 57 58 59 60 61 62 63 |
# File 'gl.c', line 56
static VALUE GLContext_destroy(VALUE self)
{
GLContext* c = Get_GLContext(self);
if (c->context)
SDL_GL_DeleteContext(c->context);
c->context = NULL;
return Qnil;
}
|
- (Boolean) destroy?
- (nil) make_current(window)
72 73 74 75 76 77 |
# File 'gl.c', line 72
static VALUE GLContext_make_current(VALUE self, VALUE window)
{
HANDLE_ERROR(SDL_GL_MakeCurrent(Get_SDL_Window(window), Get_SDL_GLContext(self)));
current_context = self;
return Qnil;
}
|