From: Srimal J. <sr...@gm...> - 2009-07-27 00:07:23
|
Hi I'm new to mesa(and OpenGL) . I need to get the pixel values of whats rendered on screen (window) to a text file for an Image Recognition Application. First I tried to just print the values on screen using this code: GLvoid* data; data = (GLvoid *) malloc (1024*768); glReadPixels (0,0,1024,768,GL_RED, GL_UNSIGNED_BYTE, data); for(int i=0; i<1024*768; i++) cout << data[i]; free(data); But it gives this error: $ make g++ -Wall -o render main.cpp -lglut main.cpp: In function ‘void drawScene()’: main.cpp:154: error: pointer of type ‘void *’ used in arithmetic main.cpp:154: error: ‘GLvoid*’ is not a pointer-to-object type make: *** [render] Error 1 Am I missing something here? Is there a better way to do this? Thanks in advance Srimal. ~ Srimal Jayawardena BSc (Engineering), BIT, MIET PhD Student, Australian National University. Phone(Offilce): 0011 612 6125 1771 Phone(Home): 0011 612 6125 5413 ANU Contact Info : http://arp.anu.edu.au/user/3788 http://srimal.sri-lankan.net/ http://srimal-techdiary.blogspot.com/ |