summaryrefslogtreecommitdiff
path: root/progs/tests
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@vmware.com>2009-08-05 00:57:08 +0200
committerRoland Scheidegger <sroland@vmware.com>2009-08-05 01:13:21 +0200
commit0abc9e7565bfa0f1f32e6999f93ca14b718c7974 (patch)
tree4733c3fb87641d00b6c0c4ce3a0caa9d6741594b /progs/tests
parentde80eeea0eebf00ee678b1a0fbd5fe67b00a8636 (diff)
tests: also test xoffset in texcompsub test
use glCompressedTexSubImage2DARB also with xoffset by splitting into 3 calls in total. Dunno if the top/bottom reversal is intentional but leave as is.
Diffstat (limited to 'progs/tests')
-rw-r--r--progs/tests/texcompsub.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/progs/tests/texcompsub.c b/progs/tests/texcompsub.c
index 79a5f958a1..50106bf1e2 100644
--- a/progs/tests/texcompsub.c
+++ b/progs/tests/texcompsub.c
@@ -6,6 +6,7 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <GL/glew.h>
#include <GL/glut.h>
@@ -31,6 +32,8 @@ CheckError(int line)
static void
LoadCompressedImage(void)
{
+ unsigned char ImgDataTemp[ImgSize / 4];
+ unsigned i;
const GLenum filter = GL_LINEAR;
glTexImage2D(Target, 0, CompFormat, ImgWidth, ImgHeight, 0,
GL_RGB, GL_UNSIGNED_BYTE, NULL);
@@ -40,11 +43,24 @@ LoadCompressedImage(void)
0, 0, /* pos */
ImgWidth, ImgHeight / 2,
CompFormat, ImgSize / 2, ImgData + ImgSize / 2);
- /* top half */
+
+ /* top left */
+ for (i = 0; i < ImgHeight / 8; i++) {
+ memcpy(&ImgDataTemp[i * ImgWidth], &ImgData[i * 2 * ImgWidth], ImgWidth);
+ }
glCompressedTexSubImage2DARB(Target, 0,
0, ImgHeight / 2, /* pos */
- ImgWidth, ImgHeight / 2,
- CompFormat, ImgSize / 2, ImgData);
+ ImgWidth / 2, ImgHeight / 2,
+ CompFormat, ImgSize / 4, ImgDataTemp);
+
+ /* top right */
+ for (i = 0; i < ImgHeight / 8; i++) {
+ memcpy(&ImgDataTemp[i * ImgWidth], &ImgData[i * 2 * ImgWidth + ImgWidth], ImgWidth);
+ }
+ glCompressedTexSubImage2DARB(Target, 0,
+ ImgWidth / 2, ImgHeight / 2, /* pos */
+ ImgWidth / 2, ImgHeight / 2,
+ CompFormat, ImgSize / 4, ImgDataTemp);
glTexParameteri(Target, GL_TEXTURE_MIN_FILTER, filter);
glTexParameteri(Target, GL_TEXTURE_MAG_FILTER, filter);