So, I am trying to use glDrawPixels() to draw points on the screen but can’t get it to work properly. Right now it draws the points I want, but then repeats the points in the same position on the y-axis but translated over a few pixels on the x-axis repeatedly.
I am creating a pixel buffer like so:
struct RGBType {
float r;
float g;
float b;
};
RGBType *pixel_buffer = new RGBType[800 * 1200];
Then filling in the rgb components I want to show up on the screen
pixel_buffer[800*y + x].r=0.5;
pixel_buffer[800*y + x].g=0.5;
pixel_buffer[800*y + x].b=0.5;
and then calling drawpixels and swapping the buffers
glDrawPixels(window_width, window_height, GL_RGB, GL_FLOAT, pixel_buffer);
glutSwapBuffers();
delete[] pixel_buffer;
All my other code is simply setting up a window with glut.