Averice Posted January 6, 2015 Posted January 6, 2015 I might have completely missed it if it's already there but can anyone tell me if there is a version of glScissor for Leadwerks Lua? Or if it's planned at all? Thanks Quote
AggrorJorn Posted January 6, 2015 Posted January 6, 2015 I´ve honestly never heard of it. Josh never mentioned anything about glScissor. Quote
Averice Posted January 6, 2015 Author Posted January 6, 2015 It let's you specify a rectangle on the screen in which anything drawn outside it during that pass is not actually drawn, it's part of openGL I was just wondering if it had been bound to Lua for leadwerks at all. glScissor(x, y, width, height) -- small rect -- Draw stuff glScissor(0, 0, screenwidth, screenheight) -- return to normal Quote
Averice Posted January 8, 2015 Author Posted January 8, 2015 Sorry for the double post, but if anyone else is looking for a working glScissor ( or other gl functions ) I've managed to get it working using luajits ffi library. ffi = require "ffi"; gl = ffi.load("OPENGL"); -- windows. ffi.cdef[[ enum { GL_SCISSOR_TEST = 0x0C11 }; typedef unsigned int GLenum; typedef int GLint; typedef int GLsizei; void glEnable(GLenum cap); void glScissor (GLint x, GLint y, GLsizei width, GLsizei height); ]] Usage: gl.glEnable(gl.GL_SCISSOR_TEST); gl.glScissor(0, 0, 100, 100); -- draw stuff gl.glScissor(0, 0, scrwidth, scrheight); The only difference is the origin is bottom left instead of top left so I've provided this. function math.glreverse(y, objH) -- y is the position on the y axise, objH is the height of the obj you want to place at y return (App and App.context) and App.context:GetHeight() - y - objH or 0; end Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.