Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: how to handle texture outside range 0-1.0

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2014
    Posts
    9

    how to handle texture outside range 0-1.0

    Hello everyone , I would like to load a model (obj ) in my 3d viewport , I can load it no proble all works good.
    I also wish to load the texrure , only problem is that the texture ranges bigger then 0-1, the model is actually coming from
    autodesk maya and maya support multiple tiles , I tink the texture range from -2 to 2 in both x and y.
    How can I handle that? Is it there a way to tell opengl to not normalize my texture between 0-1? or I should let opengl normalize it and then I normalzie my texture
    coords on the model as-well?

    Cheers

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Posts
    878
    What happens when accessing a texture with coordinates outside the [0,1] range is controlled by the GL_TEXTURE_WRAP_{S,R,T} settings of the texture object (or sampler object if one is active), see glTexParameter.

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2014
    Posts
    9
    THank you for your answer , i knew the wrap methods , problem is I dont want any of them , I dont want to tile , I dont want to extend the color etc.
    If I am correct when I load the texture no matter what that texture is gonna span a range 0-1 right? so If I know that my texturecoordinates span a -2, 2 range probably I can just normalize the range right?

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Posts
    878
    If you are using the fixed function pipeline (i.e. no shader programs) you can also use the texture matrix to modify texture coordinates before they are used to access the texture. With shaders you can modify the tex coords in whatever way you need and in both cases you can modify them once after loading the data.

  5. #5
    Junior Member Newbie
    Join Date
    Jun 2014
    Posts
    9
    I am using shader pipeline, that s what I was thinking , remapping the texture coordinate in the correct range, I was wondering if this was correct approach.
    Now I need to find a way to figure out the correct range of the texture, I was thinking to proces the data and keep track of bot min and max value in u,v, but that doesnt mean
    the value I get is going to reflext the correct range , since most likely I wont have the poly at the very edge of the texture.
    mmmm tricky

Posting Permissions

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