drawGL() and glwrap.js

0 favourites
  • 3 posts
From the Asset Store
Google Analytics 4 Plugin for Construct 3 enables metrics and analytics for your games easily.
  • I'm developing a plugin for my own project and I want draw some stuff. If I would use 2D canvas, that would be easy, because at the moment I need to draw only basic lines / quads. But I'm mainly targeting WebGL, and I figured out how to draw quad while viewing 'Sprite' plugin code, but...

    ...The major problem is that I see no documentation at all for how to draw in drawGL(). I'm learning raw WebGL simultaneously and I already know basics like vertex buffers, simple shaders for coloring etc. But Construct supplies glwrap.js that should really simplify 2D drawing jobs using WebGL. In the meantime I cannot even figure out how to draw colored quad. Also I don't know how to draw simple line (I know I can draw it like quad, but still). I tried to read glwrap.js code, but it seems quite complicated at first glance.

    So, my main question, is there somewhere detailed documentation / tutorial on how to draw in drawGL()? I'd like to know how to draw basic shapes and how to do this in color.

    If glwrap doesn't supply simple methods for that, I can do this with raw WebGL calls, but I need to know how to operate buffers and everything to not disrupt regular Construct drawing.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can't use raw WebGL calls, it will conflict with the batching glwrap does. I'm afraid we don't have documentation right now though so the best thing to do is to look at plugins. Sprite has a pretty simple drawGL function to just draw a textured quad.

  • Thanks for reply! I read glwrap.js more thoroughly and figured out that so far it seems it's possible to only draw textured (or simply black) quads. From shaders code I found that there's no possibility to even make vertex colors. Well, I guess it will be enough for me at the moment to draw only quads, but would like to have more possibilities in future. And documentation, of course =)

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