iDevGames Forums
WebGL Mini-Contest - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Community Zone (/forum-4.html)
+--- Forum: Contests (/forum-19.html)
+--- Thread: WebGL Mini-Contest (/thread-535.html)

Pages: 1 2


WebGL Mini-Contest - OneSadCookie - Dec 4, 2009 06:23 PM

WebGL:
http://blog.wolfire.com/2009/09/preview-of-webkits-webgl-canvas3d/
http://webkit.org/blog/603/webgl-now-available-in-webkit-nightlies/
http://hacks.mozilla.org/2009/09/webgl-for-firefox/

Contest: make a game, any game, with WebGL. Start now, finish before the end of the weekend. Go.

[ Be aware that enabling WebGL in general is a security risk at this stage, so you may not wish to wander round the general internet with it turned on Wink ]

Usual mini-contest rules -- no prizes, peer judgment by forum poll after the fact.


WebGL Mini-Contest - OneSadCookie - Dec 4, 2009 08:39 PM

We've just discovered that WebGL is nonfunctional in the latest nightly build Sad

It's known to work in 50039 from http://nightly.webkit.org/builds/trunk/mac/2 . If anyone finds a better build that works, please post Wink


WebGL Mini-Contest - GryphonClaw - Dec 5, 2009 12:52 AM

here's a direct link to the nightly build that has working WebGL (for the lazy Wink )
Working WebGL Nightly


WebGL Mini-Contest - OneSadCookie - Dec 5, 2009 03:49 AM

Unfortunately, a bug in current WebKit WebGL means that images with transparency will unavoidably load with pixel junk in the transparent bits. This requires either loading an uncompressed image with a WebGLArray object to work around, or patching WebKit to fix. The patch is trivial (adding a memset, or CGClearRect, or similar to zero the bitmap context's data before drawing the image in imageToTexture() in WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp); I may attempt to build a patched WebKit if I have time.


WebGL Mini-Contest - OneSadCookie - Dec 5, 2009 05:52 AM

The FireFox nightlies seem to have worse problems, multiplying the viewport dimensions by 2 or 3, or something weird like that. They're also throwing syntax errors for my shaders for reasons not obvious to me.


WebGL Mini-Contest - OneSadCookie - Dec 5, 2009 07:42 AM

WebKit doesn't want to build for me, so I don't know how to fix this bug...


WebGL Mini-Contest - OneSadCookie - Dec 5, 2009 08:53 AM

I found a cheap workaround: use a sufficiently large texture that the memory WebGL happens to use happens to be zeroed already.


WebGL Mini-Contest - OneSadCookie - Dec 5, 2009 09:21 AM

Where I'm at, in case my asset loading code is of use to anyone:
http://github.com/OneSadCookie/WebGLGame


WebGL Mini-Contest - Skorche - Dec 5, 2009 11:04 AM

OneSadCookie Wrote:I found a cheap workaround: use a sufficiently large texture that the memory WebGL happens to use happens to be zeroed already.

Heh, they are probably using CG stuff to load them. Had the same problem on the iPhone. If you didn't zero the array that you load an image into, it would be composited over garbage pixels. Can't really do that in javascript...


WebGL Mini-Contest - olliej - Dec 5, 2009 01:05 PM

It's awesome that you're using WebGL it would be great if you could file bugs on the various implementations when you find them.

For the webkit implementation (eg. Safari and Chrome) the bug database is
http://bugs.webkit.org

And for mozilla it's
http://bugs.mozilla.org

For those of you who are having difficulty with the current webkit (and presumably shortly mozilla) nightlys, the WebGL spec recently changed to have a single shared "experimental" prefix rather than the typical vendor prefix. The new string to use for getContext() is "experimental-webgl".


WebGL Mini-Contest - OneSadCookie - Dec 5, 2009 01:07 PM

The problem is that the CGContext they draw the image to is out of your control. You can load the texture from an Image, or from a Canvas, but either way, it goes through the same CGImage->CGBitmapContext(nonzeroed)->texture path, behind the scenes. I thought maybe using the Canvas would skip that, since presumably there's already a CGContext for the canvas, but it doesn't help.


WebGL Mini-Contest - AndyKorth - Dec 5, 2009 01:56 PM

After getting the new webkit, you'll need to run this:

Code:
defaults write com.apple.Safari WebKitWebGLEnabled -bool YES



WebGL Mini-Contest - maximile - Dec 5, 2009 02:28 PM

Sounds like a fun contest. WebGL sounds like a pretty great asset to game makers, especially alongside Webkit's fast JavaScript.

I'm limited to iPhone Internet for the moment, otherwise I'd take part. Good luck to anyone who's entering though.


WebGL Mini-Contest - OneSadCookie - Dec 5, 2009 03:38 PM

[Image: WebGLGameWIP2.png]


WebGL Mini-Contest - OneSadCookie - Dec 5, 2009 09:33 PM

The game now works online, so if you've got a WebKit nightly with WebGL enabled and working, you should just be able to point your browser at http://onesadcookie.com/~keith/WebGLGame/ and play.

The "make a big enough texture to avoid the garbage" solution to the bug I mentioned above is not perfect. For most people, on a freshly-opened WebKit, there'll be no garbage. On subsequent loads, the garbage will get worse and worse until it's unbearable. For some people, every load will be garbage. YMMV.

I'm using HTML5's <audio> to play sounds, and that's causing lots of crashes in FigCRABSInvalidate Blink on 50039 at least.