Hi Jeremy,

OpenGL supports texture repeat but only for the whole texture,
osgtexture2D has an example of texture repeat so have a look at whats
possible with just standard OpenGL wrap modes.

Repeating a sub-porton of texture atlas is rather different though,
using wrap modes you'll end up repear over the whole 0.0 to 1.0 range
rather than just the portion you want.  If you using a TextMat you can
get OpenGL to repeat the texture at high frequency, but it'll still be
over the whole 0.0 to 1.0 range, it won't skip things out of your
range.

The only ways I can think of repeating a subporting are to use GLSL to
manage the tex coord wrapping internally in the fragment program, or
to simply repeat your texture manually in your texture atlas, or just
ditch the use of sub regions and wash, rinse, repeat  like standard
OpenGL texture wrap modes.

Robert.


On 6/6/07, Jeremy L. Moles <[EMAIL PROTECTED]> wrote:
I've tried googling and asking this question in various other OpenGL
places with no success--so I figured I'd try here, since I know there
are some OpenGL gurus around. In fact, I was told in #opengl on Freenode
it wasn't possible, but I doubt it sense people have been doing this for
ages used fixed-function OpenGL.

I'm working on a UI toolkit using native OSG objects (no weird
"gluecode" or external library) and have come across something I can't
readily get the answer to.

Imagine an interface "window"; at the minimum you'll have about 9
regions that describe this window:

        - upper left and right corners
        - lower left and right corners
        - top, left, bottom, and right "bars"
        - center

Now imagine a texture you want to use as the window's "skin." Ideally,
you'll load an image into the texture and position the TexCoords so that
you can create the illusion of having a true, decorated and composed
window. This is fairly straightforward in concept except for one aspect.

Lets say you want to texture the "top bar" region of your window. Well,
by default, unless this portion of your image (or skin) is cleverly
positioned in the texture itself, there's really no way I know of to
"tile" it across the geometry. You can stretch it across, but this is
often quite ugly.

My question: is it possible in OpenGL to somehow manipulate the texture
matrix (or something else) to only operate on a "sub-region" of a
texture such that you can tile just that portion? CEGUI does this
somehow, but it's API is so abstracted I can't really track it's
implementation down.

I _know_ it's possible using a GLSL shader, but at this point it's
really academic for me to find out how to do it otherwise, I know game
makers have been doing this for years w/out shaders, and it's really
bugging me to find out how! :) Any advice or guidance on the issue would
be enormously appreciated...

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to