Well I’ve been going through the red book awhile and everythings been going ok until I hit page 328. It shows you how an image can be inverted using color tables. the code is shown below.
#include <GL/glut.h>
#include <stdlib.h>
extern GLubyte* readImage(const char*, GLsizei*, GLsizei*);
GLubyte *pixels;
GLsizei width, height;
void init(void)
{
int i;
GLubyte colorTable[256][3];
pixels = readImage("Pic.bmp", &width, &height);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glClearColor(0.0, 0.0, 0.0, 0.0);
glShadeModel(GL_SMOOTH);
for(i = 0; i < 256; ++i)
{
colorTable[i][0] = 255 - i;
colorTable[i][1] = 255 - i;
colorTable[i][2] = 255 - i;
}
:confused: glGetColorTable(GL_COLOR_TABLE, GL_RGB, 256, GL_RGB, GL_UNSIGNED_BYTE, colorTable); :confused:
:confused: glEnable(GL_COLOR_TABLE); :confused:
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glRasterPos2i(3, 3);
glDrawPixels(width, height, GL_RGB, GL_UNSIGNED_BYTE, pixels);
glFlush();
}
I ran the code and it gave two errors. shown here.
error C2065: ‘glGetColorTable’ : undeclared identifier
error C2065: ‘GL_COLOR_TABLE’ : undeclared identifier
They point to where I put the faces. Being new to images I have one idea why its wrong. I heard something about you need to convert the image into somesort of format for open gl to display the image. If thats true you’ll probly see me posting on how to format pictures later. Though I don’t think thats the problem. Anyone care to shed some light on this.
TBOY