Motherboard Forums


Reply
Thread Tools Display Modes

GL_CLAMP_TO_BORDER and GL_CLAMP_TO_EDGE ?

 
 
Skybuck Flying
Guest
Posts: n/a
 
      09-24-2009, 04:32 AM
Hello,

I am trying to make sense of the following documentation:

OpenGL 2.1 Reference documentation:

http://www.opengl.org/sdk/docs/man/

"
glTexParameter - set texture parameters
"

"
GL_TEXTURE_WRAP_S

Sets the wrap parameter for texture coordinate s to either GL_CLAMP,
GL_CLAMP_TO_BORDER, GL_CLAMP_TO_EDGE, GL_MIRRORED_REPEAT, or GL_REPEAT.
GL_CLAMP causes s coordinates to be clamped to the range [0,1] and is useful
for preventing wrapping artifacts when mapping a single image onto an
object. GL_CLAMP_TO_BORDER causes the s coordinate to be clamped to the
range -12N1+12N, where N is the size of the texture in the direction of
clamping.GL_CLAMP_TO_EDGE causes s coordinates to be clamped to the range
12N1-12N, where N is the size of the texture in the direction of clamping.
GL_REPEAT causes the integer part of the s coordinate to be ignored; the GL
uses only the fractional part, thereby creating a repeating pattern.
GL_MIRRORED_REPEAT causes the s coordinate to be set to the fractional part
of the texture coordinate if the integer part of s is even; if the integer
part of s is odd, then the s texture coordinate is set to 1-frac?s, where
frac?s represents the fractional part of s. Border texture elements are
accessed only if wrapping is set to GL_CLAMP or GL_CLAMP_TO_BORDER.
Initially, GL_TEXTURE_WRAP_S is set to GL_REPEAT.
"

I am especially confused about the following lines:

"
GL_CLAMP_TO_BORDER causes the s coordinate to be clamped to the
range -12N1+12N, where N is the size of the texture in the direction of
clamping.GL_CLAMP_TO_EDGE causes s coordinates to be clamped to the range
12N1-12N, where N is the size of the texture in the direction of clamping.
"

The only difference I can see is "coordinate" and "coordinates".

I am confused about this option... and especially the range description:
"-12N1+12N"

What the hell does that mean ?

I am also a little bit confused about GL_CLAMP but I think I understand
that.

Suppose my texture coordinates have range 0 to 1000... then GL_CLAMP would
always "clamp" this to 0..1.

So that would be bad because I would like to keep range 0 to 1000... so I
would need to use another option...

So that's why I am interested in the border or edge option... I just wanna
make sure I understand it correctly...

So some questions:

1. Are these two options the same thing ? (yes/no will do for now see
question 4 )

Suppose my texture coordinates are 800 x 600

2. Will border option clamp to 800x600 ?

3. Will edge option clamp to 800x600 ?

4. Is there a conceptual difference between these two options: border and
egdge ?
If so... then what's the difference, what's the concept for both ?

Bye,
Skybuck.


 
Reply With Quote
 
 
 
 
Skybuck Flying
Guest
Posts: n/a
 
      09-24-2009, 04:35 AM
Also I noticed another difference between these two options...

One is - +

The other is + -

Time for me to read up on the concept of texture borders:

Maybe this doc will help :

http://www.opengl.org/resources/code...es/node64.html

Bye,
Skybuck.


 
Reply With Quote
 
 
 
 
Skybuck Flying
Guest
Posts: n/a
 
      09-24-2009, 04:50 AM

"Skybuck Flying" <(E-Mail Removed)> wrote in message
news:3883f$4abaf6f9$d53372a9$(E-Mail Removed)1.n b.home.nl...
> Also I noticed another difference between these two options...
>
> One is - +
>
> The other is + -
>
> Time for me to read up on the concept of texture borders:
>
> Maybe this doc will help :
>
> http://www.opengl.org/resources/code...es/node64.html


The texture border is a 1 pixel border around the texture... normally opengl
will mix the texels at the edge with the borders...

So I guess the "edge" can be considered the last pixels of a texture.

The border can be considered the pixels outside/around the texture.

OpenGL also allows the border color to be specified.

I will not be dealing with borders, so I want to get rid of the border.

I also do not want any filtering... so nearest will do just fine...

So from that doc I think this clamp to edge will do just fine:

"
GL_CLAMP_TO_EDGE

This mode clamps the texture coordinates such that the texture border is
never sampled. The filtered color is derived only from texels at the edge of
the texture image.
"

Hoping that it works fingers crossed !

Me better save that document it's a good explanation of texture borders and
edges !

Also I am not yet sure if texture coordinates always have to be from 0 to 1
for clamping to work...

I should be able to specify the texture dimensions/range somewhere /
texture coordinate ranges (? Hmm )

I already tested what happens when large texture coordinates are passed to
vertex and pixel shader they come through just fine... not sure what happens
when clamping is enabled ? and tex2d is done ? me-to-find-out

Bye,
Skybuck.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT. The time now is 03:53 PM.


Welcome!
Welcome to Motherboard Point
 

Advertisment