turbulenz / turbulenz_engine

Turbulenz is a modular 3D and 2D game framework for making HTML5 powered games for browsers, desktops and mobile devices.

Home Page:http://turbulenz.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

attributes out of range

greggman opened this issue · comments

See this stackoverflow question

http://stackoverflow.com/questions/21018524/webgl-not-rendering-textures-on-some-devices/

Turbulenz appears to be using attributes out of range. For example checking Score Rush I see it uses attributes 0, 3, and 8. Why not 0, 1, 2? In any case, WebGL only requires 8 so on a device that only supports 8 attributes 7 is the highest numbered attribute that can be used which means Score Rush is going to fail when trying to use attribute 8.

The mapping from semantic to attribute index that we use is a traditional one. I think it originated when hardware was moving away from fixed-function pipelines to shader-based ones. You can find semantic mappings identical to ours in other places:

http://src.chromium.org/svn/trunk/o3d/core/cross/gl/utils_gl.cc
http://http.developer.nvidia.com/Cg/vp40.html

It is possible that it was something only particular to some video cards.

According to WebGL Stats, only 0.3% of users have less than 16 vertex attributes:

http://webglstats.com/

Perhaps we could reorder the semantics table only for those devices, moving the most esoteric semantics to higher indices...

Whilst we change our code, if you want to make your game work on those devices you could just use other semantics with lower indices, just make sure that both the shader and the vertex stream use the same one.

Thank you greggman and David.
I have had a discussion with Ian previously about this @ the forum. https://groups.google.com/forum/#!topic/turbulenz-engine-users/d9qDsTrEACE. Glad you finally found out what was causing the issue.

I would really like to see this change being put into code, since I lack the knowledge to do it myself.

This issue should have been addressed now. Please can you try it out in the latest master.