• Hi guys,

    in r150 quadTexUV was introduced. It vaguely states "New quadTexUV function in WebGL renderer for plugins to use for distortion effects".

    What can we expect do with it and how?

    Do we get updated SDK-templates in the near future?

    It seems pretty interesting and my guess is that we are able to code something like this:


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It allows you to draw a quad using an arbitrary part of a texture.

    This is the definition of the function.

    quadTexUV = function(tlx, tly, trx, try_, brx, bry, blx, bly, tlu, tlv, tru, trv, bru, brv, blu, blv)

    The first two letters of the parameters indicate what corner of the quad it defines. For example tlx is "top-left x", bru is "bottom right u". So for four points you have x,y,u and v. x and y is the point's position on the layout and u,v is the texture position of a texture which are in the range of 0 to 1. Where for u 0 is the left side of the texture and 1 is the right. For v 0 is the top of the texture and 1 is the bottom.

    It's basically like uv editing in 3d modeling programs except there is no z so the example you referenced isn't possible.

    To use it call it in you drawgl function with glw.quadTexUV. To my knowledge there isn't a plugin that uses it yet. quadTex is used however to use a sub-rectangle of a texture. The sprite object uses it when animations are exported to spritesheets. I have also used it in my spritesheet plugin.

  • Thanks for the description R0J0hound! I'd add the normal quadTex function only allows you to specify texture co-ordinates as a rectangle, but quadTexUV allows you to specify the exact four texture co-ordinate points. This is useful for things like mesh distortion, and we actually ended up using it in the Tilemap plugin for tile rotation and flipping.

    There's no need for a new SDK download - just use the function and it will work in r152+.

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