Results 1 to 6 of 6

Thread: Colour problem with textures

  1. #1
    Guest

    Colour problem with textures

    Hi, I have a problem with texture's colours. I'm using opengl and SDL - SDL_GL_RED_SIZE, SDL_GL_GREEN_SIZE, SDL_GL_BLUE_SIZE set to 5 6 5 and video mode initialized in 16 bit colour depth. The problem is that when I texture an object, texture's colours look bad - there is no smooth colour shading. This seems very confusing because in 16 bit desktop video mode my picture viewer shows colour shading normally. I use GL_RGB and GL_UNSIGNED_BYTE as the "internalFormat" and "type" parameters of glTexImage2D function. In fact I don't clearly understand the "type" parameter of glTexImage2D. Any suggestions on the ugly colour shading?

    Thanks for answering me.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2000
    Location
    Naarn, Austria
    Posts
    1,102

    Re: Colour problem with textures

    You shouldn't take an image viewer as reference how good it should look. Image viewers generally use sophisticated algorithms to reduce bit depth of images, while your graphic card is propably just cutting away the least significant bits of the color.

    A possible solution (I haven't tried it myself) might be to manually reduce the bit depth with an image editor, thus producing a special 16 bit texture, and using this instead of the 32 bit original.

  3. #3
    Guest

    Re: Colour problem with textures

    But when just blitted the same images look identical to the image viewer preview. When texture mapped they look ugly. I'm restricted to only using 24 and 32 bit images.

  4. #4
    Super Moderator OpenGL Lord
    Join Date
    Dec 2003
    Location
    Grenoble - France
    Posts
    5,574

    Re: Colour problem with textures

    Please provide screenshots from both image viewer output and Gl texture. (Alt-PrintScreen under Windows, then paste in image editor to save)

  5. #5
    Guest

    Re: Colour problem with textures

    Here is the link: http://synergie.hit.bg/difference.bmp

    It's quite big 750Kb saved as a BMP. On the top is what my openGL program shows - it is being initialized in 800x600 orthographic mode where 1 point is 1 pixel. The screenshot is made "AS IS" I have just cut the insignificant parts of my desktop. My desktop is running in 16 bit color depth and openGL initialization is like what I described in my first post message.

  6. #6
    Guest

    Re: Colour problem with textures

    Hey, Guys thank you very much for your answers and special thanks to Overmind for his wisdom - the problem is exactly what he said. I solved it like this - first save the picture as R5 G6 B5 BMP and later import the flatten image in my PNG and save it like 24 bit. Thanks again. I must listen more careful your advices.

Similar Threads

  1. colour and lighting problem
    By fox in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-01-2002, 12:19 PM
  2. rendering to DC colour problem
    By mcsellski in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 01-28-2002, 02:36 AM
  3. colour problem
    By fox in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 12-07-2001, 10:13 AM
  4. Using textures and flat colour.
    By tracer.bullet in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 05-08-2001, 07:05 AM
  5. Procedural Textures using splines for colour mapping
    By cameron in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 05-08-2001, 01:34 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