Closed nanjizal closed 4 years ago
Hey @nanjizal, gluon just handles interfacing with OpenGL, rather than window management. To draw to the screen you can use it in combination with glfw
For example, once you’ve created your glfw window, you can do
var gl = new gluon.es2.impl.ES2Context();
gl.clearColor(0, 1, 0, 1);
gl.clear(COLOR_BUFFER_BIT);
To clear it green
I have added some basic setup files to my kitGL for gluon and it's compiling. https://github.com/nanjizal/kitGL/tree/master/src/kitGL/gluon I have setup a basic trilateral3 base for gluon. https://github.com/TrilateralX/TrilateralGluonChange/blob/master/src/trilateralGluonChange/AppGL.hx And created a demo. https://github.com/TrilateralX/TrilateralGluonSVG
But I get a bit confused about running it, I don't think it worked, code requires 4.2 haxe. These are dependancy
-cmd haxelib git trilateralGluonChange https://github.com/TrilateralX/TrilateralGluonChange
-cmd echo 'installing geom library for maths matrix functionality'
--next
-cmd haxelib git geom https://github.com/nanjizal/geom.git
-cmd echo 'installing dsHelper some array datastructures'
--next
-cmd haxelib git dsHelper https://github.com/nanjizal/dsHelper.git
-cmd echo 'installing fracs, provides angles and fraction helpers'
--next
-cmd haxelib git fracs https://github.com/nanjizal/fracs.git
-cmd echo 'installing justPath, provides svg path parsing ability'
--next
-cmd haxelib git justPath https://github.com/nanjizal/justPath.git
-cmd echo 'installing trilateral3, provides contour to triangle functionality'
--next
-cmd haxelib git trilateral3 https://github.com/nanjizal/trilateral3.git
-cmd echo 'installing pallette, provides range of useful hex colours'
--next
-cmd haxelib git pallette https://github.com/nanjizal/pallette.git
-cmd echo 'installing kitGL, provides some helpers for working with GL and lime'
--next
-cmd haxelib git kitGL https://github.com/nanjizal/kitGL.git
-cmd echo 'installing a range of fill algorithms, hxPolyK, poly2trihx, hxGeomAlgo.tess2'
--next
-cmd haxelib git hxPolyK https://github.com/nanjizal/hxPolyK.git
-cmd haxelib git poly2trihx https://github.com/nerik/poly2trihx.git
-cmd echo 'if you get troubles with this one you can comment out code in trilateral3/fill as it's not really used on the test'
-cmd haxelib git hxGeomAlgo https://github.com/azrafe7/hxGeomAlgo.git
I would be curious if you can run it, need to have another look at setup files, but this could be useful demo of gluon. Note the structures are similar to WebGL and Lime working tests so likely it's not far off.
Hey @nanjizal, are you using anything to create a window and native gl surface?
gluon is super minimal – it essentially just calls gl commands (like glClear()
) from haxe, it doesn't create an app window with a native OpenGL surface, which is required to call gl commands
You can use linc_glfw to create the window, then once created, use gluon to call OpenGL commands
thanks I updated the code but having weird issues with my hxcpp breaking in justPath it seems to be reading utf16 weird - strange because that library is old, so need to add some basic unit tests and dox to it so I can work out if it's a bug in haxe or in just the dev combo I have installed which might be dodgy.
Updated my base class, is there anything further that you think I might need in the render loop? https://github.com/TrilateralX/TrilateralGluonChange/blob/master/src/trilateralGluonChange/AppGL.hx It's really weird because it's in a while loop the Frame code will never get called. I also had to call it from the inherited class so that the draw function of the inherited class was properly initiated. Really not sure that glfw is really a stable approach it maybe light but if I have to rely on a while loop that blocks the whole code it seem quite iffy. Did you look at linc_sdl would that be much more stable approach?
I think I had to comment out the program build checks, either the shader which now modified is still not right or these bits don't work. https://github.com/nanjizal/kitGL/blob/master/src/kitGL/gluon/HelpGL.hx#L25
Hey @nanjizal, sorry on my slow responses, currently working on client projects so my bandwidth for open source is quite low (will pick up again in July however!)
I've attached a gluon demo that uses GLFW which might be useful as a starting point gluon-demo.zip
I've tested haxe 4.0.5 and 4.2.0 on macOS, should also work on Windows but linux is untested. What system are you using?
I know this project doesn't have a lot of details on how to use, this is because this repo is the only public part of a larger closed source project (which does help with windows and things)
Eventually that project will be open source and I'll have full walk-throughs then
mac
Thanks that code was really useful, I have rebuilt your code to use interleave position and color, and messed with formatting, it helps me learn and if it's in my style I think easier for me to think till I know where I am, hope it's ok public? Probably long way from ideal, I have a slight problem with the data my draw engine is returning - it seems to be just zero but I should be able to debug that a bit later. Currently test repo is here, but need to make approach more generic. The render Loop stuff I may not need all of that but I can pair back when I get real data to render.
Cool stuff :), I’ll keep the issue open for now until I’ve got some documentation
Currently I am getting... gluon/webgl/GLContextDebug.hx:86: OpenGL Error in "$fnName": $errorName,
I can't try to update Lime without something breaking then I refix everything and gluon is broken, it's very tedious, especially as there is no reliable information on building hxcpp the helper scripts never seem to quite work properly.
Do you have mac build of hxcpp that works with your code against haxe nightly? Do you find it easy to rebuild hxcpp? Do you have eval/jvm approaches perhaps with metal?
Look like string interpolation rules have changed in haxe lately, those $variables should be interpolated. I've opened an issue to investigate #10
That trace is trying to tell you that OpenGL has generated an error (these are things like "Framebuffer Invalid"), so it should be independent of hxcpp and haxe, and purely depend on the OpenGL commands being used
Desktop GLSL is slightly different from GLSL ES 2.0, Lime might do something different to shaders that can trigger an OpenGL error in one library and not the other
I'd argue you're best of sticking with a single GPU library because of this, either lime, kha or gluon
Haxiomic, what is weird is I don't think I have changed my code from the code posted above, well I was trying to process:
var datum = new Float32Array([
0.100, 0.100, 0. , 1, 1, 1, 1
, 0.500, 0.500, 0. , 1, 1, 1, 1
, 0.100, 0.500, 0. , 1, 1, 1, 1
, 0.100, 0.100, 0 , 1, 0, 0, 1
, 0.500, 0.100, 0 , 1, 0, 0, 1
, 0.500, 0.500, 0 , 1, 0, 0, 1
, 0.300, 0.300, 0 , 1, 1, 0, 1
, 0.400, 0.300, 0 , 1, 1, 0, 1
, 0.400, 0.400, 0 , 1, 1, 0, 1
]);
I don't think the buffer changes you made worked for me, but someone else who tried it seemed to think stuff was now just working and surprised, even with some of my drawing code, but they are on linux?
Buffer changes should be working – could it be that an older version of gluon is being used? Maybe uninstall gluon from haxelib and try again from git
Also, check if you have a version in a .haxelib folder that is overriding
Generally I think the local .haxelib/ approach is the best way to manage haxe libraries right now (but a better system is coming soon :))
I think it was some changes I made locally in dsHelper, sorry for the noise but I guess it helped find the macro problem. Turns out if I run it with pure webgl I was providing wrong number of vertices.
I am going to close this and start clean one.
tried linc_glfw and it opens hello world titled window no content on my mac, expected similar with gluon, modified hxml to get something to work...
But the output was purely textual:
Some other setups failed due to xcode paths.
I would love to draw a triangle to screen with gluon with hxcpp so that I can attempt to target it with my library - if that's feasible yet? Advise welcome. Mac 10.12.6.