int x = 100;
int y = 100;
int width = 250;
int height = 250;
int border = 10;
int top = y + border;
int bottom = y + height;
int left = x + border;
int right = x + width;
static int vertices[] = {
x, y, //0
right, y, //1
right, bottom, //2
x, bottom, //3
left, top, //4
right - border, top, //5
right - border, bottom - border, //6
left, bottom - border, //7
left, top + (height - border - border) * 0.5,
right - border, top + (height - border - border) * 0.5
};
static unsigned int indices[] = {
0, 1, 4, 5, //top border
5, 1, 6, 2, //right border
2, 6, 3, 7, //bottom border
7, 4, 3, 0, //left border
4, 5, 8, 9,
8, 9, 7, 6,
};
static unsigned char colors[] = {
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0x00, 0x00, 0x00,
0xff, 0x00, 0x00,
0xff, 0x00, 0x00,
0xff, 0x00, 0x00,
0xff, 0x00, 0x00,
0x00, 0xff, 0x00,
0x00, 0xff, 0x00,
0x00, 0xff, 0x00,
0x00, 0xff, 0x00,
0x00, 0x00, 0xff,
0x00, 0x00, 0xff,
0x00, 0x00, 0xff,
0x00, 0x00, 0xff,
};
我当前不需要的输出:
在这种实现中是否可以在单个四边形上应用单一颜色?