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_BYTE (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
Expand|Select|Wrap|Line Numbers
- 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;
- }
Expand|Select|Wrap|Line Numbers
- 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;
- }