On Tue, 2013-07-02 at 18:49 -0500, Thomas F Steinhauer wrote:
> I tried your code as you suggested however that did not work. I guess 
> the real question that I am asking here is has anyone successfully 
> generated a Checker board type texture with OpenGL and Vala and 
> displayed it on a cube or square. That is the code that I really need. 
> It seems that because Vala does not supported "jagged" arrays that this 
> is not possible or did I miss something in the reading somewhere?

Yes.  For one thing, there is no reason this needs to be a jagged array.
The C example isn't.  The part of the tutorial I linked to explains the
difference.

Here is everything together.  I've changed GL.ubyte to uint8 because it
was more convenient (I don't get an opengl vapi), but s/uint8/GL.ubyte/
and it should be exactly what you're after.


private static uint8[,,]
make_check_image (int width = 64, int height = 64) {
  uint8[,,] check_image = new uint8[height,width,4];

  for ( var i = 0 ; i < height ; i++ ) {
    for ( var j = 0 ; j < width ; j++ ) {
      uint8 c = (((uint8)((i&0x8)==0))^((uint8)((j&0x8)==0)))*255;
      check_image[i,j,0] = c;
      check_image[i,j,1] = c;
      check_image[i,j,2] = c;
      check_image[i,j,3] = 255;
    }
  }

  return check_image;
}


-Evan

_______________________________________________
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to