Hi,
I have a program as attached. My purpose is to test glRasterPos. It turns out the result at
http://www.geocities.com/shaobin_tao/glRasterPos.bmp
is wrong. According to the docs, I should get the right pixels instead of the left one. Am I mistaken? Thanks very much for your help.
#ifdef WIN32
#include <windows.h>
#endif
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
GLubyte fire[8] = { 0xff, 0xff, 0xff,0xff, 0xff, 0xff, 0xff, 0xff };
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 0.0, 0.0);
glRasterPos2f(8.0,8.0);
glBitmap( 8, 8, 0, 0, 20, 20, fire );
glFlush();
}
void myinit (void)
{
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
}
void myReshape(GLsizei w, GLsizei h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0, w, 0, h);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
int main(int argc, char** argv)
{
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB );
glutInitWindowPosition (0, 0);
glutInitWindowSize(100,100);
glutCreateWindow(argv[0]);
myinit();
glutReshapeFunc(myReshape);
glutDisplayFunc(display);
glutMainLoop();
return 0;
}