All pastes #818301 Raw Edit

Untitled

public text v1 · immutable
·published 2007-12-16 05:59 UTC
rendered paste body
#include <stdio.h>
#include <math.h>

int main(int argc, char **argv) {
        int *vertices;
        float *colors;
        int width = atoi(argv[1]);
        int height = atoi(argv[2]);
        vertices = malloc((height * width * 2) * sizeof(int) + 1);
        int x, y, i = 0;
        for(x = 0; x < width; x++) {
                for(y = 0; y < height; y++) {
                        vertices[i++] = x;
                        vertices[i++] = y;
                }
        }
        colors = malloc((height * width * 3) * sizeof(float) + 1);
        i = 0;
        for(x = 0; x < width; x++) {
                  for(y = 0; y < height; y++) {
                                float temp = 1;
                                colors[i++] = temp;
                                colors[i++] = temp;
                                colors[i++] = temp;
                        }
                }
        for(i = 0, x = 0; i < (height * width); i++ )
                printf("%d, %d : %f %f %f\n", vertices[x++], vertices[x++], colors[y++], colors[y++], colors[y++]);
}