Hi, in texture mapping, I usually give texture coordinates between 0 and 1, I saw a lot of programs and examples and this rule is always used.. Is it possible to set different coordinates, i mean using world coordinates instead of texture coordinates? f.e.:

The thing is to tell OpenGL what you want the result of lookups out that range to do. You can set your texture to:
- repeat (0..2 would tile twice)
- clamp to edge - which repeats the last texel in the texture
- clamp which uses a border color.

arthas

03-18-2008, 02:31 AM

thanks sqrt[-1]! i'm interested in the last option! what i need to modify in my program?

sqrt[-1]

03-18-2008, 07:03 AM

Simply set the texture property GL_TEXTURE_BORDER_COLOR to the color you want and set the texture wrap s/t to GL_CLAMP (or possibly GL_CLAMP_TO_BORDER)

All this happens through the function glTexParameter (when you have an active texture object bound)
See http://www.opengl.org/sdk/docs/man/xhtml/glTexParameter.xml

arthas

03-18-2008, 08:25 AM

what's the difference between GL_CLAMP_TO_BORDER, and GL_CLAMP?

CatDog

03-18-2008, 08:43 AM

sqrt[-1] linked directly to the docs. Did you consider reading them?

CatDog

ZbuffeR

03-18-2008, 08:46 AM

GL_CLAMP_TO_EDGE will clamp to the normal texture color that is specified just inside the [O..1] range.
GL_CLAMP_TO_BORDER will clamp to the outer border color (or the border texel if you have defined them).
GL_CLAMP will clamp to color in-between both border and edge.

Lindley

03-18-2008, 03:07 PM

What coordinates you use also depends on whether you're using GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE_ARB.