Re: [info-performer] GLSL Generic Vertex Attributes

Date view Thread view Subject view Author view

From: Gerwin de Haan (gerwindehaan++at++gmail.com)
Date: 12/15/2005 06:57:08


I've played around with shaders in performer a little bit. This code
might be helpful:

pfShaderObject *soV = new pfShaderObject();
soV->setShaderType(PFSHD_VERTEX_SHADER);
soV->setName("adaptiveaa.vertex");
soV->load();

pfShaderObject *so = new pfShaderObject();
so->setShaderType(PFSHD_FRAGMENT_SHADER);
so->setName("adaptiveaa.frag");
so->load();

pfShaderProgram *sp = new pfShaderProgram();
sp->addShader(so);
sp->addShader(soV);

//ADAPTIVE AA
       GLfloat frequency;
       frequency = 16.0f;

       GLfloat lightpos[3];
       lightpos[0]=10.0f;
       lightpos[1]=10.0f;
       lightpos[2]=10.0f;

       sp->addUniform("Frequency",PFUNI_FLOAT1,1,&frequency);
       sp->addUniform("LightPosition",PFUNI_FLOAT3,1,&lightpos);

       pfGeoState *gs = (some custom stuff here)
       gs->setMode(PFSTATE_ENSHADPROG, PF_ON);
       gs->setAttr(PFSTATE_SHADPROG, sp);

for the shader example files check http://www.3dshaders.com/shaderSource.html

On 12/15/05, Sakis Gaitatzes <gaitat++at++yahoo.com> wrote:
>
> Hello all,
>
> I would like to pass down to a GLSL vertex/fragment shader generic
> vertex attributes for processing.
>
> In OpenGL the function glVertexAttrib() is used for this purpose but I
> cannot find the corresponding one for Performer.
>
> Also It would be nice if someone had a Performer example showing off
> this functionality.
>
> Many pfThanks,
>
>
> --
> Athanasios Gaitatzes (Saki)
> e-mail: gaitat at yahoo dot com
> url: http://www.virtuality.gr/
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> -----------------------------------------------------------------------
> List Archives, Info, FAQ: http://www.sgi.com/software/performer/
> Open Development Project: http://oss.sgi.com/projects/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
> -----------------------------------------------------------------------
>
>


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Thu Dec 15 2005 - 06:57:15 PST