The GL module provides an interface to SDL's OpenGL-related functions, allowing a Rubygame application to create hardware-accelerated 3D graphics with OpenGL.
Please note that Rubygame itself does not provide an interface to OpenGL functions -- only functions which allow Rubygame to work together with OpenGL. You will need to use another library, for example ruby-opengl, to actually create graphics with OpenGL.
Users who wish to use Rubygame Surfaces as textures in OpenGL should see also the Surface#pixels method.
Return the value of the the SDL/OpenGL attribute identified by attrib, which should be one of the constants defined in the Rubygame::GL module. See set_attrib for a list of attribute constants.
This method is useful after using set_attrib and calling Screen#set_mode, to make sure the attribute is the expected value.
# File lib/rubygame/gl.rb, line 45 def self.get_attrib( attrib ) result = SDL.GL_GetAttribute(attrib) if( result.nil? ) raise Rubygame::SDLError, "GL get attribute failed: #{SDL.GetError()}" end end
Set the SDL/OpenGL attribute attrib to value. This should be called before you call Screen#set_mode with the OPENGL flag. You may wish to use get_attrib after calling Screen#set_mode to confirm that the attribute is set to the desired value.
The full list of SDL/OpenGL attribute identifier constants (located under the Rubygame::GL module) is as follows:
Size of framebuffer red component, in bits. | |
Size of framebuffer green component, in bits. | |
Size of framebuffer blue component, in bits. | |
Size of framebuffer alpha (opacity) component, in bits. | |
Size of framebuffer, in bits. | |
Enable or disable double-buffering. | |
Size of depth buffer, in bits. | |
Size of stencil buffer, in bits. | |
Size of accumulation buffer red component, in bits. | |
Size of accumulation buffer green component, in bits. | |
Size of accumulation buffer blue component, in bits. | |
Size of accumulation buffer alpha component, in bits. |
# File lib/rubygame/gl.rb, line 75 def self.set_attrib( attrib, value ) result = SDL.GL_SetAttribute( attrib, value ) if( result == -1 ) raise Rubygame::SDLError, "GL set attribute failed: #{SDL.GetError()}" end end
Generated with the Darkfish Rdoc Generator 2.