<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>samples/demo_gl_tex.rb</filename>
    </added>
    <added>
      <filename>samples/ruby.png</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -595,6 +595,26 @@ VALUE rbgm_surface_getat( int argc, VALUE *argv, VALUE self )
 	return rb_ary_new3(4,INT2NUM(r),INT2NUM(g),INT2NUM(b),INT2NUM(a));
 }
 
+/*
+ *  call-seq:
+ *    pixels  -&gt;  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-&gt;pixels, (long)surf-&gt;pitch * surf-&gt;h);
+}
+
 void Rubygame_Init_Surface()
 {
 
@@ -621,4 +641,5 @@ void Rubygame_Init_Surface()
 	rb_define_method(cSurface,&quot;blit&quot;,rbgm_surface_blit,-1);
 	rb_define_method(cSurface,&quot;fill&quot;,rbgm_surface_fill,-1);
 	rb_define_method(cSurface,&quot;get_at&quot;,rbgm_surface_getat,-1);
+  rb_define_method(cSurface,&quot;pixels&quot;,rbgm_surface_pixels,0);
 }</diff>
      <filename>ext/rubygame/rubygame_surface.c</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>abd565bd3f9099a73d9f8620dd9591cfde2550f0</id>
    </parent>
  </parents>
  <author>
    <name>John Croisant</name>
    <email>jacius@gmail.com</email>
  </author>
  <url>http://github.com/jacius/rubygame/commit/d30188ac7b4c2536e2c5b6f491e8ae7db9e80b7e</url>
  <id>d30188ac7b4c2536e2c5b6f491e8ae7db9e80b7e</id>
  <committed-date>2006-01-15T18:20:37-08:00</committed-date>
  <authored-date>2006-01-15T18:20:37-08:00</authored-date>
  <message>- surface.c: Add Surface#pixels method (and docs) to retrieve pixel data.
- demo_gl_tex.rb: Adapted demo_gl.rb to demonstrate using Rubygame Surfaces as
  OpenGL textures.
- ruby.png: Sample texture for demo_gl_tex.rb</message>
  <tree>acdf72c8ff496afa1a20798378d51dee03e5d91c</tree>
  <committer>
    <name>John Croisant</name>
    <email>jacius@gmail.com</email>
  </committer>
</commit>
