WebGL Mini-Contest

Luminary
Posts: 5,143
Joined: 2002.04
Post: #16
The garbage-in-texImage2D bug is https://bugs.webkit.org/show_bug.cgi?id=32188
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #17
Thanks to olliej's tip about the context identifier and a bit of digging through the WebKit source to find a couple API changes, my app now works on the latest WebKit nightly (and I'm still supporting 50039).
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #18
Working on a 3D platformer here: http://sacredsoftware.net/temp/AlexWebGL/

Doesn't do a whole lot yet, but I'll be updating that location periodically as I go along.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #19
ThemsAllTook and I at least have agreed that we're having enough fun here to take another 7 days over this contest. Our new ending date is therefore the end of Sunday 13 December 2009.

Any other entrants (are there any? nobody's posted!) can of course choose to finish at the scheduled time, or join us in this glorious extension! (no, I didn't get much sleep this weekend).
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #20
The link above now has 4 levels of gameplay. In case anyone's keeping score, this can be considered the "weekend version" of the game. I'll post a new link to the "extension version" once there's more to see.
Quote this message in a reply
Moderator
Posts: 452
Joined: 2008.04
Post: #21
Very cool alex! I won Wink Keith's is looking good too Grin

Howling Moon Software - CrayonBall for Mac and iPhone, Contract Game Dev Work
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #22
Man, I haven't won Alex's yet :|

Latest WebKit nightly build (51788) fixes the transparent pixel-junk bug. Yay!

I'll probably start ripping out support for older WebKits shortly.
Quote this message in a reply
Nibbie
Posts: 3
Joined: 2009.12
Post: #23
OneSadCookie Wrote:Latest WebKit nightly build (51788) fixes the transparent pixel-junk bug. Yay!

Please file reports on any other bugs you find Grin
Quote this message in a reply
Nibbie
Posts: 3
Joined: 2009.12
Post: #24
Woo! There's now a public draft available at http://www.khronos.org/webgl/
Quote this message in a reply
Nibbie
Posts: 1
Joined: 2009.12
Post: #25
OneSadCookie Wrote: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.

Looks pretty cool! I'm happy that someone's using danc's tilesets in a WebGL game :-) There are some bugs preventing it from working in Firefox, though... here's what I've found. Once those are worked around, it works pretty well Smile

There's a weird race condition in loadTexture/ResourceManager if the image happens to be the last thing to load. I see the 'load' event firing into prototype, which is handled by the xhrImage success function in loadImage... but that calls in to resman.loaded() before it calls the closure, and it's the closure that sets images['tiles'] to the image.

The ResourceManager success handler will then call loadPlanes, which eventually triggers the error() in drawYSlice, but the object still gets returned with a null 'image' property.. and all subsequent draws fail, because they try to grab command.image.width/.height, with image being null.

Checking for "if (!images['tiles']) return;" in the ResourceManager success handler seems like it could work, but if the tiles image is the last resource to load, then things never get initialized properly (because images['tiles'] will be null when we get into the ResourceManager's success call). My hacky fix was to just call the closure in loadTexture before calling the resource manager's loaded function.

The second issue is the 100% width/height in CSS on the canvas element... this is a WebKit bug that I think they're working on fixing. The CSS style dimensions are independent of the canvas backing store size, which defaults to 300x200 (iirc) if no width/height attributes are given. Setting width/height in CSS to 100% means "take my 300x200 canvas image and scale it up to 100% w/h", which is probably not what you want, quality wise. In this case, canvas.clientWidth/canvas.clientHeight is also used with gl.viewport, but the actual dimensions are 300x200, leading to nothing visible being drawn since you can only see the upper left corner :-)

Instead, you can attach a resize handler to the window and set canvas.width/canvas.height to the appropriate size on resize. Or, the hacky solution is to just set canvas.width/canvas.height from the window's dimensions on launch, as in start() in https://cvs.khronos.org/svn/repos/regist...ngBox.html .

Hope that helps!
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #26
Well, I didn't get as much more done as I wanted to... New version uploaded with sound effects, another level, and a few tweaks: http://sacredsoftware.net/temp/AlexWebGL/

Source archive: http://sacredsoftware.net/temp/AlexWebGL.zip
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #27
As you've probably guessed, I made no (visible) progress despite the extra week.

vladv: I fixed the load race condition (I hope!) before I saw your message, but thanks for the tip about canvas size. That explains what I was seeing in FireFox.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Mini fun Contest EvolPenguin 2 5,068 Nov 14, 2010 11:10 AM
Last Post: EvolPenguin
  Mini-contest: Time & Space Manipulation OneSadCookie 18 14,408 Nov 8, 2009 02:38 PM
Last Post: Oddity007
  21 Day Mini Contest FlamingHairball 2 6,658 Aug 1, 2009 03:03 PM
Last Post: FlamingHairball
  Mini Contest Ideas FlamingHairball 34 21,334 Aug 1, 2009 07:51 AM
Last Post: Oddity007
  "Sticky" mini-contest favorites ThemsAllTook 10 8,093 May 27, 2009 02:10 PM
Last Post: backslash