View Full Version : Getting weird textures
01-25-2004, 04:51 AM
I'm reading an opengl book that has examples with multitexturing. The thing is that I get very very weird textures applied to the cube I created. There are black and white stribes applied to it instead of the chess that actually should. I also tried normal texturing but that doesn't seem to work either. I get the same problem.
Here is my code http://crypto.tk/~styx/1.cc
Please help me out,
thanks in advance.
01-25-2004, 04:21 PM
You are making the assumption that the image is loaded in memory as rgb.
The 5th argument in glubuild2dmipmaps specifies the type of data in memory and should match what the file loader creates in memory. You've hardcoded this to be GL_RGB irrespective of what the loader pulls in from the file. Probably the colorMode value used in the loader, although I'm not familiar enough with TGA to be confident that bitcount/8 is the right thing to do to get this.
The tga loader also looks like it does an endian swizzle of imageData that appears based on short types and is irrespective of data type in the file. I doubt that's correct.
My advice would be to ditch this tga loading code and use a library for it. Or write your own.
[This message has been edited by dorbie (edited 01-25-2004).]
01-26-2004, 04:58 AM
Or just make the OpenGL driver generate MipMaps with this nice extension:
01-26-2004, 06:04 AM
The TGA Loader is straight from the book. And the source code that THEY made (it's on the ch I got with my book) compiles fine, and runs. The code is, unfortuantly, for win only. I'll try what you both said.
01-27-2004, 06:18 AM
Still encountering the same problems. I took a SDL tutorial and read the SDL docs. And used the SDL_image to lead the images.
Now I'm just getting completly nothing. No square no nothing. http://crypto.tk/~styx/SDL
please compile that source (1.cc) and grab the pictures and see the result. PLEASE HELP.
I'm realy getting desperate, been stuck with this for a week now >_> Please help me out
Oh btw note that if you uncomment the text output (line 226/228) You wont get a seg fault. That's also something I don't understand.
[This message has been edited by styxo (edited 01-27-2004).]
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.