aboutsummaryrefslogtreecommitdiff
path: root/tests/sdl_gl_read.c
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-02-25 19:23:56 -0500
committerAlon Zakai <alonzakai@gmail.com>2013-02-25 19:23:56 -0500
commit230c0e80dfcd44870bec3254c399db430f6e1d98 (patch)
tree745ec3b082adc222050b4d48a416d7a969dd148d /tests/sdl_gl_read.c
parent5a99d2567e76f257309cfd225876f3a5402e5f46 (diff)
parent9d4ef477a511ae4136c2d63e0150a4768cbd53ea (diff)
Merge branch 'incoming'
Conflicts: AUTHORS
Diffstat (limited to 'tests/sdl_gl_read.c')
-rw-r--r--tests/sdl_gl_read.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/sdl_gl_read.c b/tests/sdl_gl_read.c
index 552eb8c0..d752f94d 100644
--- a/tests/sdl_gl_read.c
+++ b/tests/sdl_gl_read.c
@@ -6,6 +6,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <assert.h>
GLuint programObject;
int width = 512;
@@ -118,8 +119,14 @@ void Draw ()
}
void Verify() {
- unsigned char *data = malloc(width*height*4);
+ unsigned char *data = malloc(width*height*4 + 16);
+ int *last = (int*)(data + width*height*4 - 4);
+ int *after = (int*)(data + width*height*4);
+ *last = 0xdeadbeef;
+ *after = 0x12345678;
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, data);
+ assert(*last != 0xdeadbeef); // should overwrite the buffer to the end
+ assert(*after == 0x12345678); // nothing should be written afterwards!
// Should see some blue, and nothing else
int seen = 0;
int ok = 1;