#include #include #include #include #define WINDSIZEX 100 #define WINDSIZEY 100 void init (void) { int i; GLfloat white[] = { 1.0, 1.0, 1.0, 1.0 }; GLfloat black[] = { 0.0, 0.0, 0.0, 1.0 }; GLfloat red[] = { 1.0, 0.0, 0.0, 1.0 }; GLfloat green[] = { 0.0, 1.0, 0.0, 1.0 }; GLfloat blue[] = { 0.0, 0.0, 1.0, 1.0 }; glClearColor (0.0, 0.0, 0.0, 1.0); glColor4fv (white); gluOrtho2D (0, WINDSIZEX, 0, WINDSIZEY); glDisable (GL_DITHER); } #define TEXSIZE 8 static void test (void) { int i, j; GLuint pb_unpack[1]; GLubyte * pboUnpackMem = NULL; glGenBuffersARB(1, pb_unpack); glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, pb_unpack[0]); glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_EXT, TEXSIZE * TEXSIZE, NULL, GL_STREAM_DRAW); pboUnpackMem = (GLubyte *) glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, GL_WRITE_ONLY); // glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT); glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_EXT, 0); glDeleteBuffersARB(1, pb_unpack); } void display (void) { glViewport (0, 0, WINDSIZEX, WINDSIZEY); glMatrixMode (GL_PROJECTION); glLoadIdentity (); gluOrtho2D (0, WINDSIZEX, 0, WINDSIZEY); glMatrixMode (GL_MODELVIEW); glLoadIdentity (); test (); } int main (int argc, char **argv) { glutInit (&argc, argv); glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); glutInitWindowSize (WINDSIZEX, WINDSIZEY); glutInitWindowPosition (100, 100); glutCreateWindow (argv[0]); init (); glutDisplayFunc (display); glutMainLoop (); return 0; }