hi
It just happened that either binding the png texture as 1d or 2d, it still worked. here are the codes that it generate a very interesting result after apply Nanoha's suggestions.
here is the codes:
void render()
{
GLdouble ds = 4.0f, x = 10.0;
if (once) {
once = false;
clear();
display_splash_screen(MenuID); glFlush();
Sleep(000);
clear();
glPointSize(ds);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, palID);
glBegin(GL_POINTS);
for (int c = 0; c < ss; x += ds, c++) {
glTexCoord2d((GLdouble)(c%ss) / (GLdouble)(ss-1), 0.0);
glVertex2d(x, 600.0);
}
glEnd();
glFlush();
x = 10.0;
glEnable(GL_TEXTURE_1D);
glBindTexture(GL_TEXTURE_1D, palID); // bind to 2d
glBegin(GL_POINTS);
for (GLint c = 0.0; c < ss; x += ds, c++) {
glTexCoord1d((GLdouble) (c%ss)/ (GLdouble) (ss-1));
glVertex2d(x, 700.0);
}
glEnd();
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");
glEnable(GL_TEXTURE_1D);
palID = LoadTexture2D("gradient1.png");
}
and here is the output:
the codes from the above generated the output in the left picture below.
why there are only one row of rainbow? seem like it read the png file row-wised, vertically. strange. when i rotated the png file in photoshop to 90 degree clockwise, i got this output from the right: