Results 1 to 4 of 4

Thread: Texture distorsion

  1. #1
    Junior Member Newbie
    Join Date
    May 2001
    Location
    France
    Posts
    19

    Texture distorsion

    Hi there, I need to show an image in an OpenGL space (I would like to show it like a 2D viewer would do), but the image is not exactly the same as what it is in reality (I mean in a 2D viewing program), although I use glOrtho, and a viewport which has the same dimensions as my image, there is color distorsion...
    This is the code I use :
    glPixelStorei ( GL_UNPACK_ALIGNMENT, 1 );
    glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
    glTexParameteri ( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
    glTexEnvf ( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
    Is it a problem of filter, lighting (I chose the default one), projection, environment???
    Anybody to help me?
    Thanks a lot,
    Antoine Rennuit.

  2. #2
    Junior Member Newbie
    Join Date
    Jan 2001
    Posts
    24

    Re: Texture distorsion

    Well you could try to use GL_DECAL instead of GL_MODULATE.

  3. #3
    Junior Member Newbie
    Join Date
    May 2001
    Location
    France
    Posts
    19

    Re: Texture distorsion

    Well, well, it doesn't work...

  4. #4
    Senior Member Regular Contributor
    Join Date
    Feb 2001
    Location
    Australia
    Posts
    431

    Re: Texture distorsion

    You need to get a copy of the blue book (or find an online copy) and tailor the texture function to your needs. Read the specs for glTexEnv. You need to take into account what format your image data is in and how the texture functions act on the fragment to be textured. From the sounds of what you want to do, julius was right - you either want GL_DECAL or GL_REPLACE instead of GL_MODULATE. Unfortunately you have to know what OpenGL will do to your textures using these functions and the only way is to read it (I'm not going to type it all out here - sorry ).

    You also need to know how OpenGL treats colour - differently from your 2D drawing program I would think. There was a lengthy discussion on one of the boards (probably the advanced board) about colour spaces a while ago. Either do a search or maybe someone else remembers the link.

    Hope that helps.

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. Perspective distorsion using GL_QUAD
    By Runik in forum OpenGL: Basic Coding
    Replies: 9
    Last Post: 11-21-2007, 04:36 PM
  4. Replies: 2
    Last Post: 09-27-2004, 05:25 PM
  5. Skybox distorsion
    By Osku in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 11-15-2000, 04:48 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