summaryrefslogtreecommitdiffstats
path: root/progs/tests
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-10-24 11:08:01 -0600
committerBrian Paul <[email protected]>2009-10-24 11:08:01 -0600
commit51bc12d62338ad1874c437d692e1182c0bf3d4cd (patch)
tree14d53df725fd341777cbc9d87973b274f2673490 /progs/tests
parentbee6794eb126bc8af87726a2456d0ebc36eb721d (diff)
progs/tests: fix sub texture offsets
Diffstat (limited to 'progs/tests')
-rw-r--r--progs/tests/texcompsub.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/progs/tests/texcompsub.c b/progs/tests/texcompsub.c
index 50106bf1e22..215f5711d95 100644
--- a/progs/tests/texcompsub.c
+++ b/progs/tests/texcompsub.c
@@ -35,6 +35,8 @@ LoadCompressedImage(void)
unsigned char ImgDataTemp[ImgSize / 4];
unsigned i;
const GLenum filter = GL_LINEAR;
+ const int half = ImgSize / 2;
+
glTexImage2D(Target, 0, CompFormat, ImgWidth, ImgHeight, 0,
GL_RGB, GL_UNSIGNED_BYTE, NULL);
@@ -42,11 +44,11 @@ LoadCompressedImage(void)
glCompressedTexSubImage2DARB(Target, 0,
0, 0, /* pos */
ImgWidth, ImgHeight / 2,
- CompFormat, ImgSize / 2, ImgData + ImgSize / 2);
+ CompFormat, ImgSize / 2, ImgData /*+ ImgSize / 2*/);
/* top left */
for (i = 0; i < ImgHeight / 8; i++) {
- memcpy(&ImgDataTemp[i * ImgWidth], &ImgData[i * 2 * ImgWidth], ImgWidth);
+ memcpy(&ImgDataTemp[i * ImgWidth], &ImgData[half + i * 2 * ImgWidth], ImgWidth);
}
glCompressedTexSubImage2DARB(Target, 0,
0, ImgHeight / 2, /* pos */
@@ -55,7 +57,7 @@ LoadCompressedImage(void)
/* top right */
for (i = 0; i < ImgHeight / 8; i++) {
- memcpy(&ImgDataTemp[i * ImgWidth], &ImgData[i * 2 * ImgWidth + ImgWidth], ImgWidth);
+ memcpy(&ImgDataTemp[i * ImgWidth], &ImgData[half + i * 2 * ImgWidth + ImgWidth], ImgWidth);
}
glCompressedTexSubImage2DARB(Target, 0,
ImgWidth / 2, ImgHeight / 2, /* pos */