Trying your example, both gadgets are rendered in the same window if I
comment parts of draw-gadget* like the following. Hopefully this helps to
find your issue.

M: testwin draw-gadget* ( gadget -- )
    ! GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT bitor glClear
    ! GL_PROJECTION glMatrixMode glLoadIdentity
    ! -400.0 400.0 -400.0 400.0 0.0 4000.0 glOrtho
    ! 100 100 100 0 0 0 100 0 0  gluLookAt
    ! GL_MODELVIEW glMatrixMode
    ! glLoadIdentity
    color>> first3  glColor3f
    GL_TRIANGLES [
        0 0 0 glVertex3f
        400 0 0 glVertex3f
        0 400 0 glVertex3f
    ] do-state ;


Jon


On Tue, Mar 4, 2014 at 10:16 PM, JF et Diane BIGOT <jeff.bi...@wanadoo.fr>wrote:

> Hi
>
>
>
> I try to display several opengl gadgets in a single window but I have a
> rendering problem. Instead of displaying every gadgets, only one is shown
> and it is spread over the whole main window.
>
>
>
> I wrote the simple example hereunder to illustrate what happens. I would
> like that the window "Multi Wins" display the content of both "green Win"
> and "Red Win".
>
>
>
> If someone could point out what I missed it would be really great.
>
> Thanks by advance
>
>
>
> Jeff
>
>
>
> --------------------------------
>
>
>
> USING: kernel ui ui.gadgets ui.gadgets.worlds ui.gadgets.packs
> ui.render opengl opengl.gl opengl.glu accessors namespaces accessors
> sequences math variables combinators ui.utils opengl opengl.demo-support ;
>
> IN: testwingl
>
> TUPLE: testwin  < gadget color ;
>
> : <testwin>  ( color -- gadget ) testwin  new swap >>color ;
>
> M: testwin pref-dim* ( gadget -- dim )   drop { 300 300 } ;
>
> M: testwin draw-gadget* ( gadget -- )
>     GL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT bitor glClear
>     GL_PROJECTION glMatrixMode glLoadIdentity
>     -400.0 400.0 -400.0 400.0 0.0 4000.0 glOrtho
>     100 100 100 0 0 0 100 0 0  gluLookAt
>     GL_MODELVIEW glMatrixMode
>     glLoadIdentity
>     color>> first3  glColor3f
>     GL_TRIANGLES [
>         0 0 0 glVertex3f
>         400 0 0 glVertex3f
>         0 400 0 glVertex3f
>     ] do-state ;
>
> : greenwin ( -- gadget )  { 0.5 1 0 } <testwin> ;
> : redwin ( -- gadget )    { 1 0 0 } <testwin> ;
>
> : multi-wins ( -- gadget )  <shelf>  { 2 2 } >>gap
>     greenwin add-gadget     redwin   add-gadget ;
>
> : testwindows ( -- )
>     f T{ world-attributes { title "green Win" } } clone
>     greenwin       >>gadgets open-window
>     f T{ world-attributes { title "Red Win" } } clone
>     redwin       >>gadgets open-window
>     f T{ world-attributes { title "Multi Wins" } } clone
>     multi-wins   >>gadgets open-window  ;
>
>
>
> ------------------------------------------------------------------------------
> Subversion Kills Productivity. Get off Subversion & Make the Move to
> Perforce.
> With Perforce, you get hassle-free workflows. Merge that actually works.
> Faster operations. Version large binaries.  Built-in WAN optimization and
> the
> freedom to use Git, Perforce or both. Make the move to Perforce.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>
------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to