December 2010
6 posts
3 tags
Render to texture - frame and render buffers
I finally got to the point where I needed to upgrade my render to texture routines. For a long time I’d copy the pixels from the video ram to conventional ram which consumes quites some cycles and loweres performance considerably. This is of course oldskool and not a good idea (performance wise). In addition, the method was limited to handling quadratic textures in power of two sizes (e.g....
2 tags
Most useless javascript
I’m pretty sure that most of you have seen the YouTube movie about the most useless machine ever build. Below is a script that does exactly the same - just without the gimmick and thus not quite as funny as the YouTube original :-)
Link to most useless machine / javascript
2 tags
Shader fiddling
Once in a while you just want to get away from big projects or major design choices and get back to basics. In my case this means plotting simple pixels on a blank screen.
However, I am a modern person and plotting simple pixels on a blank screen no longer means direct access to VGA memory at 0A000h. In these days of GPUs and modern APIs there is no such concept as a simple pixel (well there is,...
3 tags
Follow up on scoped OpenGL
Ah, yesterdays post seemed to stir some of my readers - always nice to observe other peoples reactions to my thoughts.
The two major concerns I met were:
“The macro at the bottom will impact my code - I have to fragment a whole lot more than I would like to!”
“Using the scoped definitions I am no longer able to enable/disable features on a per line basis”
Ad 1) Well...
3 tags
Use the compiler to keep track of OpenGL
In a world of rapid development and an emphasis on lowering bugs and perhaps not specifically speed - I have found it usefull to take advantage of the C++ stack for keeping track of my OpenGL states.
Sounds weird? Well, yes. Reviewing 10 years of OpenGL code has boiled down to heaps of enable/disable and begin/end statements covered with late night debugging figuring out why stuff doesn’t...
5 tags
Translating mouse clicks
Building user interfaces for games or other applications for PC and Mac requires input handlers for mouse, keyboard, etc. I often tend to forget how easy it is to unwrap the 2D-mouse coordinates into 3D-screenspace coordinates. Below is a snippet that I use - it takes 2D-screen coordinates as inputs and unprojects using the model view and projection matrices. As a little bonus it will read the...