Update: Here’s a little JavaScript canvas example to give you some sourcecode… Splines are a nice for interpolation of all kinds of stuff. A very nice, thorough (Bezier) spline documentation with lots of examples can be found here.Catmull-Rom splines are handy, because they always pass through their control points. No fiddling with tangents and stuff.Continue reading “Calculate Catmull-Rom splines using forward differencing”
Category Archives: programming
A little canvas experiment
Here’s some base code for simple canvas animations: When you put this into a HTML file and load it in your browser it should look like this.
Using CriticalSections to synchronize shared resource access
When developing multi-threaded applications you can never be sure when and in which order threads run, so you have to synchronize access to shared resources. Otherwise, for example, one thread could modify a piece of data while another thread reads or modifies it. This can give you inconsistent data or, especially when resource allocation/deallocation isContinue reading “Using CriticalSections to synchronize shared resource access”
Writing a DLL containing C++ classes
Putting functions into a DLL is a good thing. It helps you to reuse stuff, save space on updates, save build time etc. To write a DLL the proper way you have to keep some things in mind though. Those hints are basically the “best-practice” from this page. A DLL is a library, a collectionContinue reading “Writing a DLL containing C++ classes”
Using FrameBufferObjects in shaders
Using FrameBufferObjects in shaders would go something like this: Set up your FBO (see here). Render scene while writing values to gl_FragColor and gl_FragDepth (in our case). You could also have more draw buffers, then you could also write to gl_FragData[0-9]. Keep in mind, that values will be clamped to [0,1] unless you use glClampColorContinue reading “Using FrameBufferObjects in shaders”
FrameBufferObjects in OpenGL
FrameBufferObjects are basically off-screen frame buffers, similar to the regular frame buffer you are normally rendering to. Using FBOs in OpenGL you can do some nice stuff like post-processing or rendering to a texture. There’s a difference between: FrameBufferObjects: FBOs can be bound to / used as a texture, but performance may be lower. RenderbufferObjects:Continue reading “FrameBufferObjects in OpenGL”
Ease functions
Ease functions are important for interpolation of just about anything. Popular functions are “smoothstep” or “ease in” and “ease out”. This images shows what they look like for x[0,1] and y[0,1]: There are other popular functions for ease in and ease out, e.g. y=sin(x*PI/2) resp. y=1-cos(x*PI/2).What is important about those functions is if they’re C1–Continue reading “Ease functions”