Erkaman / wireframe-world

An infinite wireframe world in WebGL
https://erkaman.github.io/wireframe-world/www/demo.html
MIT License
359 stars 32 forks source link

XScreensaver #1

Open snshn opened 8 years ago

snshn commented 8 years ago

Beautiful.

How much work would it be to make a screensaver fox X11 out of this, you think?

Erkaman commented 8 years ago

I am not familiar with XScreensaver, so I can't say anything about that part.

However, concerning the graphics part, the demo doesn't really use any advanced WebGL features at all, so porting it to C/C++ OpenGL should not be very hard at all.

But you would have to fix a small bug before you can use it as a screensaver: if the demo goes on for too long, then there will be missing triangles and stuff in some places. This is because the camera keeps moving forward in the demo, and so the chunks will, after a while, be drawn at positions with VERY high z-coordinate values(because the camera is moving in the z-direction). If the demo goes on for too long, then regular 32-bit floating values(that is, GL_FLOAT) are simply not enough to store those high z-coordinates values, so it starts visually bugging out a bit. but it doesn't crash or anything, it just looks a bit bad.

The solution to the above is that you, instead of moving the camera, keeps moving the chunks towards the camera. And the camera is kept entirely immobile. But since the chunks move to the camera, you get the illusion that the camera is moving. So this looks identical to the current demo, but you will not need any high z-coordinates values in this case, so the visual bugs disappears.

Anyways, I currently don't have time to write a screensaver. Maybe I will have time the next weekend, possibly. But if you feel like it, you can do it yourself. The code is well-commented, so porting should not be hard, I hope. But if anything in the code is unclear, please ask and I will clarify.

snshn commented 8 years ago

Thank you for a quick and very elaborate response. I hope me or somebody else will port it to work as a screensaver on GNU/Linux and such once there's enough free time.