Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: Getting weird textures

  1. #1

    Getting weird textures

    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

    Please help me out,
    thanks in advance.

  2. #2
    Super Moderator OpenGL Guru dorbie's Avatar
    Join Date
    Jul 2000
    Bay Area, CA, USA

    Re: Getting weird textures

    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).]

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2004
    The Netherlands

    Re: Getting weird textures

    Or just make the OpenGL driver generate MipMaps with this nice extension:
    Code :

  4. #4

    Re: Getting weird textures

    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.


  5. #5

    Re: Getting weird textures

    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.
    please compile that source ( 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).]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts