labc-4dc@e260-4f.berkeley.edu (Erik Talvola) (02/28/89)
As soon as the QRT source was posted, I immediately compiled it on the Sun 3/50 here at Berkeley. After adding a #include<ctype.h> to lexer.c to get toupper() defined, it compiled perfectly. However, I can't get it to run on any of the sample files posted here. Here is what happens if I try to execute the program on the table.qrt file: % ray < table.qrt Quick Ray Trace: Copyright 1988 Steve Koren Version 1.4 GETOBJECT: token=[ GETATTRIB : token=[: GETPRIMITIVE : token=[: Input line number 3 Fatal error code 207: syntax error A similar thing happened with mirrors.qrt. Am I doing anything wrong? I compiled the ray tracer with "gcc -O -m68881" to squeeze out maximum power out of the sucker. -- Erik Talvola | "It's just what we need... a colossal negative talvola@cory.berkeley.edu | space wedgie of great power coming right at us ..!ucbvax!cory!talvola | at warp speed." -- Star Drek
greggt@VAX1.CC.UAKRON.EDU (Gregg F. Thompson) (03/01/89)
In article <10469@pasteur.Berkeley.EDU> talvola@cory.berkeley.edu writes: >% ray < table.qrt >Quick Ray Trace: Copyright 1988 Steve Koren >Version 1.4 >GETOBJECT: token=[ >GETATTRIB : token=[: >GETPRIMITIVE : token=[: >Input line number 3 >Fatal error code 207: syntax error [above message edited] Couple of things to check. Make sure you first get rid of the ^M's at the end of every line (or am I the only one that had that problem). Then make sure you remove XRES and YRES. For some reason the sources don't support it? Now I ran qrt on Ultrix 2.3 with piano.qrt and it ran in one evening and I looked at the size of PIANO.RAW and it was 700,000+ bytes! Does ANYONE have have raw2tmp sources? Infact does anyone have tmp2gif sources too!??! I would rather have the vax do all the work and I just download the gif file (usually a LOT SMALLER than all the other files!) -- To live is to die, to die is to live forever; GRegg Thompson Where will you spend eternity? greggt@vax1.cc.uakron.edu
berry@askone (Berry Kercheval) (03/01/89)
In article <10469@pasteur.Berkeley.EDU>, labc-4dc@e260-4f (Erik Talvola) writes: > >As soon as the QRT source was posted, I immediately compiled it on the >Sun 3/50 here at Berkeley. After adding a #include<ctype.h> to lexer.c >to get toupper() defined, it compiled perfectly. However, I can't get >it to run on any of the sample files posted here. Here is what happens >if I try to execute the program on the table.qrt file: > Aha. Classic problem. The WRT source assume that you have a "safe" toupper(), that is, one that will not modify any characters that are not lower case letters. In other words, toupper('a') gives 'A', and toupper('A') also gives 'A'. Apply this patch to lexer.c: -----cut here---- *** lexer.c Tue Feb 28 11:41:58 1989 --- lexer.c.~1~ Thu Feb 16 07:41:51 1989 *************** *** 6,12 **** **********************************************************/ ! #include <ctype.h> #include "qrt.h" extern int linenumber; --- 6,12 ---- **********************************************************/ ! #include "qrt.h" extern int linenumber; *************** *** 16,30 **** float atof(); # endif - #undef toupper - toupper(c) - int c; - { - if(islower(c)) - return ((c)-'a'+'A'); - else - return c; - } /********************************************************** Transforms all white spaces to blanks --- 16,21 ---- ------end of patch-------
kyriazis@rpics (George Kyriazis) (03/01/89)
Well, I downloaded it also, but my main question is: Is there a Makefile? (I didn't get any). If not, do I just compile all of them together or what? George Kyriazis kyriazis@turing.cs.rpi.edu kyriazis@rdrc.rpi.edu ------------------------------
eephdjh@pyr.gatech.EDU (Haleblian, Jim) (03/01/89)
In article <10469@pasteur.Berkeley.EDU> you write: > >As soon as the QRT source was posted, I immediately compiled it on the >Sun 3/50 here at Berkeley. After adding a #include<ctype.h> to lexer.c >to get toupper() defined, it compiled perfectly. However, I can't get >it to run on any of the sample files posted here. Here is what happens >if I try to execute the program on the table.qrt file: > >GETOBJECT: token=[ >GETATTRIB : token=[: >GETPRIMITIVE : token=[: > This is actually a compatability bug that I ran into when I was porting QRT to the Sequent Balance (and boy, do it screaaaaaaam). I believe you have to change your toupper() call in the GetToken() call to another form of toupper which uppercases only ASCII chars. The problem you're having there is the comment characters are being changed to 'uppercase', and the QRT parser doesn't understand the resulting tokens. Incidentally, I (among others) can confirm the rumor that there are 020/030 881 versions running on the Amiga. They do run darn fast. If anybody's worked on the problem of turning QRT into a distributed raytracer, I'd surely appreciate hearing from him/her. - Jim -- James E. Haleblian "Mac II: The Volkswagen Beetle of Personal Computing." Georgia Insitute of Technology, Atlanta Georgia, 30332 uucp: ...!{akgua,allegra,amd,hplabs,ihnp4,seismo,ut-ngp}!gatech!gitpyr!eephdjh ARPA: eephdjh@pyr.ocs.gatech.edu
talvola@cory.Berkeley.EDU (Erik Talvola) (03/02/89)
In article <99@VAX1.CC.UAKRON.EDU> greggt@VAX1.CC.UAKRON.EDU (Gregg F. Thompson) writes: >In article <10469@pasteur.Berkeley.EDU> talvola@cory.berkeley.edu writes: ... description of problem with QRT >Couple of things to check. Make sure you first get rid of the ^M's at the >end of every line (or am I the only one that had that problem). Then make >sure you remove XRES and YRES. For some reason the sources don't support it? Actually, it was because of a fault toupper() that worked on anything. I wrote a little one that only toupper'd a-z and it worked fine. The file "table.qrt" segmentation faults, but all the others seem to work fine. >Now I ran qrt on Ultrix 2.3 with piano.qrt and it ran in one evening and I >looked at the size of PIANO.RAW and it was 700,000+ bytes! Does ANYONE have >have raw2tmp sources? Infact does anyone have tmp2gif sources too!??! >I would rather have the vax do all the work and I just download the gif file >(usually a LOT SMALLER than all the other files!) If you look in "qrt.h" (or one of the other header files), you will see definitions for the size of the screen, etc. I changed these to 320 by 200 and the resulting .RAW files are ~200K long. This is a little easier to work with. Good luck! -- Erik Talvola | "It's just what we need... a colossal negative talvola@cory.berkeley.edu | space wedgie of great power coming right at us ..!ucbvax!cory!talvola | at warp speed." -- Star Drek
kory@avatar.UUCP (Kory Hamzeh) (03/02/89)
I'm having the following problems with QRT: - Syntax error in the demo input files. The file do look OK. - QRT will hang while reading some the in demo files. - QRT will core dump with Floating Point Exception at the exact same place with some of the demo files. Both the DOS port and the Xenix/386 port behave this way. I have not be able to get a single image traced yet. There must be some portability problems arising. I doubt that Steve Koren would release his software in such a crappy state. If anyone make any headways, please let me know. Thanks, --kory -- ------------------------------------------------------------------------------- Kory Hamzeh UUCP: ..!uunet!psivax!quad1!avatar!kory INTERNET: avatar!kory@quad.com
koren@hpfelg.HP.COM (03/02/89)
> Actually, it was because of a fault toupper() that worked on anything. I Since toupper() seems to be different across different systems, perhaps I will not use it in any future versions. > The file > "table.qrt" segmentation faults, but all the others seem to work fine. This is a problem in lexer.c. There is only one malloc, which reads: if ((s=malloc(strlen(str)))==NULL) change it to: if ((s=malloc(strlen(str)+1))==NULL) and it should work ok. The problem was that strlen() doesn't count the null byte, so malloc wasn't allocating enough space. Since most malloc()s try to line stuff up on byte boundries, it would would sometimes. Sorry. - steve
scott@applix.UUCP (Scott Evernden) (03/03/89)
In article <10469@pasteur.Berkeley.EDU> talvola@cory.berkeley.edu writes: > >As soon as the QRT source was posted, I immediately compiled it on the >Sun 3/50 here at Berkeley. After adding a #include<ctype.h> to lexer.c >to get toupper() defined, it compiled perfectly. However, I can't get >it to run on any of the sample files posted here. Here is what happens >if I try to execute the program on the table.qrt file: > > >Fatal error code 207: syntax error In addition to adding #include <ctype.h> in lexer.c, you need to change the line that uses toupper from: s[x++]=c=toupper(towhite(fgetc(stdin))); to something like c=towhite(fgetc(stdin)); if (islower(c)) c = toupper(c); s[x++]=c; Then it runs just fine. Just another berzerkelyism you need to watch out for... While I'm here, Here is a *really* quick hack I thru together some time ago to view .RAW files on a black and white sun. It's a modified QrtPost.c, which quite rudely draws right onto the framebuffer. /********************************************************* SunQRTPost is a post processor for QRT on the Sun It reads in the QRT file, and draws it right onto the Sun Screen *********************************************************/ #include <stdio.h> #define MAXXRES 640 /* max x resolution */ #define SHIFT 3 /* convert 0..127 to 0..15 */ main(argc,argv) int argc; char *argv[]; { int xres, yres, line; register int x; unsigned short r[MAXXRES], g[MAXXRES], b[MAXXRES]; FILE *in; unsigned char fgetc(); /** open files **/ bitmap = (struct pixrect *) pr_open("/dev/fb"); if (argc == 1) in = stdin; else if ((in = fopen(argv[1],"r"))==NULL) { printf("Couldn't open file %s\n",argv[1]); exit(1); } /** load x and y resolution **/ xres = yres = 0; xres = ((unsigned int)fgetc(in)); xres += ((unsigned int)(fgetc(in) << 8)); yres = ((unsigned int)fgetc(in)); yres += ((unsigned int)(fgetc(in) << 8)); /** print info **/ if (1 < argc) { printf("\nInput file = %s\n", argv[1]); printf("X resolution = %d\n", xres); printf("Y resolution = %d\n\n", yres); } while (!feof(in)) { /* read scan line number */ line = ((int)fgetc(in)); if (line == EOF) break; line |= ((int)(fgetc(in) << 8)); /* read color data */ for (x=0; x<xres; x++) r[x] = ((short)fgetc(in)) & 0xff; for (x=0; x<xres; x++) g[x] = ((short)fgetc(in)) & 0xff; for (x=0; x<xres; x++) b[x] = ((short)fgetc(in)) & 0xff; drawline(line, xres, r, g, b); } fclose(in); /* close files */ } /*************************************************************/ #include <pixrect/pixrect_hs.h> struct pixrect *bitmap; /* top left is.. */ #define XOFF 5 #define YOFF 50 short dither[4][4] = { #if 1 { 10, 6, 9, 5 }, { 2, 14, 1, 13 }, { 8, 4, 11, 7 }, { 0, 12, 3, 15 } #else { 0, 5, 10, 1 }, { 9, 14, 15, 6 }, { 4, 13, 12, 11 }, { 3, 8, 7, 2 } { 14, 5, 10, 15 }, { 9, 0, 1, 6 }, { 4, 3, 2, 11 }, { 13, 8, 7, 12 } #endif }; drawline(y, xres, r, g, b) int y, xres; unsigned short *r, *g, *b; { int x, lum, val; for (x = 0; x < xres; x++) { lum = (30 * (*r++ - 4) + 59 * (*g++ - 4) + 11 * (*b++ - 4)) / 265; /* 0->16 */ val = lum <= dither[(2*x)&3][y&3]; pr_put(bitmap, XOFF+(2*x), YOFF+y, val); val = lum <= dither[(2*x+1)&3][y&3]; pr_put(bitmap, XOFF+(2*x+1), YOFF+y, val); } } /********************************************************* -scott