Texture problem

I have a problem with texture not showing on the cube

code:
void LoadGLTextures()
{ AUX_RGBImageRec *text;
if(!(text=auxDIBImageLoad(“RedStar.bmp”))) printf(“error”);
glGenTextures(1,&texturename[1]);
glBindTexture(GL_TEXTURE_2D,texturename[0]);
glTexImage2D(GL_TEXTURE_2D,0,3,text->sizeX,text->sizeY,0,GL_RGB,GL_UNSIGNED_BYTE,text->data);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
}

part of display code

glBindTexture(GL_TEXTURE_2D,texturename[0]);
glBegin(GL_QUADS);
glTexCoord2f(0.0f,1.0f);
//glColor3f(1.0f,0.0f,0.0f);
glVertex3f(-0.5f,0.5f,0.5f);
glTexCoord2f(0.0f,0.0f);
glVertex3f(-0.5f,-0.5f,0.5f);
glTexCoord2f(1.0f,0.0f);
glVertex3f(0.5f,-0.5f,0.5f);
glTexCoord2f(1.0f,1.0f);
glVertex3f(0.5f,0.5f,0.5f);

and GL_TEXTURE_2D is enabled

glGenTextures(1,&texturename[1]);

should be:
glGenTextures(1,texturename);
or:
glGenTextures(1,&texturename[0]);
because you use the [0]th element of the array, so get a valid textureobj for it, and not for the next element in the array …

i have fixed that but still the same - no texture on cube

sorry, cant see any other errors, maybe the bmp is not loaded, or the dimensions of the texture are not n^2, or you call the binds between glBegin(); glEnd(); …
try to use a 1d texture, and use as data some array like:
data[8]= { 0, 1, and so on
when it work, your bmp isnt loaded correct or in the correct dimensions

bitmap is 128*128 I created it .
and there is testing for file load
but i will try it your way

Send the app and texture to me (e-mail in profile, remove “nospam”) if you like and I’ll have a look on Sunday Australian time (day after tomorrow). It could be a number of things.

Hope that helps.

you wouldnt be fred fish would you from the classic amiga collecion of PD discs?

No, sorry

Vlasko,

I tried to e-mail the code to you but it didn’t work so here are my changes:

(i) You must put your init() function after all the GLUT initialisation code, in the line after glutCreateWindow. This is why the texture wasn’t being bound properly.

(ii) The depth testing you are doing is making other problems with the display. Comment out the two lines in your init() function that enable depth testing and the depth func to use.

(iii) There are other problems with the program but making those two changes will get you started. If you have any other questions post them and someone will be glad to help.

E-mail me if you need any more help with this program or you don’t understand my explanations.

Hope that helps.

Thanks It works :-)but I get now problem with rotating the yellow part of texture disappears when I rotate cube . It’s a problem with graphics card or something else (like VC++ 6.0 … )I’m using CL 5446 as primary graphics card( crapy but I’ll try Voodoo 2 (crapy too - but still works) later