[Fluxus] drawing instances

evan.raskob [lists] lists at lowfrequency.org
Thu Jan 22 09:56:40 PST 2009


Ah, I see.  It's a bit of a gray area, no? I'm not sure I see the  
point in just instancing a geometric object?  I suppose the docs are  
a good place for expounding on this.  I understood "instance" to mean  
something more complex.  I suppose it's a bit late, but I'd suggest  
changing "draw-instance" to "draw-primitive" so it's more in line  
with drawing primitives and nothing else.

It's more a semantic thing than anything else, as your code below is  
just as easy to implement.

Cheers
Evan



On Jan 22, 2009, at 2:00 PM, Dave Griffiths wrote:

> On Thu, 2009-01-22 at 14:38 +0100, gabor papp wrote:
>>> I can define an object instance with a scale, transform, and texture
>>> attached to it, but when I try to draw it, the instance is drawn
>>> un-textured, although scale and shape are both set properly.  I  
>>> think
>>>  this is a bug?
>> as far as i can tell, scale is not set properly either. this is  
>> because
>> the instance is drawn with the current state.
>>
>> try to set the texture globally as a workaround.
>> (define texture (load-texture "temple.png"))
>
> It's not exactly a bug - the instance should use the current state, as
> it's supposed to behave like draw-cube and friends.
>
> I'd do something like this:
>
> (define master-sphere (build-sphere 30 30))
>
> ; you might also want to do
> (with-primitive master-sphere
>     (hide 1))
>
> (define (draw-my-sphere)
>     (with-state
>         (texture (load-texture "temple.png")) ; not really any  
> slower than storing tex0
>         (scale 2)
>         (draw-instance master-sphere)))
>
> (define (render)
>     (with-state
>         (translate (vector 0 2 0))
>         (draw-my-sphere)
>         (translate (vector 0 2 0))
>         (draw-my-sphere)))
>
> (every-frame (render))
>
>




More information about the Fluxus mailing list