mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
progs/trivial: Make quad-tex-sub repeat patterns
This commit is contained in:
parent
4c460cfd2b
commit
3f17030d9c
1 changed files with 12 additions and 7 deletions
|
|
@ -43,17 +43,17 @@ static void MakeImage()
|
||||||
|
|
||||||
for (s = 0; s < SIZE; s++) {
|
for (s = 0; s < SIZE; s++) {
|
||||||
for (t = 0; t < SIZE; t++) {
|
for (t = 0; t < SIZE; t++) {
|
||||||
tex2d[s][t][0] = s*255/(SIZE-1);
|
tex2d[t][s][0] = s*255/(SIZE-1);
|
||||||
tex2d[s][t][1] = t*255/(SIZE-1);
|
tex2d[t][s][1] = t*255/(SIZE-1);
|
||||||
tex2d[s][t][2] = 0*255/(SIZE-1);
|
tex2d[t][s][2] = 0*255/(SIZE-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB,
|
||||||
SIZE, SIZE,
|
SIZE, SIZE,
|
||||||
0,
|
0,
|
||||||
GL_RGB, GL_UNSIGNED_BYTE, tex2d);
|
GL_RGB, GL_UNSIGNED_BYTE, tex2d);
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
}
|
}
|
||||||
|
|
@ -61,14 +61,19 @@ static void MakeImage()
|
||||||
static void UpdateLine()
|
static void UpdateLine()
|
||||||
{
|
{
|
||||||
GLubyte tex[SIZE][3];
|
GLubyte tex[SIZE][3];
|
||||||
|
GLubyte b = 0;
|
||||||
GLint s, t;
|
GLint s, t;
|
||||||
|
|
||||||
t = line % SIZE;
|
t = line % SIZE;
|
||||||
|
if (line % (SIZE * 2) < SIZE)
|
||||||
|
b = 255;
|
||||||
|
else
|
||||||
|
b = 0;
|
||||||
|
|
||||||
for (s = 0; s < SIZE; s++) {
|
for (s = 0; s < SIZE; s++) {
|
||||||
tex[s][0] = s*255/(SIZE-1);
|
tex[s][0] = s*255/(SIZE-1);
|
||||||
tex[s][1] = t*255/(SIZE-1);
|
tex[s][1] = t*255/(SIZE-1);
|
||||||
tex[s][2] = 255;
|
tex[s][2] = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue