I've been searching and reading articles and examples for the past 2 weeks, but no luck.
Could some one please show me a good example of how to use the glDrawPixels Function to display pixels onto the screen with GL_FLOAT and GL_UNSIGNED_BYT E (using unsigned char) or just explain to me what I'm doing wrong. I've pasted my DrawScene Function Below.
Im trying to turn the 100 pixels to red, and display them
Now with GL_UNSIGNED_BYT E
Neither of these work for me. Any Suggestions? Thank you
Could some one please show me a good example of how to use the glDrawPixels Function to display pixels onto the screen with GL_FLOAT and GL_UNSIGNED_BYT E (using unsigned char) or just explain to me what I'm doing wrong. I've pasted my DrawScene Function Below.
Im trying to turn the 100 pixels to red, and display them
Code:
int DrawScene() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); //Here i use the float setup float fPixel[100][4]; for(int x=0; x<100;x++) { fPixel[x][0]=0xff; fPixel[x][1]=0x00; fPixel[x][2]=0x00; fPixel[x][3]=0xff; } glDrawPixels(20, 20, GL_RGBA, GL_FLOAT, fPixel); SwapBuffers(hdc); return 0; }
Code:
int DrawScene() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); unsigned char pixel[100][4] for(int x=0; x<100;x++) { pixel[x][0]=0xff; pixel[x][1]=0x00; pixel[x][2]=0x00; pixel[x][3]=0xff; } glDrawPixels(20, 20, GL_RGBA, GL_UNSIGNED_BYTE, pixel); SwapBuffers(hdc); return 0; }
Comment