Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: Jigggz zzzz
RE: Any way to extract raw data from image (bmp) [ reply ]  
2009-06-19 20:33
It gives this error when I don't try to use the .pack on the image->rawdata:


C:/Users/Me/Desktop/Ruby/nehe_lesson07.rb:33:in `glTexImage2D': wrong argument type DL::PtrData (expected String) (TypeError)
from C:/Users/Me/Desktop/Ruby/nehe_lesson07.rb:33:in `loadGLTextures'
from C:/Users/Me/Desktop/Ruby/nehe_lesson07.rb:42:in `init_gl_window'
from C:/Users/Me/Desktop/Ruby/nehe_lesson07.rb:171
Complete(1)

By: Jigggz zzzz
RE: Any way to extract raw data from image (bmp) [ reply ]  
2009-06-19 20:30
So I think you use image->rawdata ?

How would I change (cast) the image->rawdata into a string thats native to Ruby?

ie:

myImage = Pikl::Image.open("NeHe.bmp")
rawdata = myImage.rawdata.pack("f*")

Right now Ruby gives me this error:

C:/Users/Me/Desktop/Ruby/nehe_lesson07.rb:29:in `loadGLTextures': undefined method `pack' for #<DL::PtrData:0x4b03ec0 ptr=0x5030d70 size=0 free=0x0> (NoMethodError)
from C:/Users/Me/Desktop/Ruby/nehe_lesson07.rb:42:in `init_gl_window'
from C:/Users/Me/Desktop/Ruby/nehe_lesson07.rb:171
Complete(1)

By: Jigggz zzzz
Any way to extract raw data from image (bmp) [ reply ]  
2009-06-19 20:06
Hi,

I would like to extract the raw data of the image after it has been loaded into memory by Pikl.

I'm trying to load the data into OpenGL, which needs a pointer to the raw pixels.


Is there any way to do this?


Thank you!

- just a student