summaryrefslogtreecommitdiff
path: root/progs/demos/streaming_rect.c
diff options
context:
space:
mode:
Diffstat (limited to 'progs/demos/streaming_rect.c')
-rw-r--r--progs/demos/streaming_rect.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/progs/demos/streaming_rect.c b/progs/demos/streaming_rect.c
index 86e00803c0..4c1d8535fd 100644
--- a/progs/demos/streaming_rect.c
+++ b/progs/demos/streaming_rect.c
@@ -1,13 +1,9 @@
-
/*
- * GL_ARB_multitexture demo
+ * GL_ARB_pixel_buffer_object test
*
* Command line options:
- * -info print GL implementation information
- *
+ * -w WIDTH -h HEIGHT sets window size
*
- * Brian Paul November 1998 This program is in the public domain.
- * Modified on 12 Feb 2002 for > 2 texture units.
*/
#define GL_GLEXT_PROTOTYPES
@@ -25,6 +21,8 @@
#define PBO 11
#define QUIT 100
+static GLuint DrawPBO;
+
static GLboolean Animate = GL_TRUE;
static GLboolean use_pbo = 1;
static GLboolean whole_rect = 1;
@@ -49,7 +47,7 @@ static void Idle( void )
}
}
-static int max( int a, int b ) { return a > b ? a : b; }
+/*static int max( int a, int b ) { return a > b ? a : b; }*/
static int min( int a, int b ) { return a < b ? a : b; }
static void DrawObject()
@@ -62,6 +60,7 @@ static void DrawObject()
* release the old copy of the texture and allocate a new one
* without waiting for outstanding rendering to complete.
*/
+ glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, DrawPBO);
glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_EXT, size, NULL, GL_STREAM_DRAW_ARB);
{
@@ -69,7 +68,7 @@ static void DrawObject()
printf("char %d\n", (unsigned char)(Drift * 255));
- memset(image, size, (unsigned char)(Drift * 255));
+ memset(image, (unsigned char)(Drift * 255), size);
glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT);
}
@@ -86,7 +85,9 @@ static void DrawObject()
if (image == NULL)
image = malloc(size);
- memset(image, size, (unsigned char)(Drift * 255));
+ glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, 0);
+
+ memset(image, (unsigned char)(Drift * 255), size);
/* BGRA should be the fast path for regular uploads as well.
*/
@@ -227,12 +228,12 @@ static void SpecialKey( int key, int x, int y )
static void Init( int argc, char *argv[] )
{
const char *exten = (const char *) glGetString(GL_EXTENSIONS);
- GLuint texObj, DrawPBO;
+ GLuint texObj;
GLint size;
- if (!strstr(exten, "GL_ARB_multitexture")) {
- printf("Sorry, GL_ARB_multitexture not supported by this renderer.\n");
+ if (!strstr(exten, "GL_ARB_pixel_buffer_object")) {
+ printf("Sorry, GL_ARB_pixel_buffer_object not supported by this renderer.\n");
exit(1);
}