[fluxus] rendering 4D (newbie questions)

Claude Heiland-Allen claudiusmaximus at goto10.org
Sat Feb 25 19:20:03 PST 2006


I think I found a bug:

 From the manual:
"(mouse-button b) returns true if the corresponding mouse button has 
been pressed this frame."

In fluxus-0.8, (mouse-button b) seems to ignore the value of b, and 
returns non-0 on mouse-up and 0 on mouse-down.  See the attached script 
  - an attempt at making a two-player 3D tic-tac-toe game.  The 
intention is that left button makes balls green, and right button makes 
balls red, but it doesn't work - both buttons have the same effect, and 
it's only button-press and button-release that change anything.


On with the reply:


Artem Baguinski wrote:
> the math functions are limited to 3d, while vectors are just normal  
> scheme vectors and can be of any arity.

Ok.

> 4d cube really does not involve that much math to want to do it in C.  
> if i understand it correctly the slow part of your program was  
> rendering the stuff, that's where opengl will help. Scheme on the  other 
> hand will help to get the results fast.

If I was proficient in Scheme, I guess - but time spent learning is time 
well spent :-)

> I'd like to have a look at your sources and help get it run in fluxus.

Thanks!

> using lists would be wrong indeed. vectors are more efficient.

Ok.  Is there a Scheme manual online somewhere that documents all the 
functions?

>> 3)  How would I go about constructing a (distorted) cube, given 8
>> 3-vectors for the vertices?  From my brief reading, I guess I would  use
>> (build-cube) and (pdata-set ...) to move the vertices - is this on the
>> right track?
> 
> sounds right.

I tried that, but it seems that the (build-cube) primitive has more than 
8 vertices, confusingly.  And my attempts with (build-polygons) failed 
horribly, I even managed to make fluxus segfault a few times with my 
broken code.

>> 4)  I noticed an (opacity n) function - does this work in terms of
>> solids (so you see less and less the thicker the object is) or in  terms
>> of surfaces?
> 
> i had a look at your pages but i still don't get what you mean by  solid 
> rendring. the screenshot you've got there is doable with a  bunch of 
> poligons no?

This animated gif is what I had in mind by "solid", if that makes 
anything clearer:

http://claudiusmaximus.goto10.org/files/coding/hypercube/hypercube-0.3.9.gif

Each of the 8 subcubes is rendered in 1 bit of the 8 bit pixel, and the 
palette is calculated so the overlap of the polygons in each bit of each 
pixel shows an average of the colours assigned to each subcube.

> opacity just sets the opacity of the paint you're using. with opnengl  
> you mostly draw points, lines and polygons, so it's their paint  opacity 
> that you can control.

Ah, I understand now.  But, I think I found a bug with opacity, probably 
down to something other than fluxus itself:  depending on how you rotate 
the view, sometimes the opacity jumps to 1 instead of the value I set it 
to.  Compare these two screen grabs, all I did between them was rotate 
the view slightly:

http://claudiusmaximus.goto10.org/files/temp/fluxus/sphere-opacity-bug/sphere-opacity-bug-1.jpg
http://claudiusmaximus.goto10.org/files/temp/fluxus/sphere-opacity-bug/sphere-opacity-bug-2.jpg

Are objects only transparent in one direction?

>> *) Here's what I have done so far, using libsdl and libpng (source
>> should compile on Linux and OS X and there is a Windows build too,
>> compiled by a friend).
>>
>> http://claudiusmaximus.goto10.org/files/coding/hypercube/
>> http://claudiusmaximus.goto10.org/index.php?page=gallery/digital/ 
>> hypercube
> 
> nice pictures ;-)

:-)

> have you seen the hypercube and related hacks from XScreensaver?

Not to my recollection, no - I should check it out I guess.


Claude
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: tic-tac-toc-toe.scm
URL: <http://lists.pawfal.org/pipermail/fluxus-pawfal.org/attachments/20060226/08e9904f/attachment.ksh>


More information about the Fluxus mailing list