From: Siedle, Pete (P.Siedle++at++tees.ac.uk)
Date: 05/17/2001 02:21:00
Hi Ian
Many thanks for the reply and info. I've downloaded it and will have a look
at it. Hopefully it'll clear up what I've missed in my own code to get proj
tex effect working on the IR2 gfx :o)
Thanks again
Pete
> -----Original Message-----
> From: ihawkes2++at++csc.com.au [mailto:ihawkes2++at++csc.com.au]
> Sent: Thursday, May 17, 2001 12:43 AM
> To: Siedle, Pete
> Cc: 'info-performer++at++sgi.com'
> Subject: Re: Projected texture working on IR2?
>
>
> Hi Pete,
> There's an example of projected texturing that helped me in
> the archives -
> search for "headlight" in the year 2000, posted by Marcin (there is an
> attachment called projexample.tar.gz).
> Regards
> Ian Hawkes
> CSC Autralia.
>
>
>
>
> "Siedle, Pete" <P.Siedle++at++tees.ac.uk> on 14/05/2001 22:31:48
>
> To: "'info-performer++at++sgi.com'" <info-performer++at++sgi.com>
> cc:
> Subject: Projected texture working on IR2?
>
>
> pfHi
>
> I've got an app in which I'm looking at doing a projected
> light map effect.
> The app is actually done in Vega, but the projected light map
> bit is done
> using embedded performer and OpenGL!
>
> Anyway, I've got it working, kind of!! It works on an
> Octane, O2 and Indy
> I've tried it on; but doesn't work as expected on our deskside Onyx!
> The app does it's second pass at rendering, but the lightmap isn't
> projected
> as expected (the objects in the scene are just rendered
> black). So I think
> that I'm not setting a state attribute (or something) which the IR2
> hardware
> needs to use/generate/apply the genetated uv coords for the lightmap
> texture!
>
> Anyone got any ideas as to getting it working?
>
> Many thanks in advance
>
> Pete
>
> To help anyone who might be kind enough to provide some feedback, I've
> included the relevent code segments below:
>
>
> ...snip...
>
> doGenTexCoords();
>
> /*app loop*/
> do
> {
> ....snip...
> /* first render pass done */
>
> /* set up for proj tex 4 sec pass */
> set4TexProj();
> /* second render pass */
> pfDraw();
> /* reset back to orig for first pass again */
> resetFromTexProj();
>
> }while(noexit);
>
> void doGenTexCoords(void)
> {
> pfVec4 clr = {0.0, 0.0, 0.0, 1.0};
>
> /* altering the active value in these can scale texture size */
> GLfloat pS[] = {1.0, 0.0, 0.0, 0.0};
> GLfloat pT[] = {0.0, 1.0, 0.0, 0.0};
> GLfloat pR[] = {0.0, 0.0, 1.0, 0.0};
> GLfloat pQ[] = {0.0, 0.0, 0.0, 1.0};
>
> /**** Setup Tex ****/
> /* set env for texture */
> glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
> pfTexBorderType(tex, PFTEX_BORDER_COLOR);
> pfTexBorderColor(tex, clr);
>
> /* gen tex coords */
> glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
> glTexGenfv(GL_S, GL_EYE_PLANE, pS);
>
> glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
> glTexGenfv(GL_T, GL_EYE_PLANE, pT);
>
> glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
> glTexGenfv(GL_R, GL_EYE_PLANE, pR);
>
> glTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
> glTexGenfv(GL_Q, GL_EYE_PLANE, pQ);
> }
>
> void set4TexProj(float ox, ...snip... float uz)
> {
> GLfloat mvmat[16], imvmat[16];
>
>
> glEnable(GL_BLEND);
>
> pfEnable(PFEN_TEXTURE);
>
> pfApplyTex(tex);
>
> pfOverride(PFSTATE_ENTEXTURE | PFSTATE_TEXTURE, PF_ON);
> /*different blend effects */
> /*glBlendFunc(GL_ONE, GL_SRC_COLOR);*/
> /*glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/
> /*glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);*/
> /*glBlendFunc(GL_ZERO, GL_SRC_COLOR);*/
>
> glBlendFunc(GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
> glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
> glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
> glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
>
> glGetFloatv(GL_MODELVIEW_MATRIX, mvmat);
> invertMatrix(&imvmat[0], mvmat);
>
> glMatrixMode(GL_TEXTURE);
>
> glLoadIdentity();
> glTranslatef(0.5, 0.5, 0.0);
> glScalef(0.5, 0.5, 1.0);
> /*first 4 no's in glFrustum scale the proj tex*/
> glFrustum(-0.1, 0.1, -0.05, 0.05, 0.1, 1000.0);
> /* val's ox - uz from func param's, give projection */
> gluLookAt(ox, oy, oz, ax, ay, az, ux, uy, uz);
>
> glMultMatrixf(imvmat);
>
> glMatrixMode(GL_MODELVIEW);
>
> glEnable(GL_TEXTURE_2D);
> glEnable(GL_TEXTURE_GEN_S);
> glEnable(GL_TEXTURE_GEN_T);
> glEnable(GL_TEXTURE_GEN_R);
> glEnable(GL_TEXTURE_GEN_Q);
> }
>
> void resetFromTexProj(void)
> {
> glDisable(GL_TEXTURE_2D);
> glDisable(GL_TEXTURE_GEN_S);
> glDisable(GL_TEXTURE_GEN_T);
> glDisable(GL_TEXTURE_GEN_R);
> glDisable(GL_TEXTURE_GEN_Q);
>
> glMatrixMode(GL_TEXTURE);
> glLoadIdentity();
> glMatrixMode(GL_MODELVIEW);
>
> glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
> glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
>
> pfOverride(PFSTATE_ENTEXTURE | PFSTATE_TEXTURE, PF_OFF);
> pfDisable(PFEN_TEXTURE);
>
> glBlendFunc(GL_ONE, GL_ZERO);
> glDisable(GL_BLEND);
> }
> --------------------------------------------------------------
> ---------
> List Archives, FAQ, FTP: 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
>
>
>
This archive was generated by hypermail 2b29 : Thu May 17 2001 - 02:21:34 PDT