RE : Re: GLUT

From: Charles Melice <mail_at_forthcad.com>
Date: Sat, 5 Feb 2005 15:04:47 +0100

I have never used GLUT with Forth, but I see some errors
in your code. (see below)

Charles

-----Message d'origine-----
De : sftalk-bounce_at_forth.com [mailto:sftalk-bounce_at_forth.com] De la part =
de
Warrender, Christina E
Envoy=E9 : jeudi 3 f=E9vrier 2005 18:16
=C0 : sftalk_at_forth.com
Objet : [sftalk] Re: GLUT

I have the same question that Roger asked below in 2003 about using GLUT =
and
OpenGL with SwiftForth. I didn't see an answer in the archive - can =
anyone
fill me in? Christy

Has anybody tried using GLUT & OpenGL with SF? I've had success =
displaying
polygons with Charles Melice's window/viewport setting-up code (which I
really really appreciate, btw), but I'd really like to use GLUT so I can
take advantage of the numerous tutorials online that rely on it, and to
enable me to get good mouse/keyboard responsiveness. The callbacks are
giving me trouble, though. I think I've set everything up
correctly:=20
:NONAME=20
GL_COLOR_BUFFER_BIT glClear=20
1 1 1 glColor3ub=20
GL_POLYGON glBegin=20
200 125 glVertex2i=20
100 375 glVertex2i=20
300 375 glVertex2i=20
glEnd=20
glFlush=20
; 0 CB: DisplayCB=20
:NONAME ( key x y -- )=20
2drop [char] q =3D=20
if=20
quit=20
then=20
; 3 CB: checkkeyCB=20
\ dummy arguments for GLUT, the rascal=20
variable argc \ number of arguments=20
variable argv \ number of arguments=20
create args ," -a" 0 c,=20
0 value win=20
: main ( -- )=20
1 argc ! \ init dummy argument vars=20
args argv !=20
argc args glutInit=20
GLUT_RGB glutInitDisplayMode=20
600 350 glutInitWindowSize=20
z" Triangle" glutCreateWindow to win=20

0 0 0 0 0 0 0 0 glClearColor=20
        *"integer" where "single float" are needed...=20
        **********************************************=09
        *void glClearColor(GLclampf red, GLclampf green, GLclampf blue,
GLclampf alpha);
        * a solution...
            | FVARIABLE (fvar)
            |
            | : 4sfparms ( f: x y z t -- ) ( s: -- x y z t )
            | (fvar) DUP SF! @ >R
            | (fvar) DUP SF! @
            | (fvar) DUP SF! @
            | (fvar) DUP SF! @ \ s: z y x
            | SWAP ROT R> ;
        *Function: glClearColor ( r g b a -- )
        *: glClearColor ( f: r g b a -- ) 4sfparms glClearColor ;

0 400 0 500 gluOrtho2D=20
        *"integer" where "double float" are needed...=20
        **********************************************
        *void gluOrtho2D(GLdouble left, GLdouble right, GLdouble bottom,
GLdouble top);
        * a solution ...
            * : SET-WINDOW ( x y xsize ysize -- )
      * THIRD + >R THIRD + SWAP R>
      * S>F S>F S>F S>F f>lh f>lh f>lh f>lh gluOrtho2D ;

DisplayCB glutDisplayFunc \ Callback=20
\ checkkeyCB glutKeyboardFunc=20
glutMainLoop ;=20
It gets as far as glutMainLoop and then crashes with an ACCESS =
VIOLATION. :
(=20
The interesting part though, is sometimes it actually displays a window,
without graphics and still with the access violation - only when i DEBUG =
it,
though.=20
Roger=20

----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com =
For
list command help, send subject "help" to sftalk-request_at_forth.com =
Message
archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and bug=20
reports, please send email to support_at_forth.com
----------------------------------------------------------------------

----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Sat Feb 05 2005 - 06:06:17 PST


Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!

This archive was generated 07-Feb-2012. Archive updated nightly.