[Vala] How to bitwise math and implement a jagged array in Vala?



Dear members I am new here and I have a couple of questions and they are are all centered around this piece of code I found online:

1. /*  Create checkerboard texture  */
2. #define checkImageWidth 64
3. #define checkImageHeight 64
4. static GLubyte checkImage[checkImageHeight][checkImageWidth][4];
5. static GLuint texName;
6. void makeCheckImage(void)
7. {
8.     int i, j, c;
9.
10.     for (i = 0; i < checkImageHeight; i++) {
11.        for (j = 0; j < checkImageWidth; j++) {
12.           c = ((((i&0x8)==0)^((j&0x8))==0))*255;
13.           checkImage[i][j][0] = (GLubyte) c;
14.           checkImage[i][j][1] = (GLubyte) c;
15.           checkImage[i][j][2] = (GLubyte) c;
16.           checkImage[i][j][3] = (GLubyte) 255;
17.        }
18.     }
19. }

1st, How can I do that same thing or equivalent from line #4 in Vala or is it not possible?

2nd. When I try to run line #12 in Vala I get an error "Operation not supported for types bool and bool. So is there a way to get Vala to evaluate this expression correctly?

Any help with this would be greatly appreciated.

Thanks
Tom


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]