simple Lua framework over GeeXLab Lua API

Started by Alex, September 30, 2017, 11:55:55 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Alex

Hi JeGX,

Can you share plans for high-level Lua framework over GeeXLab Lua API?

I am hoping to use new GeeXLab in similar way old GeeXLab was envisioned.

Kind regards,
Alex

JeGX

Yes I will try to code a skeleton of a high level framework as soon as possible....  :P   

Alex

Hi JeGX,

Any news about high level framework ?

Thanks,
Alex

JeGX

I started to code a tiny framework for Lua... I let you know asap  :P


Alex

Hi JeGX,

Happy new year !

Looking forward to upcoming Lua framework :)


JeGX

Sorry for the delay, I've worked on the new version of GeeXLab and as usual it took lot of time. I will add the small framework in the code sample...
And happy new year too!

Alex

Hey JeGX,

Any way to sponsor the effort of Lua framework and GeeXLab SDK ?

JeGX

I will upload asap the current version of the micro Lua framework on GeeXLab download page.


JeGX

Here is a first version of the simple Lua framework: Download

GeeXLab can be downloaded from this page

The simple Lua framework demo renders the following scene:



The framework is rather minimal and does only simple things. But it can be used as a base for a more advanced framework.

The principle of this framework is the following: you create objects in the INIT scripts and you render the scene in the FRAME script by calling hlf_render_frame(). It's a kind of retained mode. All 3d code (binding textures + gpu programs and objects rendering) is hidden in hlf_render_frame().


INIT script:

local demo_dir = gh_utils.get_demo_dir()
dofile(demo_dir .. "hlf.lua")


hlf_init()

local phong_prog = hlf_get_gpu_program_phong()
local phong_tex_prog = hlf_get_gpu_program_phong_texture()

torus = hlf_add_mesh_torus(10, 2, 20)
hlf_item_set_gpu_program(torus, phong_prog)
hlf_item_set_auto_spin(torus, 1, 11.0, 13.0, 17.0)


torus2 = hlf_add_mesh_torus(15, 2, 20)
hlf_item_set_gpu_program(torus2, phong_tex_prog)
hlf_item_set_auto_spin(torus2, 1, -11.0, -13.0, -17.0)


local t = hlf_load_texture(demo_dir .. "data/10857.jpg", "rgba_u8")
local texture_unit = hlf_item_add_texture(torus2, t)
hlf_item_set_uv_tiling(torus2, 8.0, 2.0, texture_unit)


hlf_stext_rgba(20, 20, 1.0, 1.0, 0.0, 1.0, "Simple Lua Framework")

frames = 0 -- frame counter




FRAME script:

hlf_set_background_color(0.2, 0.2, 0.2, 1.0)


hlf_dtext(20, 40, "- frames: " .. frames)
frames = frames + 1


hlf_render_frame()




SIZE script:

hlf_resize()



TERMINATE script:

hlf_terminate()



Alex

Hi JeGX,

Awesome news.

Thank you very much.

leon

Hey Thanks for this, this makes application-code soooo small and readable ♥♥♥
Great startingpoint!