![]() |
||
| Home | SwiftForth Archive | SwiftX Archive | |

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:
:NONAME
GL_COLOR_BUFFER_BIT glClear
1 1 1 glColor3ub
GL_POLYGON glBegin
200 125 glVertex2i
100 375 glVertex2i
300 375 glVertex2i
glEnd
glFlush
; 0 CB: DisplayCB
:NONAME ( key x y -- )
2drop [char] q =
if
quit
then
; 3 CB: checkkeyCB
\ dummy arguments for GLUT, the rascal
variable argc \ number of arguments
variable argv \ number of arguments
create args ," -a" 0 c,
0 value win
: main ( -- )
1 argc ! \ init dummy argument vars
args argv !
argc args glutInit
GLUT_RGB glutInitDisplayMode
600 350 glutInitWindowSize
z" Triangle" glutCreateWindow to win
0 0 0 0 0 0 0 0 glClearColor
0 400 0 500 gluOrtho2D
DisplayCB glutDisplayFunc \ Callback
\ checkkeyCB glutKeyboardFunc
glutMainLoop ;
It gets as far as glutMainLoop and then crashes with an ACCESS VIOLATION. : (
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.
Roger
----------------------------------------------------------------------
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 Thu Dec 11 2003 - 21:03:06 PST
This archive was generated by hypermail 2.2.0 : Thu Nov 20 2008 - 03:04:32 PST