Does a texture just fill the object in with copy of the textures like bricks or does it stretch to from each end point?
Does the TexCoord2D, like the start of the texture and the end of the texture or does it have to the coordinates as the object? If it does, then does it have to work with the coordinates of the object? For example, do you start the first TexCoord when you start the first coordinate of the object and does it have to be in order?
Here is my code in full:
static unsigned int texWood;
void init()
{
glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Sets the background color
glShadeModel(GL_FLAT);
glEnable(GL_DEPTH_TEST); // Enable Depth Test
glBindTexture(GL_TEXTURE_2D, texWood);
glEnable(GL_TEXTURE_2D);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glGenTextures(1, &texWood);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, woodWidth, woodHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, wood);
}void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);glBindTexture(GL_TEXTURE_2D, texWood);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 0.0); glVertex3f(-0.5, -0.5, 0.0);
glTexCoord2f(0.0, 1.0); glVertex3f(-0.5, 0.5, 0.0);
glTexCoord2f(1.0, 1.0); glVertex3f(0.0, 0.5, 0.0);
glTexCoord2f(1.0, 0.0); glVertex3f(0.0, -0.5, 0.0);
glEnd();
glDisable(GL_TEXTURE_2D);
//glutSwapBuffers();
glFlush();
}
I’m using single Buffering and I’m also using Visual C++ 6.0. I created the image in the RGBA mode. The image is 8x8 since any higher would take to long. I can display the image using DrawPixels OpenGL function. I can’t apply the texture to an image. All the code I have looked at works fine but it doesn’t seem to like me for some reason.
[This message has been edited by Gold_Dragon (edited 10-06-2003).]