Generate texture

I am trying to generate a texture.

When I execute: @texture = glGenTextures(1).first

I get the following error:

[BUG] Bus Error
ruby 1.8.4 (2005-12-24) [i686-darwin8.8.1]

Any help would be great. Thanks.

Tom

Below is a more complete snippet of the code that I am using:

#!/usr/local/bin/ruby

require ‘rubygems’
require ‘opengl’

include Gl
include Glu
include Glut

class GlutTest

def initialize
puts “=== GlutTest.initialize ===”

@texture = glGenTextures(1).first

# Setup the GLUT display loop callback
@display = lambda do
  glClear(Gl::GL_COLOR_BUFFER_BIT | Gl::GL_DEPTH_BUFFER_BIT)

  gluOrtho2D(0.0, 128.0, 0.0, 128.0)

  glutSwapBuffers
end

end

On Oct 4, 12:16 am, Tom [email protected] wrote:

include Glu
@display = lambda do
glClear(Gl::GL_COLOR_BUFFER_BIT | Gl::GL_DEPTH_BUFFER_BIT)

  gluOrtho2D(0.0, 128.0, 0.0, 128.0)

  glutSwapBuffers
end

end

The issue was that the call to generate a texture must be inside of a
glut call back.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs