Re: [osg-users] osgText - fragment shader - font texture

2010-03-25 Thread Yuriy A Rudomyotov
Hi, Farshid Lashkari

Thank you very much.

Cheers,
Yuriy

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=26117#26117





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] osgText - fragment shader - font texture

2010-03-24 Thread Yuriy A Rudomyotov
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
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] osgText - fragment shader - font texture

2010-03-24 Thread Farshid Lashkari
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).;
}

Cheers,
Farshid

On Wed, Mar 24, 2010 at 1:54 AM, Yuriy A Rudomyotov u...@te.net.ua 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
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org