Custom OpenGL calls

Hello there.

I want to make a special tilemap implementation throught a native extension (the goal is to have a monochrome spritesheet and the tilemap’s tiles having 2 vertex colors, one to recolor black and another to recolor white). The system would be self contained and wouldn’t require knowing anything from Defold side (textures would be passed by a buffer to the extension, which would generate the OpenGL texture and shaders would be included in the extension’s code for now or passed as a buffer).

What I want to know is where (in Lua) I need call the extension to do the OpenGL draw calls. Would it be in the render script’s update function ? Futhermore, is it safe to do OpenGL calls in the extension init ?

Thanks for your help !

3 Likes

It’s a very hard topic, for an example of working with OpenGL in an extension see the screen recorder extension I made - https://github.com/defold/extension-screenrecorder

1 Like