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
    18

    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
    Newbie Frequent Contributor
    Join Date
    Mar 2016
    Posts
    896
    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
    18
    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
    Newbie Frequent Contributor
    Join Date
    Mar 2016
    Posts
    896
    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
    18
    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

Similar Threads

  1. Texture indexing and value range
    By Maciek R. in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 04-02-2011, 03:20 PM
  2. texture dimensions from texture handle
    By Mikkel Gjoel in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 11-02-2009, 02:48 AM
  3. [Texture] Type, range and sampler
    By Kiwaiii in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 05-12-2009, 11:42 PM
  4. handle
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 09-07-2005, 07:59 PM
  5. range of texture coords in rectangle textures
    By kon in forum OpenGL: GLSL
    Replies: 2
    Last Post: 05-25-2005, 04:48 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