garrynewman / GWEN

Abandoned: GWEN - GUI Without Extravagant Nonsense.
MIT License
429 stars 102 forks source link

OpenGL Renderer doesn't display anything? SFML Renderer works great though. #12

Open sreich opened 11 years ago

sreich commented 11 years ago

I created a test app using SDL 2.x (unreleased) and using the OpenGL renderer. All that is shown is this: http://wstaw.org/m/2013/01/21/plasma-desktopyJS671.png (the canvas background color, which is set to green, with what I presume is the bottom-right edge centered on the center of the screen).

So if only one thing is wrong, it's the coordinate system in this renderer. code using renderer:

https://gist.github.com/4591362

So I used the sample code that used the SFML renderer. This works beautifully, as shown below (with the unit test) http://wstaw.org/m/2013/01/22/plasma-desktopngU671.png

I'll step through it and debug it, see what it's doing wrong and keep this post updated with my status.

sreich commented 11 years ago

k, looked into the issue...looks like OpenGL::Init needed some glViewport calls and some matrix setup. That really should have been automatic, as that isn't needed for the SFML render really...And even then, it seems to be problematic

That said, I'm thinking/planning on rewriting this to use programmable pipeline/OpenGL 3 (though it'll probably run on 2+), so using shaders instead of built in matrix handling. Should also mean a port to an eventual ES renderer would be easier.

Also going to get rid of all the windows specific shit in that renderer (well, going to make a new renderer rather, called Renderer::OpenGL3, to prevent confusion/mixtures). I'm also going to use FTGL for font rendering, as that makes things more trivial, unless someone feels like writing a patch for pure opengl to get rid of that dependency for font rendering.

I don't think the stock OpenGL renderer is really too usable out of the box for anyone tbh, it doesn't even have font rendering, and it seems to be less well designed than the rest of the api.

I also want the opengl renderer to be more featureful, including font drawing and text measuring i hope, just like the SFML one.

Garry, is there a nice way to obtain the size of the canvas? Other than init'ing the renderer with that size, and creating its own public method(s)?