I use the library at http://partow.net/programming/bitmap/index.html and OpenGL to make the function of loading a bitmap on my screen. The image is loading, but it only displays black, white, and yellow. I am using Dev C ++ on Windows 7. Here is my code:
void Load_Image(HDC hDC, string File_Name, int x_position, int y_position, int length, int height)
{
bitmap_image image(File_Name);
unsigned char red;
unsigned char green;
unsigned char blue;
restart:
image.get_pixel(x_position, y_position, red, green, blue);
glBegin (GL_TRIANGLES);
glColor3f (red, green, blue);
glVertex2f (-1 + 0.0015 * x_position, 1 - 0.003 * y_position);
glVertex2f (-1 + 0.0015 * x_position, 0.997 - 0.003 * y_position);
glVertex2f (-0.9985 + 0.0015 * x_position, 1 - 0.003 * y_position);
glEnd();
glBegin (GL_TRIANGLES);
glColor3f (red, green, blue);
glVertex2f (-1 + 0.0015 * x_position, 0.997 - 0.003 * y_position);
glVertex2f (-0.9985 + 0.0015 * x_position, 1 - 0.003 * y_position);
glVertex2f (-0.9985 + 0.0015 * x_position, 0.997 - 0.003 * y_position);
glEnd();
if (x_position==length)
{
if (y_position==height)
{
goto done;
}
x_position = 0;
y_position = y_position + 1;
}
x_position = x_position + 1;
goto restart;
done:
SwapBuffers(hDC);
}
Any ideas on what's wrong? Thanks!
wdt12 source
share