Dr. Nikolaus Klepp
2005-May-13 06:49 UTC
[fxruby-users] problem with FXMemoryBuffer and OpenGL
Hi!
I just tried to migrate a program fom FOX 1.0 to FOX 1.2 and ran intgo this
problem (ruby 1.8.2):
FXMemoryBuffer::data does not return an array of FXColor, but the same string
I get when I call FXMemoryBuffer::to_s (it''s 33 chars long). Despite
FXMemoryBuffer::[] works and I can access the individual pixels. In
consquence I can''t access the bitmaps and can''t build an
OpenGL texture.
example:
...
img = FXPNGImage.new(@@application, nil, IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP)
...
GL::TexImage2D(GL::TEXTURE_2D,0,GL::RGBA,img.width,img.height,0,GL::RGBA
GL::UNSIGNED_BYTE,img.data.to_s)
...
works using FOX 1.0, fails using FOX 1.2.
Any idea how to solve this?
nik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url :
http://rubyforge.org/pipermail/fxruby-users/attachments/20050513/d59a2ae4/attachment-0001.bin
On May 13, 2005, at 5:55 AM, Dr. Nikolaus Klepp wrote:> I just tried to migrate a program fom FOX 1.0 to FOX 1.2 and ran intgo > this > problem (ruby 1.8.2): > > FXMemoryBuffer::data does not return an array of FXColor, but the same > string > I get when I call FXMemoryBuffer::to_s (it''s 33 chars long). Despite > FXMemoryBuffer::[] works and I can access the individual pixels. In > consquence I can''t access the bitmaps and can''t build an OpenGL > texture.Nik, This sounds like a bug that was fixed in FXRuby 1.2.4 (see http://www.fxruby.org/doc/changes.html). Are you sure you''re using the latest release of FXRuby 1.2? A quick way to check is by typing: ruby -rfox12 -e ''puts Fox.fxrubyversion'' at the command line. If you''re running FXRuby version 1.2.3 or earlier, please upgrade first and then let me know if the problem persists. Hope this helps, Lyle