Hi Yuriy,
The default freetype font uses alpha textures, so only the alpha component
of the texture contains the font data. Here is a basic fragment shader that
should work with the freetype font plugin:
uniform sampler2D bitmap;
void main()
{
gl_FragColor = texture2D(bitmap, gl_TexCoord[0].st).aaaa;
}
Cheers,
Farshid
On Wed, Mar 24, 2010 at 1:54 AM, Yuriy A Rudomyotov <[email protected]> wrote:
> Hi,
>
> I try to use shaders with osgText to make some effects with text. But how I
> can set up uniform variable with font texture to process it in fragment
> shader? Or may be I should do something another to have result?
>
> Primitive fragment shader:
>
> Code:
>
> uniform sampler2D bitmap;
> varying vec2 texelCoord;
>
> void main( void )
> {
> gl_FragColor = vec4( texture2D( bitmap, texelCoord ) );
> }
>
>
>
>
> Code which sets the variable:
>
> Code:
>
> //...
> osg::Uniform* bitmap = new osg::Uniform("bitmap",
> osg::Uniform::SAMPLER_2D);
>
> bitmap->set(??????);
>
> text->getOrCreateStateSet()->addUniform(bitmap);
> //...
>
>
>
>
> Thank you!
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=26059#26059
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org