Friday, August 31, 2012
Friday, August 10, 2012
Tuesday, May 1, 2012
[Python] Unofficial Windows Binaries for Python Extension Packages
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pymedia
Monday, April 23, 2012
Wednesday, February 8, 2012
Vizard: add nodes.
There are some nodes we'd better remember.
<viz>.addRenderNode
<viz>.addRenderTexture
<viz>.addBlankTexture
<viz>.addTexture
<viz>.addTextureFromBuffer
<viz>.addVideo
<viz>.addAudio
<viz>.addGroup
<viz>.objectGroup
Display background texture
http://kb.worldviz.com/articles/813
Tuesday, January 10, 2012
Shader: Water-Fire-Sky
http://www.bonzaisoftware.com/
This application demonstrates the realistic rendering of clean and foggy water, Fire and Sky. A tutorial about the water effect is included. It also features y-axis billboarding and simple collision detection/response.
You need a graphics card supporting Vertex & Fragment programs to see all of the effects.
This application demonstrates the realistic rendering of clean and foggy water, Fire and Sky. A tutorial about the water effect is included. It also features y-axis billboarding and simple collision detection/response.
You need a graphics card supporting Vertex & Fragment programs to see all of the effects.
Wednesday, September 14, 2011
python: pitfalls
http://zephyrfalcon.org/labs/python_pitfalls.html
This one bites beginners over and over again. It's really a variant of #2, combined with unexpected behavior of default arguments. Consider this function:
This was expected. But now:
Maybe you expected that the output would be [666] in all cases... after all, when popo() is called without arguments, it takes [] as the default argument for x, right? Wrong. The default argument is bound *once*, when the function is *created*, not when it's called. (In other words, for a function
Solution: This behavior can occasionally be useful. In general, just watch out for unwanted side effects.
5. Mutable default arguments
This one bites beginners over and over again. It's really a variant of #2, combined with unexpected behavior of default arguments. Consider this function:
>>> def popo(x=[]): ... x.append(666) ... print x ... >>> popo([1, 2, 3]) [1, 2, 3, 666] >>> x = [1, 2] >>> popo(x) [1, 2, 666] >>> x [1, 2, 666]
This was expected. But now:
>>> popo() [666] >>> popo() [666, 666] >>> popo() [666, 666, 666]
Maybe you expected that the output would be [666] in all cases... after all, when popo() is called without arguments, it takes [] as the default argument for x, right? Wrong. The default argument is bound *once*, when the function is *created*, not when it's called. (In other words, for a function
f(x=[]), x is *not* bound whenever the function is called. x got bound to [] when we defined f, and that's it.) So if it's a mutable object, and it has changed, then the next function call will take this same list (which has different contents now) as its default argument.Solution: This behavior can occasionally be useful. In general, just watch out for unwanted side effects.
Subscribe to:
Posts (Atom)