Code Monkey home page Code Monkey logo

Comments (6)

dmitshur avatar dmitshur commented on August 24, 2024

They are similar in purpose, but the differences are:

  • goxjs/gl is more mature, complete, and well supported/maintained.
  • ajhager/webgl was the first OpenGL library to offer a desktop and web backend. goxjs/gl is a successor.

I initially forked ajhager/webgl and maintained a more actively maintained fork at shurcooL/gogl. That was the "first generation OpenGL library with multiple backends". However, it only had desktop and web backends, not mobile. Its API was very similar, but slightly different from golang.org/x/mobile/gl package.

I eventually decided it'd be better to try to take golang.org/x/mobile/gl API, and add WebGL support to it, therefore having desktop, OpenGL ES (mobile) and WebGL (web) support in one package.

The initial goal was to get that merged into golang.org/x/mobile/gl itself. That is still planned to happen in the future, but it can't happen in the short term, so goxjs/gl exists until that happens. Don't worry, it will only go away when it's easy to migrate to a better package without compromises.

I myself actively use and maintain this package, but I do not use ajhager/webgl so it may be out of date. Still, goxjs/gl owes its existance to ajhager/webgl which was the first effort and working proof of concept.

from gl.

pyrossh avatar pyrossh commented on August 24, 2024

I tried some of the examples golang.org/x/mobile/gl and it works on linux and android (not windows) and it also handle input handling like touch events without glfw.
I saw your example here https://github.com/shurcooL/play/blob/master/113/main.go and it uses glfw is that needed because I think the golang pkg uses EGL for input handling.

There is also the golang.org/x/mobile/exp/f32 whats the difference between that and this github.com/go-gl/mathgl/mgl32 as both seem to support vectors?

Also I'm planning to create a multi-platform game engine using the mobile pkg for all platforms(desktop, android, ios)? Will this package be enough? I don't want to have a dependecy on glfw also? I'm thinking of using the golang scenegraph golang.org/x/mobile/exp/sprite as it seemlessly handles everything for me?

BTW I actually started off implementing it in libSDL2 but then thought of reconsidering it as go now has a lot of packages which are os independent.

from gl.

dmitshur avatar dmitshur commented on August 24, 2024

I tried some of the examples golang.org/x/mobile/gl and it works on linux and android (not windows) and it also handle input handling like touch events without glfw.

Yep. golang.org/x/mobile/gl does not have Windows support at this time, but there's an issue open for it.

I saw your example here https://github.com/shurcooL/play/blob/master/113/main.go and it uses glfw is that needed because I think the golang pkg uses EGL for input handling.

That's a great basic example! See here for more projects that use this package.

This package is indeed meant primarily to be used with goxjs/glfw library, as that provides cross-platform window and context creation, as well as user input. In theory it can work without glfw, but I have no such known use cases.

There is also the golang.org/x/mobile/exp/f32 whats the difference between that and this github.com/go-gl/mathgl/mgl32 as both seem to support vectors?

go-gl/mathgl is older and more feature complete. It's also pretty stable. x/mobile/exp/f32 is newer, it was created alongside with x/mobile/gl and used there. It's documented to have unstable API and may change in the future.

It's up to you which you use. I'm currently using go-gl/mathgl everywhere but it'd be great to see the two consolidate into one eventually in the future. It's unlikely to happen soon.

Also I'm planning to create a multi-platform game engine using the mobile pkg for all platforms(desktop, android, ios)? Will this package be enough? I don't want to have a dependecy on glfw also? I'm thinking of using the golang scenegraph golang.org/x/mobile/exp/sprite as it seemlessly handles everything for me?

If you have plans as ambitious as creating a game engine, I highly recommend trying both and becoming familiar with both this goxjs/gl package, used in combination with goxjs/glfw, as well as x/mobile/gl and x/mobile/app packages.

Each one is the best of its class, but they serve slighly different needs. The future long term goal is to merge both goxjs/gl and x/mobile/gl into one package. They already have the same API, so switching from one to the other is easy. The APIs of glfw and app are different, however.

  • goxjs/gl is more multi-platform, it supports OS X, Linux, Windows, web browsers, and iOS/Android, but the iOS/Android support is untested and more out of date. Works well with glfw-style API.
  • x/mobile/gl is the best iOS/Android OpenGL library, but it doesn't yet support Windows and doesn't yet support web browsers. Works well with app-style API but not glfw at this time.

Again, the two gl packages will be merged into one eventually in the future once all the necessary steps are complete, that is the goal. So which one you use until then is up to you, and you can switch between them easily.

from gl.

dmitshur avatar dmitshur commented on August 24, 2024

Also, are you familiar with some existing Go game engines? One example I know of is azul3d.org (/cc @slimsag). It has already made significant progress in many areas, but still has a work remaining. It already is cross-platform to some degree, and aims to support more platforms in future.

Perhaps you might like to join an existing project rather than starting fresh? Again, the choice is yours.

from gl.

pyrossh avatar pyrossh commented on August 24, 2024

Yeah I checked that out it seems good. There are 2 - 3 others which I saw but they aren't working completely yet. But my main target is android and iOS with a game engine with similar api to https://github.com/libgdx/libgdx so it would become easier to port games I have written from java to golang. I prefer libgdx as I already have extensive knowledge on using it and used in to make my own frameworks like https://github.com/pyros2097/Scene3d, https://github.com/pyros2097/Sink.

I guess some of the differences discussed here might need to go in the readme or maybe not.

Anyway Thanks! 😄 man for detailed reply. I planning to make my engine abstract so that it should be easy to plug in any windowing and input system so that any breaking changes to mobile/exp should not cause an issue

from gl.

dmitshur avatar dmitshur commented on August 24, 2024

I'll close this because the question has been answered. :)

from gl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.