programming tools for Windows applications development
  Home  |   SwiftForth Archive  |   SwiftX Archive  |

RE : Re: GLUT

From: Charles Melice <mail_at_forthcad.com>
Date: Mon, 7 Feb 2005 09:11:23 +0100

Another problem can arise with the float stack inside a callback
definition:

:NONAME ( -- res )
    [DEFINED] NUMERICS [IF] #NS FSTACK [THEN] \ always use this =
preambule !
    ... your code here ...
; 4 CB: TheCallback

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
0 400 0 500 gluOrtho2D=20
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 Mon Feb 07 2005 - 00:12:57 PST

This archive was generated by hypermail 2.2.0 : Thu Nov 20 2008 - 03:04:35 PST