Compiling WebGL Into a C Library - opengl-es

We currently have a shared DirectX code base that renders our UI and is used in our PC side application and via an ActiveX in web pages.
I have written some WebGL demos and they perform great, no plugin mess and get rid of ancient ActiveX!
This obviously raises the problem of having a split code base for the PC application and the Web UI.
As WebGL is based on the OpenGL ES 2.0 specification would it be possible to have a standard code base and write a interpreter so that either:
-The WebGL code can be modified to compile as OpenGL
-OpenGL can be modified to work in a web page
The khronos specifications are new to me, so this is sort of speculative as I am peforming research at the moment.
Does anyone with more knowledge of 3D graphics and a better understanding of the coding syntax help me out?

One way is to have a PC app to enclose a WebGL-capable browser inside (together with a simple http server) to run the same rendering technique as the web App.
This will reduce the maintenance and development costs for both platforms.

Related

can we integrate a processing gui with moodle?

i made a gui recently where the goal was to view the results of some actions there , so mostly it was like a simulation game that has no connection with any hardware , i proposed this for my school that uses moodle and i want to know if there is a way to integrate it there , the gui i used has controlP5 library and videos and gif libraries as well, i would appreciate the help
from my researches so far i found that we can integrate processing code with html after some modifications , but didn't find anything for moodle yet
My understanding is that Processing in java mode, using controlP5, etc. will work on a client machine, not on a server (like moodle) (not easily at least).
Regarding embedding a processing sketch a web page:
java applet support is deprecated (can no longer embed a .jar applet)
processing.js is deprecated (and controlP5 wouldn't be compatible anyway)
you can however port your code to p5.js
I don't know enough moodle, but perhaps you can embed a JS snippet/iframe/etc on a moodle page.
Regarding controlP5, in p5.js, you can look at p5.dom.js functionalities such as createSlider(), createButton(), etc. or use libraries like p5.gui or p5.touchgui.

How to make a GUI in Julia?

I'm new at programming in Julia and I need to create a GUI.
I've been looking for information and I can't find anything useful. I tried to search information in the Julia official web page, but it seems to be down. I wonder if any of you guys knows where I can find information about it.
This is quite a generic question, but I'll try and layout the environment so that you can make an informed decision based on your needs. You might want to check out this article on 6 Julia Frameworks to Create Desktop GUI’s 🖥 and Web Apps.
If you are developing your code within an [Jupyter/IJulia] notebook, and need very simple interaction, such as a slider to change some input values, the Interact package is the easiest thing to get started with.
To develop full-fledged web UIs, take a look at Escher. Inspired by the Elm, it provides a functional library of UI components. Interactive web UIs are created in 100% Julia. There is no differentiation in code between the client and server sides. The framework handles all of that.
Another web framework worth looking at is Genie, which is based on the traditional MVC design pattern. It also includes an ORM.
Stipple is a reactive UI library for building interactive data applications in pure Julia. It uses Genie.jl (on the server-side) and Vue.js (on the client).
Dash ties modern UI elements like dropdowns, sliders, and graphs directly to your analytical Julia code.
All the above solutions are for creating web user interfaces, accessed via a browser. If you want to create cross-platform desktop apps, but want to work with web technologies (i.e. HTML/CSS/Javascript), use Blink. This is a Julia wrapper around the Electron. You could potentially write a Dash or Stipple application, and wrap it in Blink.jl to create a desktop app.
To create desktop UI applications using the Gtk library, use the Gtk.jl package in Julia. If you are familiar with the Gtk API, it is easy to get started. Note however that there are some significant known issues running GTK.jl on Windows.
If your UI framework of choice is QT, a Julia binding is available via QML.jl
If you are happy painting the buffer yourself and just want a window to render the pixels on the screen, then there is nothing simpler than MiniFB. Note however that this does not give you a widget library -- you are responsible for drawing each and every pixel yourself.
ClmGui.jl is a Julia wrapper around the immediate mode GUI toolkit known as Dear ImGui
And last, but not the least, the venerable Tk framework has a wrapper in Julia. The UI's created using TK are sometimes considered ugly compared with modern aesthetics, but sometimes this is the quickest way to get a window up.
[Edited Jan 2022]
QML.jl
https://github.com/barche/QML.jl
The QML.jl package enables using the QML markup language from the Qt library to build graphical user interfaces for Julia programs. The package follows the recommended Qt practices and promotes separation between the GUI code and application logic. All user-facing code is pure Julia and QML, no C++ knowledge is required to use the package.
There is a new package called Genie. It is a web framework comparable with Django in python. You can create web ui using Genie. Until now (Aug. 2017), the package is functional with some nice demos, the documentation is not quite complete though.

3D engine collision detection modelimport

I am about to find a 3d engine which is capable of importing 3d models, detect their collisions and support joints. It's needed for an interactive animation and no platform is specified jet. I would prefer to code Javascript or AS3, but I think to be able to handle this with Java too.
Does Away3d support this? Is their a plain 3D collision detection framework I could use additionally to it? Which is the easiest Java Framework and which creates best Quality?
BTW.:
Proprietary Frameworks might also be an possibility, but I just do not any.
Greetings philipp
Away3D has Awayphysics library that is alchemy port of C++ engine and show very good performance. Away3D has clean readable source code and documentation + good set of example projects. It has 3ds max plugin that can export scene and generate code to render it. Support popular formats like 3ds, obj... and You can write importer plugin for own format. All so developers are pretty cool guys that answer questions on forum :)
For JavaScript the most popular engine is three.js Look what it can do.
General thoughts:
WebGL support isn't good at this time(sometimes it depends not only on user browser but all so on drivers) and You will need to deal with cross browser headache. Flash isn't supported on IOS and get kicked more and more from device browsers. But there is cross-platform adobe air for standalone apps.
Javascript, in my opinion, isn't good for writing such projects and its debugging can cause permanent brain damage. WebGL shader language is GLSL that has nice C-like syntax. Ordinary Flash shaders are written on assembler but You may try pixelbender3d. At this time Flash shaders more limited than WebGL(for example you can't fetch texture in vertex shader) but it's done to make Flash more compatible and it's not a problem for most cases. WebGL is tightly integrated with page.
If you want java WebGL and like pain try GWT 3D engines or gwt-elemental and there is tree-js port at early stage.
x3dom is declarative WebGL 3D engine with fallback to Flash it is ez but pretty limited and unstable.

Improve performance of "Accelerate your Widgets with OpenGL" Qt Sample?

I have been studying the Qt Quarterly article about QGraphicsScene and OpenGL for the purpose of using it in a project. I have already decided to use Qt, given its all-round excellence, but have gone down the road of implementing a class derived from QGLWidget, however I would then still need to implement the UI elements. Using techniques from the quoted article would mean I could also use Qt widgets for the UI as well, making the program dependent on Qt alone (and not CEGUI or similar).
Anyway I have been running the sample under a desktop Linux machine, which has an Core i7 and a fairly good Nvidia card and it runs well, however my on my 2010 MacBook Pro (Core i5 and Nvidia 330) it runs very poorly indeed, especially when interacting with it using the mouse.
Question: can anyone suggest ways of improving the performance of this sample? I'm no Qt expert but I think the poor response is due to calls to update() from within the mouse handling code coupled with the timed calls to update() at the end of the method itself. I think what is needed is a background thread to update the object movement and a timed but constant call to update().
Can anyone comment on this?
EDIT: I have already tried removing all calls to update(), apart from the timer reset, and it makes very little difference.
Unfortunately the performance that you get when using the suggestions from that article is pretty bad. We tried that on an embedded system and it was far to slow.
For us the solution was to use QML, the new "declarative" UI capability in Qt 4.7. We have QML embedded in our C++ application. We are seeing huge speed improvements with QML widgets overlaid on top of our GL scene.
We are using the QDeclarativeView widget in our C++ application, which is capable of displaying our QML content. See: http://doc.qt.io/archives/qt-4.7/qdeclarativeview.html.
This should work fine on the desktop (works for me on Ubuntu).
More useful links:
Using QML Bindings in C++ Applications
Integrating QML Code with Existing Qt UI Code
UPDATE! 1/20/2015:
In Qt5.4 there is a new class called QOpenGLWidget that basically makes it so you can use "classic" Qt widgets with an OpenGL background with great performance. They finally adressed this issue directly! Read the blog post, and then the docs:
Qt Blog Entry about QOpenGLWidget
QOpenGLWidget Docs

Automated testing for OpenGL application

I have a Java Application that uses JOGL to provide a large part of the GUI.
Is there any tool which you know of, or have used which can automate the testing of OpenGL applications (or more specificly those using JOGL)
Just to update: The tool can run on either linux or windows.
I have written unit-tests for C++ (Qt on Linux) & OpenGL before. I don't know any reason it shouldn't work for Java too.
The things which worked for me are:
Abstract your OpenGL context provider so the rest of your code is independent of it. In my case the main app used Qt's QGLWidget, but the unittests used a pbuffer-based one which I could create with no windowing infrastructure at all (other than a designated X11 DISPLAY). Later I added an "offscreen Mesa" (pure software OpenGL implementation) so they'd even work on a headless build machine with no GPU at all.
Keep your OpenGL code independent of your GUI code. In my case the OpenGL "rendering engine" didn't know anything about Qt classes (e.g mouse events). Define your own testable API which isn't tied to any specific GUI concepts, and write tests for it.
In the unittests, read the contents back from the framebuffer using glReadPixels and either hit them with some assertions about which pixels should be particular values, or go down the regression-testing route and compare the framebuffer capture with a stored image you know is good (either from manual verification, or because it's produced from some other reference model).
Allow a bit of fuzziness in any image regression testing; most OpenGL implementations produce slightly different output.
(I didn't do this, but...) Ideally you want to be able to test the GUI layer by asserting that it makes the expected sequence of calls to your rendering engine in response to GUI activity. If it does that, and you're confident of your render layer because of the above tests... well, no need to actually do the rendering. So create a suitable mock object of your rendering layer for use when GUI testing (I'd imagine tests like "mouse drag from here to there results in a call to the rendering layer to set a particular transform matrix"... stuff like that).
You can test your JOGL based application using Sikuli which performs UI automation via image recognition techonolgy on screen-shots.
I am currently using Sikuli to functional-test a Java app that is predominantly based on the NASA Worldwind Java SDK (which is based on JOGL). Using the Sikuli Java API my test suite can recognise icons within the OpenGL canvas, click on them and also drag them around. Sikuli can also recognise and extract text from the canvas via OCR, however the performance of this seems to be a little hit-and-miss (depending on language, font, size and background colours behind the text).
I have done a lot of automated UI-Testing using other tools that work by introspecting the windowing toolkit (e.g. Swing, SWT, native Windows) and found that Sikuli runs much slower than those, however that is understandable given the amount of image-processing it needs to do behind the scenes. Also note that Sikuli currently requires your application to run in a Window (not in full screen mode).
Sikuli runs on both Windows and Linux. I'd recommend you try it out. I couldn't find any other tool capable of doing that level of functional-testing of an OpenGL based application.
I've been thinking of using a picture-diff tool such as PDiff to test OpenGL code, by taking snapshots, saving them to disk and comparing with previous regression output. That way, really bad stuff (missing textures) pop up but humanly unnoticable things (such as the above mentioned small diffs between implementation) go through fine.
Also, for automating user interaction, either the GUI classes should be sufficiently open for you to send events or call 'clicked' on a button, or you have to inject OS events manually to your apps. This is possible, but much more troublesome. Might be easier to open up the GUI layer, if it's Open Source.

Resources