This repository was archived by the owner on May 31, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathopengl-core.rb
44 lines (36 loc) · 1.45 KB
/
opengl-core.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# This file is part of the opengl-core project.
# <https://github.com/nilium/ruby-opengl>
#
# -----------------------------------------------------------------------------
#
# opengl-core.rb
# Root file for opengl-core -- contains general functions and requires other
# gem sources.
require 'opengl-core/gl-sym'
require 'opengl-core/gl-enums'
require 'opengl-core/gl-commands'
require 'opengl-core/glx-enums'
require 'opengl-core/glx-commands'
require 'opengl-core/wgl-enums'
require 'opengl-core/wgl-commands'
module GL
# Checks if a GL command is availalbe to use. This necessarily loads the
# command if it's not yet loaded just to check if it exists, so do not call
# this from multiple threads when other Gl commands are being loaded. If you
# want to ensure this only reads, you can call load_all_gl_commands! ahead of
# time and query it afterward.
def have_gl_command?(command)
begin ; !!GLSym.load_sym(command.intern) ; rescue NoMethodError ; end
end
# Does what it says on the tin. Should only be called once, preferably from
# the main thread, though I'm not aware of any thread requirements re: symbol
# loading. If you're using Gl commands from multiple threads with multiple
# contexts, you should call this before using any Gl commands.
def load_all_gl_commands!()
GLSym::GL_COMMAND_TYPES.each_key do |fnsym|
begin ; GLSym.load_sym(fnsym) ; rescue NoMethodError ; end
end
self
end
extend self
end # GL