As I’m currently prototyping a new game for Android, I was in need of a quick (and simple) way of adding some selectable text elements on top of my 3D OpenGL ES scene. So I created a simple demonstration with full source (you can get them from my OpenGL ES git repository) that renders a 3D scene and a basic hud with clickable text elements on top of it in orthogonal mode.
The text elements are rendered to an OpenGL ES texture, using android’s canvas, making this a very flexible way of drawing text on top of an OpenGL ES scene. Note that this isn’t very fast, so the texture should only be updated when necessary. The demo has a menu along with a fps counter, so the texture will be updated every second, and the elements can be clicked and the hud’s observers will be notified with the clicked element’s id so you can easily react on user input.
Though this isn’t something you’d use in a production app where performance is crucial, it should be good start for rapid prototyping needs where you need to have some basic gui or hud to issue commands. And you’re always free to improve the sources (feel free to fork) to make it perform better, by e.g. only updating the areas of the texture where text changed, instead of updating every time if one of the elements is changed.
Following the C++ (OpenGL) repository, I recently added an Android OpenGL ES repositry (using Java) over here. It currently only contains two public demos, one for a simple stl viewer and another one for using the camera input of an android device as an OpenGL ES texture, but over time I plan on adding more and more demos.
And though I used to mock Java in the past I really like coding with Java nowadays. It’s partially because of the language itself (with all it’s modern features) but also because Eclipse is an awesome IDE. So expect more android demos and sources from me in the future.
I’ve just added an OpenGL C++ repository over at bitbucket, and the first C++ demo is an enhanced port of the attraction based compute shader system from my last post.
Sources : https://bitbucket.org/saschawillems/opengl-c
Compiled win32 binaries : https://bitbucket.org/saschawillems/opengl-c/downloads/computeShaderParticleSystem_win32_bin.zip
Compared to the Delphi version, the C++ version uses point sprites (instead of smoothed GL_POINTS), has a random color fade and allows for several user inputs :
Note : This demo requires at least OpenGL 4.3!
- r: reset particles at current cursor pos
- p: Toggle pause
- b: toggle viewport border for particle movement
- c: toggle random color fade
- +: increase speed
- -: decrease speed
- page up: increase particle count by 1024
- page down: decrease particle count by 1024
Next on my list of new OpenGL functionality are compute shaders. They’ve been introduced into the GL core with 4.3, and pretty much allow you to do GPGPU directly in OpenGL without having to resolve to other APIs like OpenCL.
So my first compute shader demo implements a (simple) attraction based particle system. It generates two shader storage buffer objects (SSBOs). One for particle positions and one for particle velocities, and the compute shader then accesses these SSBOs to calculate particle velocities depending on an attraction point (in this demo it’s the mouse cursor) and accordingly updates the particle positions. So the whole particle system gets caclulated on the GPU, which should be a lot faster than doing it on a GPU.
Some screenshots, though they don’t do it any justice as the particle system is so dynamic and looks much better in motion :
You can grab the complete (Delphi) source from my bitbucket repository.
I’ve just been playing around with GL_ARB_debug_output, a new extension introduced with OpenGL 4.3. This extension adds debugging capabilities to OpenGL, e.g. allowing you to have a callback fired by the OpenGL implementation that’ll inform you upon errors or even (heavily depending on the IHV) gives performance hints.
I wrote a small sample (in Delphi) that demonstrates this new functionality. It creates an OpenGL 4.3 forward compatible context (no more legacy stuff) with debugging capabilites and displays debug messages from your OpenGL driver.
It’s a pretty neat feature, and something that OpenGL has been missing for a long time. So from now on, instead of having to poll via glError, you can have the driver inform you when something is not correct and (even better) tell you about your performance caveats.
You can grab the source from the gldebug folder in my GIT repository over at bitbucket. I plan on adding OpenGL demos (with source) for some of the newer OpenGL features to that repository from time to time.
I just updated our Delphi / Pascal OpenGL Header to include the two missing extensions GL_ARB_sparse_texture and GL_ARB_bindless_texture introduced alongside OpenGL 4.4.
And from now on you can always get the latest release from the repository over at github.
Since the latest drivers for my GPU sadly won’t support OpenGL 4.4 (AMD dropped driver support for Vista, so maybe it’s finally time to upgrade) I haven’t been able to test the two new extensions. So if you find any errors, please contact me and I’ll get them fixed.
I finally got around uploading an almost complete new version of the OpenGL Hardware Database. Besides the new visuals, to bring it in line with the design of the OpenGL ES Hardware Database, it offers new functionalty like search boxes on almost every page, new listings like max. supported OpenGL version per device and much more.
Another fine change allows you to call certain pages with parameters, so now you can create and share links for e.g. comparing two reports, or listing maximum supported OpenGL versions for all submitted GeForce graphics cards.
Next step will be an updated OpenGL Caps Viewer with additional caps and stuff like selecting wether you want to create a forward compatible context only.
On a sidenote : I’m on twitter now too.
Thanks to Christophe Riccio, it came to my attention that most NVIDIA driver reports on windows are discarded when trying to upload them to my OpenGL hardware database.
The cause for that is pretty simple : Contrary to the other vendors, NVIDIA does not include their (or any, e.g. OpenGL ICD) driver version inside the GL_VERSION string on windows (at least not on Windows Vista and up, on XP this still seems to be the case). So the database doesn’t see reports generated with more recent driver version as new ones, discarding them though even they may be never and contain new extensions and features.
Christophe already reported this to NVIDIA and I hope they change this for the future, and get this in line with their GL_VERSION strings on Mac OSX and Linux. Until then I’m trying to release a glCapsViewer version for windows that’ll get the driver version from WMI (which isn’t that easy for systems with multiple GPUs) and add it to the GL_VERSION string like on the other operating systems, so that reports with newer driver versions won’t get discarded.
So if you’re on windows and own an NVIDIA GPU, don’t worry if your reports get discarded even after installing the most recent drivers. I’m aware of this and I’m trying to fix it until NVIDIA adds the driver versions to the GL_VERSION string again.
High on the heels of the last release (0.2), I just updated the OpenGL ES CapsViewer to version 0.3.
- Changed way of setting up the OpenGL ES render context
Certain devices (mostly those with PowerVR GPUs) were reporting wrong OpenGL ES versions (e.g. 1.1 instead of 2.0). I’ve changed the way of setting up the highest possible OpenGL ES version, so those devices should now display their real supported OpenGL ES version.
- Additional duplicate check
The app will now check whether your device (with it’s current OpenGL ES and android version) is already present in the database before actually having you input your name and uploading it. If it’s already present you can directly jump to the device report.
- Action bar at screen bottom
On narrow devices (usually phones), the action bar will now be display at the bottom of the screen. That should improve the actions’ visibility.
The update should be automatically installed, and if you’ve submitted a device where 0.2 reported a wrong OpenGL ES version, please feel free to resubmit it.
I’ve just released an update for the OpenGL ES CapsViewer to google’s playstore. This version should fix crashes upon startup that seemed to be caused by a wrong egl configuration, so for this version I’ve changed the method of selecting the egl configuration for the render context.
So if the application crashed on your device feel free to update (in case you’ve turned automatic updates off) the the most recent version and submit your OpenGL ES reports.
There are already ~30 different devices present in the online database, and over the last few days I added some new features like comparing reports and more listings to the database.
Note that for certain devices (like this Samsung Galaxy Tab 2), the OpenGL ES CapsViewer will read OpenGL ES 1.1 (CM) as the supported OpenGL ES version, though it should actually support OpenGL ES 2.0. Since I don’t have such a device it’s hard to test why it only reports OpenGL ES 1.1.