From: Stace Peterson (stacep++at++sgi.com)
Date: 02/09/2005 15:00:25
Devrim,
With pfGeoArray objects, you can specify up to 4 floats for texture
coordinates. Use something like:
geoArray->setMultiAttr(PFGA_TEX_ARRAY, 0, 4, GL_FLOAT, 0, texCoords0);
geoArray->setMultiAttr(PFGA_TEX_ARRAY, 1, 4, GL_FLOAT, 0, texCoords1);
geoArray->setMultiAttr(PFGA_TEX_ARRAY, 2, 4, GL_FLOAT, 0, texCoords2);
geoArray->setMultiAttr(PFGA_TEX_ARRAY, 3, 4, GL_FLOAT, 0, texCoords3);
This will get you 16 floats. If the hardware supports it, you should be
able to use as many texture coordinate sets as you have texture units
(most modern hardware has at least 8 - slightly older hardware will
typically have at least 4). If you only have 3 extra tex coords, you
can use other unused vertex attributes, like color or normal to send
data. If the data is being manipulated by a vertex and fragment
program, then you can decide how to interpret each slot yourself.
Additionally, if you want to access the texture coordinates in a
fragment program, you need to make sure the vertex program passes these
values along, by moving them to the result, like so:
MOV result.texcoord[0], vertex.texcoord[0];
I've tested this on my machine, and it should work properly. Please let
me know if there are still problems.
Thanks,
Stace
Devrim Erdem wrote:
>
> Hello again,
>
> I need to pass 16 float values per vertex to my vertex program. So far
> I have tried the pfGeoArray's generic attributes and this has failed
> due to a bug w/ pf3.2 and Stace Peterson has suggested use of free
> texture coordinates instead. This sounded like a good idea until I
> restarted working on the project.
>
> The problem is that each tex coord can hold up to 2 floats and max 3
> tex coords are available on a regular vissim database. That only adds
> up to 6 floats per vertex, I need 16. I have tried PFGS_TEXCOORD3 to
> be able to use 3 floats per tex unit but this didn't seem to be
> working with the vertex program somehow. (It wouldn't also solve the
> problem completely.)
>
> I appreciate if anyone has a better idea which could help me to pass
> 16 floats per vertex to my vertex program.
>
> If not, is there a way to manually set vertex attributes for a
> pfGeoSet or pfGeoArray ? As far as I know there is no pre/post draw
> callback for pfGeoSet and pfGeoArray. In this way, I am hoping to use
> the OpenGL functions to set the program vertex attributes manually.
>
> Thanks in advance,
>
> Devrim Erdem
>
> -----------------------------------------------------------------------
> 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
> -----------------------------------------------------------------------
-- ------------------------------------------------------------------ Stace Peterson stacep++at++sgi.com Silicon Graphics, Inc. (650) 933-2323
This archive was generated by hypermail 2b29 : Wed Feb 09 2005 - 15:00:28 PST