Angus Dorbie (dorbie++at++sgi.com)
Thu, 04 Nov 1999 18:09:50 -0800
See my .signature for the URL.
Cheers,Angus.
rvandepo++at++csc.com wrote:
>
> I would appreciate it if somebody could give me some feedback on texture
> coordinate generation by means of using pfTexGen. I try to find an explanation
> why I don't get the right results with the implementation of texture projection.
> The system I am working on keeps the eyepoint at the origin; hence any change in
> altitude for instance is reflected in moving the scene up or down rather than
> moving the eyepoint itself.
>
> As you can see from the code given below I set the pfTexGen mode to EYE_LINEAR
> and I also define the pfTexGen planes so that the corresponding (s,t,r,q) will
> be determined by the distance from a given vertex to these planes after they
> have been transformed with the inverse of the modelview matrix i.e. the
> (s,t,,r,q) will be identical to the vertex coordinate (x,y,z,w) with respect to
> the global origin (and not with respect to the origin of each local coordinate
> system associated with each object in the scene).
>
> After applying the pfGeoState I than override the pfGeoState in such a way that
> pfTexGen will be enabled for each pfGeoSet that belongs to a pfGeode node in the
> corresponding scene graph.
>
> Using this approach I wonder whether the modelview matrix of each pfDCS node in
> the scene graph will be included in the texture coordinate generation during the
> scene graph traversal. Or will it be just the modelview matrix at the time the
> _texState->apply() is done?
>
> Any sample code would be welcome too!
>
> Many thanks!
>
> Rene
>
> --
> The code I am using is given below
>
> _texImage = new pfTexture;
> _texState = new pfGeoState;
> _texEnv = new pfTexEnv;
> _texGen = new pfTexGen;
>
> _texGen->setMode(PF_S, PFTG_EYE_LINEAR);
> _texGen->setMode(PF_T, PFTG_EYE_LINEAR);
> _texGen->setMode(PF_R, PFTG_EYE_LINEAR);
> _texGen->setMode(PF_Q, PFTG_EYE_LINEAR);
>
> _texGen->setPlane(PF_S, 1.0f, 0.0f, 0.0f, 0.0f);
> _texGen->setPlane(PF_T, 0.0f, 1.0f, 0.0f, 0.0f);
> _texGen->setPlane(PF_R, 0.0f, 0.0f, 1.0f, 0.0f);
> _texGen->setPlane(PF_Q, 0.0f, 0.0f, 0.0f, 1.0f);
>
> _texState->setAttr(PFSTATE_TEXTURE, _texImage);
> _texState->setAttr(PFSTATE_TEXENV, _texEnv);
> _texState->setAttr(PFSTATE_TEXGEN, _texGen);
> _texState->setMode(PFSTATE_ENTEXGEN, PF_ON);
> _texState->setMode(PFSTATE_ENTEXTURE, PF_ON);
>
> _texState->apply();
>
> // Enable the override by the current GeoState i.e. the current GeoState
> // modes and attributes will override the corresponding local GeoStates
> // during the scene graph traversal.
> pfOverride(PFSTATE_ENTEXTURE|
> PFSTATE_ENTEXGEN|
> PFSTATE_TEXTURE|
> PF_ON);
>
> -----------------------------------------------------------------------
> List Archives, FAQ, FTP: http://www.sgi.com/software/performer/
> Submissions: info-performer++at++sgi.com
> Admin. requests: info-performer-request++at++sgi.com
-- "Success is the ability to go from one failure to another with no loss of enthusiasm." - Winston Churchill.Performer + OpenGL examples and tutors: http://www.dorbie.com/
This archive was generated by hypermail 2.0b2 on Thu Nov 04 1999 - 18:09:57 PST