Results 1 to 4 of 4

Thread: wrong colors in TGA

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2002
    Location
    Stuttgart, Germany
    Posts
    27

    wrong colors in TGA

    heyo!

    i am using tga-textures to map on some objects. works fine, the parts i want to be transparent are so, but some of the colors are wrong.

    for example, brown appears blue ....

    i "think" the tga is ok, but what else could be wrong? the tga is 24 bit (16bit color and 8 bit alpha). when i save it as 16 bit (15 color, 1 alpha), loading it to OGL completely fails ....

    ??


    seb

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jan 2002
    Posts
    292

    Re: wrong colors in TGA

    Problems arise with different platform due to the way they store bits, e.g. Little and Big Endian...

    So, if you are in a windows machine, when you load your texture you can simply flip the values of red and blue and when you ceate your texture your parameter can stay as GL_RGB.
    Now, if you dont flip these values, you colors will be inverted and to fix this you change from GL_RGB to GL_BGR_EXT

    I hope this fixes the problem...

    About the 16/15 bits, you would have to post some code to see.

    You can get my TGA loader from any of my terrain demos at http://141.217.140.88/miguel
    If you dont get the latest however, you will get the problem you are facing if yo are loading 32 bits TGAs, for 24 is fine... It is fixed in versions 5 and on.

    Bye.

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2002
    Location
    Stuttgart, Germany
    Posts
    27

    Re: wrong colors in TGA

    hmm, thanks for your advice, i downloaded your prog, and did that

    -------------------------------
    gluBuild2DMipmaps( GL_TEXTURE_2D, 3, texture_info->Width, texture_info->Height, GL_BGR_EXT, GL_UNSIGNED_BYTE, texture_info->Texture_bits )
    -------------------------------

    , but it completely skrewed the texture. looks weird ...

    any other ideas? somebody??



    seb

  4. #4
    Junior Member Newbie
    Join Date
    Jul 2002
    Location
    Stuttgart, Germany
    Posts
    27

    Re: wrong colors in TGA

    ahhh, i got it.

    it WAS your advice, i just mixed sth up in that gluBuild2DMipmaps-call.
    the second param must be 4, not 3

    thanks again!


    seb

Similar Threads

  1. OpenGl image corrupted/wrong colors
    By Cyber Crab in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-19-2018, 12:56 PM
  2. My UV-mapping gets wrong colors?
    By ninjas in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 06-04-2018, 02:41 AM
  3. Replies: 3
    Last Post: 06-19-2016, 08:11 AM
  4. Replies: 2
    Last Post: 06-15-2015, 03:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean