Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Texture

  1. #1
    Guest

    Texture

    I am trying to texture an object using an RGB-bitmap.
    At first I wrote a function that would make use of the glaux library, but somehow windows got problems with any glauximp.dll I had installed, so I wrote my own bitmap loader, thus replacing auxDIBImageLoad().
    The bitmap seem to be loaded ok, except for the fact that the entire texture is now composed of all shades of one of the three prime colors, depending on where I point the glTexImage2D bitmap data pointer (the last argument).
    In fact when I point the pointer to the start of the bitmap data the entire texture is composed of all shades of blue, when I point it to the second data element everything is green, at the next byte everything is red, and after that everything starts all over again.
    Anyone knows what could be the cause of this?

  2. #2
    Guest

    Re: Texture

    Some of the GLUT (IRIX) ports of the NeHe tutorials has a BMP loader. A better solution is probably to pick the TGA loader from the last tutorial. Should be easy to use since it is separate implementation/header files. TGA is more useful than BMP because you can have images with a alpha channel.

    If you for some strange reason wants glaux can you compile or get a dll from here http://www.delphi-jedi.org/DelphiGra...l/download.htm

  3. #3
    Guest

    Re: Texture

    I still want to know what could be the cause if this strange behavior.

  4. #4
    Senior Member Frequent Contributor
    Join Date
    Aug 2000
    Location
    Cardiff University
    Posts
    653

    Re: Texture

    What is the colour state set to. I seem to remember having a similar problem as I was drawing an object in a colour, say blue, and then trying to texture map, but as the gl state was blue the texture was all blue.

    gav

  5. #5
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: Texture

    Show your code around glTexImage2D.
    Deiussum
    Software Engineer and OpenGL enthusiast

  6. #6
    Guest

    Re: Texture

    Gavin:
    Well I looked at the color state too and I changed it but that would make no difference.
    As I said the only time the color changes is when I change the offset from where to begin reading bitmap data, it then cycles through the colors blue green and red in that order.

    nvidia_linux:
    I tried that loader too, but I am having exactly the same problem, so I suppose the problem is not in the loader but with the actual GL code, perhaps I passed a wrong option to one of the texture commands...

  7. #7
    Senior Member Frequent Contributor
    Join Date
    Aug 2000
    Location
    Portsmouth, Hampshire, England
    Posts
    926

    Re: Texture

    err... if you offset from when you start reading data in, then yeah the components of the channels will change.

    If you use a blue texture, then it will start off blue, then change to green, then red, with each succesive offset added.

    There's obviously a bug in your bitmap loader.

    Nutty

  8. #8
    Guest

    Re: Texture

    What exactly do you mean by 'if you offset from when you start reading data in'?
    My texture is not a single solid color, it has multiple colors, it's a wooden crate.

  9. #9
    Senior Member Frequent Contributor
    Join Date
    Aug 2000
    Location
    Portsmouth, Hampshire, England
    Posts
    926

    Re: Texture

    I meant exactly what you said.

    the color changes is when I change the offset from where to begin reading bitmap data
    Thats what I meant.

    If your texture is wooden colour, and you're getting all of one colour, then their must be something wrong with the way you're loading the texture.

    Nutty

  10. #10
    Senior Member OpenGL Pro
    Join Date
    Jun 2000
    Location
    Shreveport, LA, USA
    Posts
    1,502

    Re: Texture

    IHOPE..., the data in the file is composed of a stream of RGB triplets if it is a 24 bit color file. So if you offset it a byte it will start with G instead of R (or B). The effect is that green turns red (or blue), and so on. If you offset it two bytes you get exactly the opposite combination. If its a 15 or 16 bit color file, then things look wrong if the offset is odd. To see if something is really wrong with the loading rountine use three different bitmaps each just a primary color. See how each texture turns out when loaded. If the colors change then pay attention to which color turns into which color, that should provide some hint as to what is wrong. Also be aware that some bitmaps may be in planar order (though I haven't run across that type in a long time), i.e. all red data followed by all green data, and so on.



    [This message has been edited by DFrey (edited 07-20-2001).]

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 1
    Last Post: 12-26-2014, 04:57 PM
  2. Replies: 1
    Last Post: 03-10-2014, 12:51 PM
  3. Replies: 2
    Last Post: 09-27-2004, 05:25 PM

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