From: Brad Colbert (bcolbert++at++acm.org)
Date: 01/15/2001 10:08:43
If you are comfortable with OpenGL you could create a pfChanTravFunc
for your channel that draws the channel and then draws your credits
in OpenGL. Something like the following, (rough cut and I leave it to
you to load the texture).
// your credit drawing routine
void drawCredits()
{
pfPushState(); // save states
pfDisable (PFEN_FOG);
pfDisable (PFEN_LIGHTING);
glDisable (GL_DEPTH_TEST);
// save current matrix mode state
int mat_mode;
glGetIntegerv (GL_MATRIX_MODE, &mat_mode); // remember matrix mode
// make sure you have the projection matrix
glMatrixMode(GL_PROJECTION);
// clear it, push it, and set mode
glPushMatrix();
glLoadIdentity();
glOrtho (0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
// load texture here, or use preloaded texture id
...
// draw textured quad
glBegin(GL_QUADS);
{
glVertex3f(0.0, 1.0, 0.0);
glTexCoord2f(0.0, 0.0);
glVertex3f(0.0, 0.0, 0.0);
glTexCoord2f(0.0, 1.0);
glVertex3f(1.0, 0.0, 0.0);
glTexCoord2f(1.0, 1.0);
glVertex3f(1.0, 1.0, 0.0);
glTexCoord2f(1.0, 0.0);
}
glEnd();
// restore matrix
glPopMatrix();
// restore matrix state
glMatrixMode(mat_mode); // restore matrix mode
// restore pf_states
pfPopState();
}
// your trav func
void drawFunc(pfChannel *chan, void *data)
{
pfClearChan(chan);
pfDraw();
if (shared->draw_credits)
{
drawCredits();
}
}
// register your Func
pfChanTravFunc(chan, PFTRAV_DRAW, drawFunc);
Hope you find this useful.
- Brad C.
Julien wrote:
> Hi all,
>
> Is there a simple way in Performer to draw a image in screen
> coordinates.
> I need that for the credits of our simulation : We want to see the
> credits
> at the bottom of the window, slidding over the graphic simulation
> horizontally.
>
> I have a image texture of 32x2048 (with alpha) with all the text, logo,
> etc.
>
> Thanks,
> Julien.
> --
> ______________________________ _______________________________
> Julien ROGER | Institut Image / ENSAM
> Tel: +33 (0) 385.424.350 | http://www.ai.cluny.ensam.fr
> -----------------------------------------------------------------------
> 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
-- Brad Colbert GreyStone Technology, Inc. bcolbert++at++acm.org (858) 874-7000
This archive was generated by hypermail 2b29 : Mon Jan 15 2001 - 10:15:17 PST