
local demo_dir = gh_utils.get_demo_dir()
local lib_dir = gh_utils.get_lib_dir() 		
dofile(lib_dir .. "lua/gx_cam_lib_v1.lua")
dofile(lib_dir .. "lua/libfont/libfont1.lua")   
dofile(lib_dir .. "lua/imgui.lua")    





winW, winH = gh_window.getsize(0)


-- A perspective camera for the 3D scene.
-- The first three params are the position and the last three params are the lookat point.
-- camera = gh_camera.create_perspective(0, 20, 80, 0, 0, 0)

local aspect = winW / winH
--camera = gh_camera.create_persp(60, aspect, 1.0, 1000.0)
local is_vertical_fov = 1
camera = gh_camera.create_persp_v2(60, is_vertical_fov, aspect, 1.0, 1000.0)

local fov_x = 60
local fov_y = 40
-- camera = gh_camera.create_persp_v3(fov_x, fov_y, aspect, 1.0, 1000.0)

gh_camera.set_viewport(camera, 0, 0, winW, winH)
gh_camera.set_position(camera, 0, 0, 40)
gh_camera.set_lookat(camera, 0, 0, 0, 1)
gh_camera.setupvec(camera, 0, 1, 0, 0)


clip_plane_prog = gh_node.getid("clip_plane_prog")

mesh_torus = 0
mesh_torus = gh_mesh.create_torus(20, 5, 20)
gh_object.setpos(mesh_torus, 0, 0, 0)

local abs_path = 0
tex01 = gh_texture.create_from_file("./textures/3912-diffuse.jpg", 0, abs_path)

gh_renderer.set_vsync(1)
gh_renderer.set_scissor_state(0)

gl_renderer = gh_renderer.get_renderer_model()
gl_version = gh_renderer.get_api_version()


