<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
I have version 5.2.1 for windows 32-bit<br><br>I'm trying to make an OpenGL program for a roguelike, so, I'm trying to get a frame that can be updated and interacted with.<br><br>The problem is that after i practically copied gl-frame and gears to get a canvas class going and started trying simple drawing, i realized that when the canvas worked, the frame just freezed (or froze?).<br><br>What i mean is, everything works fine, the polygons are drawn, things are in the right color, things are placed where they should, but after that, when the program stops, the frame just stays there, i can't resize it, i can't move it, i can't close it and i can't interact to it by pressing keys (which i think work fine).<br><br>For some strange reason, gears does work fine.<br><br>In case it's important, i have a VIA S3G UniChrome Pro IGP graphics card, have windows XP and this is my code<br><br>#lang racket<br>(require sgl<br> sgl/gl-vectors<br> racket/gui)<br><br>(define WIDTH 800)<br>(define HEIGHT 800)<br><br>(define-syntax (add-key-maps stx)<br> (syntax-case stx ()<br> ((_ (key fn) ...)<br> (syntax (begin<br> (add-key-mapping key fn) ...)))))<br><br>(define gl-init<br> (lambda ()<br> (gl-clear-color 0.0 0.0 0.0 0.0)<br> (gl-clear 'color-buffer-bit)<br> (gl-color 1.0 1.0 1.0)<br> (gl-ortho 0.0 1.0 0.0 1.0 -1.0 1.0)))<br><br>(define (set-gl-init fn)<br> (set! gl-init fn))<br><br>(define gl-draw void)<br><br>(define (set-gl-draw fn)<br> (set! gl-draw fn))<br><br>(define *key-mappings* '())<br><br>(define (add-key-mapping key fn)<br> (set! *key-mappings* (cons (cons key fn) *key-mappings*)))<br><br>(define (clear-key-mappings)<br> (set! *key-mappings* '()))<br><br>(define (gl-handlekey key)<br> ((cdr (assoc key *key-mappings*))))<br><br>(define init? #f)<br><br>(define gl-canvas%<br> (class* canvas% ()<br> (inherit refresh with-gl-context swap-gl-buffers)<br> <br> (define/override (on-size w h)<br> (with-gl-context<br> (lambda ()<br> (gl-viewport 0 0 w h)<br> (refresh))))<br> <br> (define/override (on-paint)<br> (with-gl-context<br> (lambda ()<br> (unless init?<br> (gl-init)<br> (set! init? #t))<br> (gl-draw)<br> (swap-gl-buffers)<br> (gl-flush)))<br> (refresh))<br> <br> (define/override (on-char key)<br> (gl-handlekey (send key get-key-code))<br> (refresh))<br> <br> (super-new (style '(gl no-autoclear)))))<br><br>(define frame (new frame% (label "No name game")))<br><br>(define canvas (new gl-canvas% (parent frame)<br> (min-width WIDTH)<br> (min-height HEIGHT)))<br><br>(send frame show #t)<br><br>(add-key-maps (#\m (lambda ()<br> (set-gl-draw<br> (lambda () (gl-begin 'polygon)<br> (gl-vertex 0.25 0.75 0.0)<br> (gl-vertex 0.75 0.75 0.0)<br> (gl-vertex 0.75 0.25 0.0)<br> (gl-vertex 0.25 0.25 0.0)<br> (gl-end)))<br> (send canvas on-paint)))<br> (#\n (lambda ()<br> (set-gl-draw<br> (lambda () (gl-begin 'polygon)<br> (gl-vertex 0.4 0.6)<br> (gl-vertex 0.6 0.6)<br> (gl-vertex 0.6 0.4)<br> (gl-vertex 0.4 0.4)<br> (gl-end)))<br> (set! init? #f)<br> (send canvas on-paint))))<br>                                            </div></body>
</html>