Strict Standards: Non-static method phpbb_feed_factory::init() should not be called statically in /home/jacius/rubygame/forums/feed.php on line 66
[phpBB Debug] PHP Notice: in file /feed.php on line 171: Cannot modify header information - headers already sent by (output started at /feed.php:66)
[phpBB Debug] PHP Notice: in file /feed.php on line 172: Cannot modify header information - headers already sent by (output started at /feed.php:66)
Rubygame Forums 2010-10-01T07:45:36+00:00 http://rubygame.org/forums/feed.php?f=5&t=104 2010-10-01T07:45:36+00:00 http://rubygame.org/forums/viewtopic.php?t=104&p=619#p619 <![CDATA[Re: rubygame + ruby-opengl]]>
i've finished it and it works.

thanks for the information guys.

Statistics: Posted by LionKing — Fri Oct 01, 2010 7:45 am


]]>
2010-03-12T05:58:29+00:00 http://rubygame.org/forums/viewtopic.php?t=104&p=435#p435 <![CDATA[Re: rubygame + ruby-opengl]]>

Statistics: Posted by jacius — Fri Mar 12, 2010 5:58 am


]]>
2010-03-11T21:54:23+00:00 http://rubygame.org/forums/viewtopic.php?t=104&p=433#p433 <![CDATA[rubygame + ruby-opengl]]>
Code:
require 'rubygame'

require 'gl'
require 'glu'

include Gl
include Glu

include Rubygame
include Rubygame::Events

class Game

  include EventHandler::HasEventHandler

  def initialize
    init_screen
    init_clock
    init_queue
    init_hooks
    init_gl
  end

  def init_screen
    @screen = Screen.new [800, 600], 0, [HWSURFACE, DOUBLEBUF, OPENGL]
    @screen.title = 'Particles!'
  end

  def init_clock
    @clock = Clock.new
    @clock.target_framerate = 30
  end

  def init_queue
    @queue = EventQueue.new
    @queue.enable_new_style_events
  end

  def init_hooks
    make_magic_hooks :escape => :quit
  end

  def init_gl
    glClearColor 0.0, 0.0, 0.0, 0.0
    resize 800, 600
  end

  def go
    catch :quit do
      loop do
        handle_events
        draw
      end
    end
  end

  def handle_events
    @queue.each do |e|
      handle e
    end
  end

  def resize(w, h)
    h = 1 if h == 0
    glViewport 0, 0, w, h
    glMatrixMode GL_PROJECTION
    glLoadIdentity
    gluPerspective 45.0, w.to_f / h.to_f, 1.0, 1000.0
    glMatrixMode GL_MODELVIEW
  end

  def draw
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
    glMatrixMode GL_MODELVIEW
    glLoadIdentity

    glTranslated 0.0, 0.0, -20.0
    glBegin GL_QUADS
      glVertex2i  5,  5
      glVertex2i -5,  5
      glVertex2i -5, -5
      glVertex2i  5, -5
    glEnd

    GL.swap_buffers
  end

  def quit
    puts 'Quitting!'
    throw :quit
  end

end

Game.new.go
Rubygame.quit

Notes
- In order to get around a NameError, I renamed gl.rb under rubygame to sdl_gl.rb (and the corresponding reference in rubygame.rb:36). Rubygame's gl.rb was getting required by the ruby-opengl gem, instead of the gl.so file.
- The OPENGL flag must be passed to Screen.new

Statistics: Posted by brandon — Thu Mar 11, 2010 9:54 pm


]]>