PDA

View Full Version : Texturing



hoganh
11-29-2003, 07:05 AM
Does anybody know how i can get my image into opengl.Iv set my code up as follows
GLuint TexID;

GLubyte *data;

void init_drawing(void)
{....
//Generate the texture
glGenTextures(1, &TexID);
glBindTexture(GL_TEXTURE_2D, TexID);
glTexImage2D(GL_TEXTURE_2D, 0, 3, 64, 64,
0, GL_RGB, GL_UNSIGNED_BYTE, data);
}

mdog1234
12-01-2003, 09:47 AM
does it not work? in your draw code rember to put glBindTExture(GL_TEXTURE_2D, ID);

hoganh
12-01-2003, 10:03 AM
This the only code i have in.I was just wondering what is the next step.How to load in an image?
I know then i would use
glTexCoord2f( )
glVertex3f( )
to draw the image i think

soconne
12-01-2003, 10:32 AM
Well *data needs to contain the data for the bitmap. Either learn how to load BMP files or TGA files, they're the easiest ones.