PDA

View Full Version : trying a texture



vammpiro
02-10-2005, 06:54 PM
hi people, I'm trying to use a texture... but the texture cames all white... and the function is working, cause with some images, the texture it's right

zukko
02-10-2005, 09:09 PM
are you using glEnable(GL_TEXTURE_2D); ??

vammpiro
02-11-2005, 06:15 AM
I'm trying this...
glGenTextures(1, &idTextura);
glBindTexture(GL_TEXTURE_2D, idTextura);
glTexImage2D(GL_TEXTURE_2D, 0, 3, imagemTextura->sizeX, imagemTextura->sizeY,
0, GL_RGB, GL_UNSIGNED_BYTE, imagemTextura->data);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_LINEAR);
glEnable(GL_TEXTURE_2D);

vammpiro
02-11-2005, 06:21 AM
it seems to be a paramater
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTE R,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTE R,GL_LINEAR);

Relic
02-11-2005, 06:22 AM
If your hardare doesn't support the ARB_non_power_of_two texture size extension this is probably failing for the images with non-power-of-two width or height values.
You need to resize your images to a power-of-two size then, e.g. with gluScaleImage.

vammpiro
02-11-2005, 08:27 AM
what do u mean by "power-of-two size" ?and how could I do that?

vammpiro
02-11-2005, 09:48 AM
thanks
the size of the image was 200x242, soh I put 256x256 and it works... than... butI still wanna know what do u mean by "power-of-two size"... =) and how the method gluScaleImage works.

Tsumuji
02-11-2005, 09:53 AM
Ele quer dizer potênciação de dois, ou seja, um valor de expoente qualquer que tenha base dois. 2^2, 2^3, 2^4, etc
Assim, você só pode usar texturas que tenham tamanho em 32x32(2^5), 64x64(2^6), etc.

vammpiro
02-11-2005, 10:53 AM
valeu cara (thanks man) :)