Javascript SDK template r101 update

0 favourites
  • 7 posts
From the Asset Store
Fruit Slicer Template & Quality fruit and slice graphics (capx,c3p,png,illustrator files)
  • Hi all,

    The Javascript SDK has been updated for r101. Download here:

    <font size="5">Changes</font>

    • New edittime flags for plugins:

    pf_effects: allow WebGL shader effects to be added to objects. Must be added to any plugins that draw in order to enable WebGL effects on that object.

    pf_predraw: add to any plugins that do not draw like a sprite (i.e. don't just draw a single image at the size of the object). This is necessary for WebGL effects to work properly on objects which do advanced drawing.

    • New Effect template SDK. This template will help you get going writing custom WebGL shader effects for Construct 2.

    As always, it is highly recommended for all plugin developers to update to the latest template. Thanks for your continued work improving Construct 2!

  • This should help greatly. Thanks. Any idea when the other webgl features will be implemented? I'm guessing quite. A while since they appear lengthy to code right. In particular the textures and drawing features. I came across a ray casting thread here yesterday and loved the 3d visual effects but the calculating and drawing slices of an image seemed CPU intensive. If we could utilize the drawing features we could draw angled boxes like in the example and paste a texture image onto it. Or am I wrong in how the drawing and textures are done with webgl?

    Thanks again for posting this so quickly,


  • What other WebGL features do you mean specifically? Things like raycasting are academically interesting, but not yet practical due to the impractical performance requirements. Also, most other WebGL features relate to 3D games, so aren't really applicable to 2D games.

  • Ashley

    Currently i'm pretty much into web gl sahder writing.. at least i try. But still there are some things a bit unclear to me. For example which version of glsl es are we dealing with, my guess is 1.0 because you pointed to page 3 and 4 of the reference card.

    That brings me to the question if there is any chance to raise this in the near future, because in 1.0 one has to struggle with a lot of limitations (e.g. array initializing, loops etc.).

    Another suggestion would be to elaborate a bit more on the pre-defined parameters we can use in shaders. Right now the template.fx speaks of seconds, pixelWidth, pixelHeight etc.. Is that everything? In the file "glwrap.js" there is one additional parameter "LayerScale". Might this be useful to include it into the template?

    How difficult would it be to implement furthers params we can use? As i already suggested it would be awesome to pass vector values (vec2, vec3, vec4) on the fly.

    Thanks for your reply! <img src="smileys/smiley2.gif" border="0" align="middle" />

  • oppenheimer - it's the version of GLSL that you get with WebGL, and WebGL is based on OpenGL ES 2, so it's (I think) OpenGL ES Shading Language 1.0. It's limited, but this is by design for compatibility with mobile devices which have weaker GPUs.

    I've got adding more parameters on my todo list but there are any you're after specifically?

  • Ashley - So a game developer who targets desktop/browser apps has the same restrictions in shader usage as a mobile developer. Maybe a concept where the dev has the option to specify a certain glsl version would be good. The shader xml has to contain a param to define this gl version then. This would be flexible solution for multitarget exports.

    I can imagine that it means a lot of work for you, but to be really future proof (regarding mobile hardware as well), it's inevitable to open up the options a bit.

    Speaking of options.. The same way fragment shaders are implemented, it should be possible to include vertex shaders. Back in 2009 you stated "What can you usefully do with four vertices?" speaking about CC. There we had the opportunity to distort the vertices via events. Kinda bottlenecked, but it was possible. With a vertex shader it should be possible to adaptively add more vertices to an object. You claim that C2 is not a 3D software, but again i think, that you should open up the possibilites for the user a little bit more. Think of how much bandwidth will be saved if a user wants to add a 3d model with one texture instead of a precomputed sprite sheet.

    Concerning your last question, i can't think of further params to be included. But the 3 vector types (and arrays perhaps) would be pretty useful imho.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ashley

    I thought a bit more on what to add to the skd/shader documentation and the backend. In CC we had the option to get the boxWidth and boxHeight within a shader. That would be a really cool feature for generative shaders (like a shape-shader or simplex noise), because it's independent from the texture size. The other params like boxTop//Bottom/Left/Right and hotspot positions can be discarded i think, because we can access those directly (0,1,0,1) or by events setting regular floats.

    I hope that it won't take much time to implement & you agree on usefulness. <img src="smileys/smiley2.gif" border="0" align="middle" />

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)