hi
When my program ran, it produced the following image. note how the red line at the bottom of the image, it is suppose to be something difference. the texture is a 16x16 pixel image as shown below. I guess the glTexcoord2i() did not work properly, I mean something need to take care of before it.
the relevant codes are:
void plotDot(GLint x, GLint y, int c)
{
glTexCoord2i(c%16, c/16);
glBegin(GL_POINTS);
glVertex2i(x, y);
glEnd();
}
void winReshapeFcn(GLint newWidth, GLint newHeight)
{ // doesnot allow window size change
glutReshapeWindow(sizeX, sizeY);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(l, r, b, t);
glMatrixMode(GL_MODELVIEW);
}
void render()
{
double ds = 4.0, x = 10.0;
if (once) {
once = false;
display_splash_screen(MenuID);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, palID);
glPointSize(ds); // for debug
for (int c = 0; c < ss; x += ds, c++) {
plotDot((int)x, 700, c);
}
glFlush();
}
}
void init()
{
glDisable(GL_CULL_FACE);
glDisable(GL_DEPTH_TEST);
glShadeModel(GL_SMOOTH);
glEnable(GL_TEXTURE_2D);
buttonsID = LoadTexture2D("buttonsandwait.png");
MenuID = LoadTexture2D("fractals_screen.png");
palID = LoadTexture2D("gradient1.png");
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGBA);
glutInitWindowSize(sizeX, sizeY);
glutCreateWindow("Testing Program");
init();
glutIgnoreKeyRepeat(1);
glutReshapeFunc(winReshapeFcn);
glutDisplayFunc(render);
glutMainLoop();
cleanup();
return 0;
}