Crane Simulator

208 views
Skip to first unread message

Bram Stolk

unread,
Jan 25, 2014, 12:52:43 AM1/25/14
to emscripte...@googlegroups.com
Hi,


Here's the first version of the emscripted port of my Crane Simulator:
"The Little Crane That Could."

http://stolk.org/tlctc/js/

Use arrow keys to drive truck, and on screen levers to control the crane.
Drag mouse for camera control, +/- to zoom.

If you try it out, please let me know your findings.
The decompression is rather slow (slower than the download) but the files are nicely compacted.

I'm amazed by what emscripten is able to do for me. (Pretty much everything I do in C, except the UDP sockets.)

Keep up the good work!

  Bram

Jukka Jylänki

unread,
Jan 25, 2014, 4:04:49 AM1/25/14
to emscripte...@googlegroups.com
Hey, I manage to consistently crash Firefox Nightly on this - could you freeze this exact version of the page to some location that stays alive? I'm going to submit a crash report about this.

   Jukka


2014/1/25 Bram Stolk <b.s...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Bram Stolk

unread,
Jan 25, 2014, 4:16:42 AM1/25/14
to emscripte...@googlegroups.com
Sure,

I will keep a permanent copy at http://stolk.org/tlctc/bugrep/

Does the browser completely crash?

On OSX, the javascript bails on an assert because the framebuffer is incomplete.
I use a depth-only texture, which Version 32.0.1700.77 chrome does not like.

I tried adding glDrawbuffer( GL_NONE ) but this symbol is undefined during linking?
Does emscripten link against GL or GLES2 when I build sdl sources?

Bram



--
You received this message because you are subscribed to a topic in the Google Groups "emscripten-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/emscripten-discuss/tzZxpzjWFEs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to emscripten-disc...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.



--

“Programming today is a race between software engineers striving to build bigger and better idiot- proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” (R Cook).

Jukka Jylänki

unread,
Jan 25, 2014, 4:37:55 AM1/25/14
to emscripte...@googlegroups.com
Yeah, looks good though, it seems to be hitting an assert, so nothing monstrous I hope.

That depth-only FBO thing sounds familiar, I've reported similar items some time ago, see


As a workaround, one has to add a dummy color buffer to the FBO.


2014/1/25 Bram Stolk <b.s...@gmail.com>

Alon Zakai

unread,
Jan 25, 2014, 12:18:52 PM1/25/14
to emscripte...@googlegroups.com
I get an out of memory error or my machine when trying to run it.

Is it fully optimized (-O2)?

Perhaps related to compression, any chance you can put up a version without the lzma compression?

- Alon

Bram Stolk

unread,
Jan 25, 2014, 12:31:25 PM1/25/14
to emscripte...@googlegroups.com
OK,

Uncompressed version, with browser fix that avoids depth-only textures, at:


It runs on my HD3000 MacBook Air now :-)
Albeit slowly due to the crappy GPU in that machine.

It's really big though: 16mb js, 24 mb data, so be patient.

Should I have used a larger value than -s TOTAL_MEMORY=67108864 ?

  Bram

Alon Zakai

unread,
Jan 25, 2014, 12:35:48 PM1/25/14
to emscripte...@googlegroups.com
You should use enough TOTAL_MEMORY for the app, if that value is sufficient for it to run then no more is needed.

I see unminified function names in the generated code, so I think this is an -O1 or -O0 build, and not -O2?

I get a webgl error,

Error: WebGL: Retrieving a WebGL context from a canvas via a request id ('webgl') different from the id used to create the context ('experimental-webgl') is not allowed. tlctc.js:6097
Error: WebGL: getExtension('MOZ_WEBGL_depth_texture'): MOZ_ prefixed WebGL extension strings are deprecated. Support for them will be removed in the future. Use unprefixed extension strings. To get draft extensions, set the webgl.enable-draft-extensions preference. tlctc.js:6100
null tlctc.js:6101
[object WebGLExtensionDepthTexture] tlctc.js:6102
Error: WebGL: clear: incomplete framebuffer tlctc.js:6606
uncaught exception: Assertion failed: err == GL_NO_ERROR, at: ../Android/Game/ctrl.cpp,550,ctrl_drawShadow at stackTrace@http://stolk.org/tlctc/js-uncompressed/tlctc.js:1264
___assert_fail@http://stolk.org/tlctc/js-uncompressed/tlctc.js:6558
Runtime.dynCall@http://stolk.org/tlctc/js-uncompressed/tlctc.js:693
Browser_mainLoop_runner@http://stolk.org/tlctc/js-uncompressed/tlctc.js:6133

- Alon

Bram Stolk

unread,
Jan 25, 2014, 1:03:02 PM1/25/14
to emscripte...@googlegroups.com
Whoa! Still incomplete frame buffer?

It seems the work around I put in does not always work.

Anyways... I thought a little more on this depth buffer issue.
I think it may actually be an emscripten bug, not a browser bug.

The problem is that some platforms (like windows) need:
glDrawBuffer( GL_NONE );
glReadBuffer( GL_NONE );
When using a depth only texture.

When using emscripten, this compiles, but will not link due to missing symbols.

BTW: glDrawBuffer and glReadBuffer are part of OpenGL, but missing in ES2.
I don't know which one is used with SDL, but if emscripten can use these calls, I think the issue will be solved.

/home/bram/src/emscripten/em++ -DJS -DLANDSCAPE -s ASM_JS=1 -Wno-warn-absolute-paths -I../Models.game/geom -I../Models.editor/geom -I../../Base/C -I../Editor/C -I../PI -I../PI/WorldObjects -I../PI/VehicleObjects -I../Android/Game -I/home/bram/src/opende/include -I/home/bram/include -g -Wall -Wno-missing-braces -MMD -MP -DDEBUG -DdDEBUG -O1 -o bin/tlctc.html  src/main.cpp \
    -lgame -lpi -led -lvehicleobjects -lworldobjects -lbase -lode -L. -L/home/bram/src/opende.js/ \
    -s TOTAL_MEMORY=67108864 \
    --preload-file Sounds@ \
    --preload-file Textures@ \

warning: unresolved symbol: glReadBuffer
warning: unresolved symbol: glDrawBuffer
warning: unresolved symbol: nextafterf

bram@Ubuntu64:~/apps/LittleCrane/JS$

Lastly: yes, -O1 is used.
For my future builds, I will switch to -O2.

Thx,

  Bram

Jukka Jylänki

unread,
Jan 25, 2014, 2:33:22 PM1/25/14
to emscripte...@googlegroups.com
None of glReadBuffer/glDrawBuffer/glDrawBuffers exist in GLES2 or WebGL - they are not needed in these APIs to create a depth buffer-only FBO. If your FBO is incomplete even when you did add a dummy color buffer, then the bug must be somewhere else.


2014-01-25 Bram Stolk <b.s...@gmail.com>

Chad Austin

unread,
Jan 25, 2014, 5:08:17 PM1/25/14
to emscripte...@googlegroups.com
Windows 7, Firefox 26, GeForce GTX 460:

DEBUG build
Built on Jan 25 2014 at 01:04:14
GL_RENDERER: Mozilla
GL_VERSION: WebGL 1.0
GL_SHADING_LANGUAGE_VERSION: OpenGL ES GLSL 1.00 (WebGL)
Does not support depth textures.
Does not support discard framebuffer.
Does not support vertex array.
Does not support half float textures.
GL_MAX_VERTEX_UNIFORM_VECTORS 254
GL_MAX_FRAGMENT_UNIFORM_VECTORS 221
GL_MAX_VARYING_VECTORS 10
GL_MAX_TEXTURE_IMAGE_UNITS 16
Compiled vertex shader Hud
Compiled fragment shader Hud
Compiled vertex shader Main
Compiled fragment shader Main
Compiled vertex shader ShadowNDT
Compiled fragment shader ShadowNDT
Compiled vertex shader Edge
Compiled fragment shader Edge
Hud program loaded as 1
Main program loaded as 8
Shadow program loaded as 17
Edge program loaded as 21
Loaded jobdone(512x512) as 1c at 0x206a9b6
Loaded button_pause(56x56) as 1d at 0x206a9ba
Loaded cyclicplate(240x240) as 1e at 0x206a9ba
Loaded text_right(128x32) as 1f at 0x206a9b9
Loaded sixaxis(1280x512) as 20 at 0x206a9b7
Loaded text_rotate(128x32) as 21 at 0x206a9ba
Loaded steering_wheel(256x256) as 22 at 0x206a9bd
Loaded text_grapple(128x32) as 23 at 0x206a9bb
Loaded text_left(128x32) as 24 at 0x206a9b8
Loaded dashboard(768x256) as 25 at 0x206a9b8
Loaded slider_empty(128x224) as 26 at 0x206a9bb
Loaded text_antitorque(128x32) as 27 at 0x206a9be
Loaded text_empty(130x32) as 28 at 0x206a9b9
Loaded text_extend(128x32) as 29 at 0x206a9ba
Loaded text_collective(128x32) as 2a at 0x206a9be
Loaded accelerator_handle(104x40) as 2b at 0x206a9c1
Loaded text_bucket(128x32) as 2c at 0x206a9ba
Loaded accelerator_panel(128x200) as 2d at 0x206a9c0
Loaded cyclicstick(64x64) as 2e at 0x206a9b9
Loaded gameover(512x512) as 2f at 0x206a9b7
Loaded text_elevate(128x32) as 30 at 0x206a9bb
Loaded slider_knob(64x64) as 31 at 0x206a9b9
Loaded text_bend(128x32) as 32 at 0x206a9b8
Loaded slider_background(128x224) as 33 at 0x206a9c0
Loaded slider_handle(128x72) as 34 at 0x206a9bc
Loaded level_hockeyriot(512x256) as 35 at 0x206a9bf
Loaded level_bridge(512x256) as 36 at 0x206a9bb
Loaded level_chemistry(512x256) as 37 at 0x206a9be
Loaded level_yukon(512x256) as 38 at 0x206a9ba
Loaded level_cleanup(512x256) as 39 at 0x206a9bc
Loaded level_superpac(512x256) as 3a at 0x206a9bd
Loaded level_assy(512x256) as 3b at 0x206a9b9
Loaded level_lockdown(512x256) as 3c at 0x206a9bd
Loaded level_daredevil(512x256) as 3d at 0x206a9be
Loaded level_temple(512x256) as 3e at 0x206a9bb
Loaded level_sandbox(512x256) as 3f at 0x206a9bc
Loaded level_babel(512x256) as 40 at 0x206a9ba
Loaded level_dump(512x256) as 41 at 0x206a9b9
Loaded level_parkinglot(512x256) as 42 at 0x206a9bf
Loaded level_towercrane(512x256) as 43 at 0x206a9bf
Loaded level_factory(512x256) as 44 at 0x206a9bc
Loaded level_egghunt(512x256) as 45 at 0x206a9bc
Loaded level_luxor(512x256) as 46 at 0x206a9ba
Loaded level_seesaw(512x256) as 47 at 0x206a9bb
Loaded level_canal(512x256) as 48 at 0x206a9ba
Loaded level_ufo(512x256) as 49 at 0x206a9b8
Loaded level_hazard(512x256) as 4a at 0x206a9bb
Loaded level_court(512x256) as 4b at 0x206a9ba
Loaded level_hearth(512x256) as 4c at 0x206a9bb
Loaded level_powerlift(512x256) as 4d at 0x206a9be
Loaded level_stackem(512x256) as 4e at 0x206a9bc
Loaded level_trainlot(512x256) as 4f at 0x206a9bd
Loaded menupromo(128x96) as 50 at 0x206a9b8
Loaded menusettings(128x96) as 51 at 0x206a9bb
Loaded stamp(128x128) as 52 at 0x206a9b4
Loaded menuplay(128x96) as 53 at 0x206a9b7
Loaded menuunlock(128x96) as 54 at 0x206a9b9
Loaded menurestart(128x96) as 55 at 0x206a9ba
Loaded gamepadbuttoncross(32x32) as 56 at 0x206a9c0
Loaded gamepadbuttoncircle(32x32) as 57 at 0x206a9c1
Loaded menubuy(128x96) as 58 at 0x206a9b6
Loaded menunobuy(128x96) as 59 at 0x206a9b8
Loaded menuprev(128x96) as 5a at 0x206a9b7
Loaded menunext(128x96) as 5b at 0x206a9b7
ERR No depth texture support.
Chad Austin
Technical Director, IMVU

Reply all
Reply to author
Forward
0 new messages