I’m drawing into a texture which is binded to a FrameBuffer. Then I use it on a rectangle, where it can be moved to see particular areas of the texture.
When i’m outside of the drawn texture I want to have only a color
I tried on GL_TEXTURE_WRAP_S/GL_TEXTURE_WRAP_L
GL_MIRRORED_REPEAT
GL_REPEAT => I get color around my texture but the repeated texture is too near
GL_CLAMP_TO_EGDE
But it’s not the result I want.
Any idea to help me ?
Thx.
I’m no IOS developer, but the edge modes you listed (repeat, mirror and clamp) are all the graphics hardware I know about supports, so I’d guess the iPhone/iPad GPUs will be similar.
If you can, make the texture 1 pixel larger at each border (so eg. use a 126×126 bitmap and paste it into the middle of a transparent 128×128 texture) and use clamp as the edge mode. This will not result in a sharp edge, however, since bilinear interpolation will still take place.
Otherwise, you’ll have to do the math yourself, meaning that if your viewing rectangle reaches the border of the texture, you’ll have to adjust the coordinates of the rendered quad instead of only its texture coordinates, eg.