/* * call-seq: * pixels -> String * * Return a string of pixel data for the Surface. Most users will not * need to use this method. If you want to convert a Surface into an * OpenGL texture, pass the returned string to the TexImage2D method * of the ruby-opengl library. (See samples/demo_gl_tex.rb for an example.) * * (Please note that the dimensions of OpenGL textures must be powers of 2 * (e.g. 64x128, 512x512), so if you want to use a Surface as an OpenGL * texture, the Surface's dimensions must also be powers of 2!) */ VALUE rbgm_surface_pixels( VALUE self ) { SDL_Surface *surf; Data_Get_Struct(self, SDL_Surface, surf); return rb_str_new(surf->pixels, (long)surf->pitch * surf->h); }