Slava,

The 'opengl' vocabulary has this word:

: gl-vertex ( point -- )
    dup length {
        { 2 [ first2 glVertex2d ] }
        { 3 [ first3 glVertex3d ] }
        { 4 [ first4 glVertex4d ] }
    } case ;

This sort of generic behaviour is needed to make higher level words which 
independent of whether acting in 2d or 3d space. For example, this line-strip 
word works with 2d or 3d points:

: line-strip ( seq -- ) GL_LINE_STRIP [ [ gl-vertex ] each ] do-state ;

The problem is the inefficiency due to the dispatch on length of the vertex 
data structure.

You're been hacking on the compiler lately so I thought I'd bring this issue 
up to see if you have a strategy for code like this.

I'm guessing that we need a way to declare things like 2d-point, 3d-point, 
2d-point-float, etc. For something like line-strip to be completely optimal, 
I guess we'd need a way to declare "array of 2d-point-float".

Ed

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to