Page 1 of 1

FFI - Using OpenGL.

Posted: Mon Sep 14, 2015 5:50 pm
by Nequenz
Hello everyone i downloaded the file 'OpenGL.lua' from GitHub and i'm trying to use OpenGL in Love project just it's interesting. But 'glColor3f\i(r,g,b)' doesn't work i see the black triangle but 'glClearColor" works great maybe someone knows what is the problem.
P.S sorry for my broken english, i'm just from Russia...

Re: FFI - Using OpenGL.

Posted: Mon Sep 14, 2015 10:12 pm
by slime
In LÖVE 0.9.2 and below, love.graphics.setColor calls glColor itself, which will overwrite your glColor call. LÖVE also sets an orthographic projection matrix in the GL_PROJECTION matrix stack with a size equal to the window's size, so your triangle is probably showing up, just at a very small size in the top-left corner of the screen.

If you want to use raw OpenGL with LÖVE, you probably shouldn't mix it with any love.graphics function unless you know the source code of love.graphics very well, since most love.graphics functions modify a lot of OpenGL state and expect the state to be unmodified in between calls. Even just having love.graphics loaded with a window open will cause the OpenGL state to be modified.

Because of that, I'd probably use something other than LÖVE if you want to use OpenGL directly.

Re: FFI - Using OpenGL.

Posted: Tue Sep 15, 2015 5:19 am
by Nequenz
slime wrote:In LÖVE 0.9.2 and below, love.graphics.setColor calls glColor itself, which will overwrite your glColor call. LÖVE also sets an orthographic projection matrix in the GL_PROJECTION matrix stack with a size equal to the window's size, so your triangle is probably showing up, just at a very small size in the top-left corner of the screen.

If you want to use raw OpenGL with LÖVE, you probably shouldn't mix it with any love.graphics function unless you know the source code of love.graphics very well, since most love.graphics functions modify a lot of OpenGL state and expect the state to be unmodified in between calls. Even just having love.graphics loaded with a window open will cause the OpenGL state to be modified.

Because of that, I'd probably use something other than LÖVE if you want to use OpenGL directly.
Thank you for help:3