Sha256: 68e479cbef144e7340bb2d3f8158ba1d919fef81a82001d7c02b065bba807cff
Contents?: true
Size: 985 Bytes
Versions: 2
Compression:
Stored size: 985 Bytes
Contents
require 'opengl' ERROR_STRINGS = { OpenGL::GL_NO_ERROR => 'NO_ERROR', OpenGL::GL_INVALID_ENUM => 'INVALID_ENUM', OpenGL::GL_INVALID_VALUE => 'INVALID_VALUE', OpenGL::GL_INVALID_OPERATION => 'INVALID_OPERATION', OpenGL::GL_STACK_OVERFLOW => 'STACK_OVERFLOW', OpenGL::GL_STACK_UNDERFLOW => 'STACK_UNDERFLOW', OpenGL::GL_OUT_OF_MEMORY => 'OUT_OF_MEMORY', # OpenGL::GL_TABLE_TOO_LARGE => 'TABLE_TOO_LARGE' } module OpenGLDebug module OpenGLProxy extend OpenGL end def self.load_lib OpenGL.load_lib end OpenGL.constants.each do |c| const_set c, OpenGL.const_get(c) end OpenGL.instance_methods.each do |m| define_method m do |*args| r = OpenGLProxy.send(m, *args) call = "#{m}(#{args.map { |s| s.to_s[0..20] }.join(', ')})" ret = r.nil? ? '' : " => #{r}" puts "#{call}#{ret}" e = OpenGLProxy.glGetError raise "ERROR: #{m} => #{ERROR_STRINGS[e]}" unless e == OpenGL::GL_NO_ERROR r end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mittsu-0.1.1 | lib/mittsu/renderers/opengl/opengl_debug.rb |
mittsu-0.1.0 | lib/mittsu/renderers/opengl/opengl_debug.rb |