Advertisement

texture rotated by 45deg when applied:-(

Started by December 16, 2001 10:30 AM
0 comments, last by Kiroke 23 years, 2 months ago
hi all ! tell me if im becoming annoying with my questions:-) I''ve been searching for about 2 hours now and i really cant see the problem here. Have u ever had a texture that wont load normally?? the problem is that my texture will appear to be rotated by 45 deg to the left. ive made a test texture that is composed from a vertical green stripe, a red one and a blue one. Theses stripe are all together and ive applied it to a rectangle. The texture, when applied, will appear to be composed of diagonal stripes, thoses stripes being repeated to fulfill the rectangle. Here is the code for loading the texture. if (TextureImage[1] = LoadBMP("Data/test.bmp")) { Status = TRUE; glGenTextures(1, &texture[1]); glBindTexture(GL_TEXTURE_2D, texture[1]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST); gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TextureImage[1]->sizeX, TextureImage[1]->sizeY, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[1]->data); } if(TextureImage[1]) { if (TextureImage[1]->data) free(TextureImage[1]->data); free(TextureImage[1]); } its really the same thing as in the tutorial 7 to the exception that im making 2 textures, so im calling LoadBMP for the second time. Here is the code for drawing my rectangle glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glTranslatef(1.0f, 4.0f, -45.0f); glBindTexture(GL_TEXTURE_2D, texture[1]); glBegin(GL_QUADS); glTexCoord2f(0.0f, 0.0f); glVertex3f(0.0f, 0.0f, 0.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f(0.8f, 0.0f, 0.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f(0.8f, 1.5f, 0.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(0.0f, 1.5f, 0.0f); glEnd(); Thx alot for ur help ! Kiroke
Kirokewww.geocities.com/kiroke2
nevermind that question ive got my answer...the bmp was not the appropriate format (was not a power of 2)

Kiroke
Kirokewww.geocities.com/kiroke2

This topic is closed to new replies.

Advertisement