class OpenGL::TestCase
Constants
- WINDOW_SIZE
Public Instance Methods
assert_each_in_delta(expected, actual, epsilon = 0.01)
click to toggle source
# File lib/opengl/test_case.rb, line 72 def assert_each_in_delta expected, actual, epsilon = 0.01 assert_equal expected.length, actual.length, 'array lengths do not match' expected.flatten.zip(actual.flatten).each_with_index do |(e, a), i| assert_in_delta e, a, epsilon, "element #{i}" end end
setup()
click to toggle source
# File lib/opengl/test_case.rb, line 44 def setup glutInitWindowPosition 1, 1 glutInitWindowSize WINDOW_SIZE, WINDOW_SIZE @window = glutCreateWindow "test" glPushAttrib GL_ALL_ATTRIB_BITS glPushClientAttrib GL_CLIENT_ALL_ATTRIB_BITS glMatrixMode GL_MODELVIEW glLoadIdentity glMatrixMode GL_PROJECTION glLoadIdentity glClearColor 0, 0, 0, 0 glClear GL_COLOR_BUFFER_BIT end
supported?(funcs)
click to toggle source
# File lib/opengl/test_case.rb, line 80 def supported? funcs Array(funcs).each do |name| # convert to array if it isn't already skip "#{name} is not supported" unless Gl.is_available? name end end
teardown()
click to toggle source
# File lib/opengl/test_case.rb, line 60 def teardown glPopAttrib glPopClientAttrib glRenderMode GL_RENDER # in case there is an GL error that escaped error checking routines ... error = glGetError assert_equal 0, error, gluErrorString(error) glutDestroyWindow @window end