yoggy #6816(2008/07/23 20:45 GMT) [ Other ] Rating0/0=0.00
see: Ruby/SDL
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
require 'sdl' require 'opengl' vertices = [ [[1.0, 0.0, 0.0], [-1.0, -1.0, 0.0]], [[0.0, 1.0, 0.0], [ 1.0, -1.0, 0.0]], [[0.0, 0.0, 1.0], [ 1.0, 1.0, 0.0]], [[1.0, 1.0, 1.0], [-1.0, 1.0, 0.0]] ] SDL.init(SDL::INIT_VIDEO) SDL::Screen.open(600, 600, 16, SDL::OPENGL) GL.ClearColor(0.0, 0.0, 0.2, 1.0); GL::Ortho(-2.0, 2.0, -2.0, 2.0, -2.0, 2.0) GL::MatrixMode(GL::MODELVIEW); loop { GL.Clear(GL::COLOR_BUFFER_BIT); GL::Rotate(1.0, 2.0, 3.0, 1.0); GL::Begin(GL::QUADS) vertices.each {|v| GL::Color(v[0]) GL::Vertex(v[1]) } GL::End() SDL::GL.swap_buffers evt = SDL::Event.poll case evt when SDL::Event::Quit exit when SDL::Event::KeyUp exit if evt.sym == SDL::Key::ESCAPE end }
Rating0/0=0.00-0+
[ reply ]
yoggy
#6816()
[
Other
]
Rating0/0=0.00
see: Ruby/SDL
require 'sdl' require 'opengl' vertices = [ [[1.0, 0.0, 0.0], [-1.0, -1.0, 0.0]], [[0.0, 1.0, 0.0], [ 1.0, -1.0, 0.0]], [[0.0, 0.0, 1.0], [ 1.0, 1.0, 0.0]], [[1.0, 1.0, 1.0], [-1.0, 1.0, 0.0]] ] SDL.init(SDL::INIT_VIDEO) SDL::Screen.open(600, 600, 16, SDL::OPENGL) GL.ClearColor(0.0, 0.0, 0.2, 1.0); GL::Ortho(-2.0, 2.0, -2.0, 2.0, -2.0, 2.0) GL::MatrixMode(GL::MODELVIEW); loop { GL.Clear(GL::COLOR_BUFFER_BIT); GL::Rotate(1.0, 2.0, 3.0, 1.0); GL::Begin(GL::QUADS) vertices.each {|v| GL::Color(v[0]) GL::Vertex(v[1]) } GL::End() SDL::GL.swap_buffers evt = SDL::Event.poll case evt when SDL::Event::Quit exit when SDL::Event::KeyUp exit if evt.sym == SDL::Key::ESCAPE end }Rating0/0=0.00-0+
[ reply ]