Hiro Mitsui (mitsui++at++emm.rd.tepco.co.jp)
Tue, 20 Jun 1995 13:44:17 +0900
I also had a problem on pfMakePerspFrustum(). The solution is
call pfChanNearFar() before pfMakePerspFrust().
Try these codes at the bottom of this mail. It's a modified
"/usr/src/Performer/src/pguide/libpf/progs/simple.c".
Regards,
-Hiro Mitsui
===========================================================================
Tokyo Electric Power Company, Inc.
Computer and Communications Research Center
OOO mitsui++at++rd.tepco.co.jp
(8) Hirokata Mitsui
==================== 4-1 Egasaki Tshurumi-ku Yokohama City,
Kanagawa Pref., 230 Japan =======
Tel.045-585-8814 (dial-in)
===========================================================================
=============== Makefile ==========================
#-- force Make to use a known shell
SHELL = /bin/sh
#-- alternate locatins for inclsded files
INCLUDE = \
-I. \
-I.. \
-I/usr/src/Performer/include \
-I/usr/include/Performer
#-- some libraries lack .so versions; so use optimized .a's instead
LIB =.so
LACKDSO =.a
PERFORMER = \
/usr/src/Performer/lib/libpfsgi${LACKDSO} \
/usr/src/Performer/lib/libpfdwb${LACKDSO} \
/usr/src/Performer/lib/libpfflt${FLTVER}.a \
/usr/src/Performer/lib/libpfutil${LACKDSO} \
/usr/lib/libpf.so \
/usr/lib/libpr.so
#-- IRIX 4.x uses shared gl {gl_s} library {System-V Make lacks #if tests}
LIBGL = -lgl
SYSTEM = \
-lmpc \
-limage \
${LIBGL} \
-lX11 \
-lm \
-lfpe \
-lC
LIBRARIES = \
${PERFORMER} ${SYSTEM}
#-- select c-compiler options
CFLAGS = -xansi -D__STDC__ ${INCLUDE} ${COPT}
#-- dummy assignment in case pmake is used
EXT=
LIB=
MAJOR=
#-- targets are the executables
TARGETS = simple
#-- make optimized non-dso version of program by default
all: ${TARGETS}
#-- clean up directories {remove junk}
clean:
rm -f ${TARGETS:=.o}
rm -f ${TARGETS}
#--
#-- library targets
#--
#-- make an optimized version of the program that uses DSOs
simple: simple.o
${CC} ${CFLAGS} -o $++at++ $++at++.o ${LIBRARIES}
========================= simple.c ==========================
/*
* Performer test program
*/
/*
* simple.c: simple Performer program for programmer's guide
*
* $Revision: 1.30 $ $Date: 1994/03/16 01:59:59 $
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <gl/device.h>
#include <Performer/pf.h>
#include "pfsgi.h"
static void OpenPipeline (pfPipe *p);
static float ScreenAngle = 65.0f;
/*
* Usage() -- print usage advice and exit. This
* procedure is executed in the application process.
*/
static void
Usage (void)
{
fprintf(stderr, "Usage: simple file.ext ...\n");
exit(1);
}
int
main (int argc, char *argv[])
{
float t = 0.0f;
pfScene *scene;
pfPipe *p;
pfChannel *chan;
pfVec3 xyz, hpr;
pfNode *root;
float x,z;
int i;
if (argc < 2)
Usage();
/* Initialize Performer */
pfInit();
pfMultiprocess(PFMP_DEFAULT);
pfConfig();
pfNotifyLevel(PFNFY_INFO);
/* Append to PFPATH files in /usr/src/Performer/data */
pfFilePath(".:/usr/src/Performer/data:/home/mitsui/DXF/");
/* Read a single file, of any known type. */
if ((root = LoadFile(argv[1], NULL)) == NULL)
{
fprintf(stderr,"illegal data \n");
pfExit();
exit(-1);
}
/* Attach loaded file to a pfScene. */
scene = pfNewScene();
pfAddChild(scene, root);
/* Create a pfLightSource and attach it to scene. */
pfAddChild(scene, pfNewLSource());
/* Configure and open GL window */
p = pfGetPipe(0);
pfInitPipe(p, OpenPipeline);
/* Create and configure a pfChannel. */
chan = pfNewChan(p);
pfChanScene(chan, scene);
/*=================================*/
/* */
/* */
/* MakePerspFrustum */
/* */
/* */
/*=================================*/
pfChanNearFar(chan, 0.1f, 1000.0f);
/*
pfChanFOV(chan,ScreenAngle,-1.0f);
*/
x = 0.1*pfTan(120.0/2.0);
z = 0.1*pfTan(120.0/2.0);
pfMakePerspFrust(chan,-x,x+1.0,-z,z);
pfInitClock (0.0f);
/* Simulate for sixty seconds. */
while (t < 60.0f)
{
float s, c;
pfCoord view;
Matrix mat,mat1,mat2;
/* Go to sleep until next frame time. */
pfSync();
/* Compute new view position. */
t = pfGetTime();
pfSinCos(45.0f*t, &s, &c);
/*=================================*/
/* */
/* */
/* pfChanViewMat */
/* */
/* */
/*=================================*/
/*
pfSetVec3(view.hpr, 45.0f*t, -10.0f, 0);
pfSetVec3(view.xyz, 100.0f*s, -110.0f*c, 30.0f);
pfChanView(chan, view.xyz, view.hpr);
*/
pfMakeEulerMat(mat1, 45.0f*t, -10.0f, 0);
pfMakeTransMat(mat2, 100.0f*s, -110.0f*c, 30.0f);
pfMultMat(mat,mat1,mat2);
pfChanViewMat(chan,mat);
/* Initiate cull/draw for this frame. */
pfFrame();
}
/* Terminate parallel processes and exit. */
pfExit();
return 0;
}
/*
* OpenPipeline() -- create a GL window: set up the
* window system, IRIS GL, and IRIS Performer. This
* procedure is executed in the draw process (when
* there is a separate draw process).
*/
static void
OpenPipeline (pfPipe *p)
{
/* Open graphics window. */
foreground();
prefposition(100, 500, 100, 500);
winopen("IRIS Performer");
/* Configure window with reasonable defaults. */
pfInitGfx(p);
/* Create and apply a default material for those models
* without one.
*/
pfApplyMtl(pfNewMtl(pfGetSharedArena()));
/* Create a default lighting model. */
pfApplyLModel(pfNewLModel(pfGetSharedArena()));
}
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:51:36 PDT