Libgdx question

Hey guys,

  So I have decided to invest time into learning Libgdx. I have successfully used Slick2d for a while, but I think that Libgdx is the direction I want to move in. My question is, in the docs I noticed that GL10 and the other GL classes are using OpenGL ES. Is that the only opengl available through Libgdx? I was hoping that I could access standard desktop Opengl with it, and not just the embedded systems version. Since Libgdx uses a LWJGL backend, I assumed I could access raw OpenGL calls, even up to version 4. Is this possible?

You can use pure lwjgl calls if you want but then you lose android combatibility. If this ok for you then just go for it.

So If my app was only intedned for PC I could just call pure LWJGL? Thats good to know. Is there any particular reason that I would want to do that? Does OpenGL ES lack anything that the pc version offers? Im hoping to learn a bunch about plain old opengl while using Libgdx as well, thats why this was a concern. I didnt want to be forced to use ES.

Hi

Libgdx supports both OpenGL and OpenGL ES. Do you really need features introduced in OpenGL 4? OpenGL ES does not support immediate mode but even a newbie should not use it as it is really slow.

No I most definitely do not need the latest additions at this point. Its more about me wanting to learn pure opengl. I want some of what I do to transfer to PC openGL graphics programming. Honestly I dont know the details of OpenGL vs OpenGLES. My main target is PC, but I am using LIBGDX so that I have the option to do android if I feel like it. My alternative was to stick with slick, but it seems like Libgdx is moving ahead alot faster and Kev Glass even said himself that Slick is basically in a complete state. I figured I could move to LIBGDX and learn some opengl stuff along the way.

Definitely stick to using OpenGL ES, which is largely the future way of doing things.

Cas :slight_smile:

Ask yourself: Do I need tessellation, order independent transparency using sample masks, better texture compression formats, atomic counters in shaders, per sample fragment shaders, texture samplers (these OWN BTW and are also available in OpenGL 3.3), rendering using data from OpenCL directly without going through the CPU, advanced instancing or 64-bit floating point data support? :stuck_out_tongue:

Pure LWJGL should have better performance as you aren’t using a game engine and can tailor all the functions of the game yourself, but using a libgdx is easier and gets you results faster. I would recommend you to at least try out LWJGL, so you get some insight in how it works. That kind of knowledge is very useful even if you decide on libgdx later, as you’ll know how things work, which functions are fast and slow, e.t.c.

PCs will always have the best graphics. If you’re interested in making games with awesome graphics, you can’t really do that (as a programmer) with OpenGL ES. I’m not saying phone games look bad, just that you can only do so much lighting and shaders with that kind of performance. That 3D swordman game on the Iphone may look good, but it’s just some nice 3D models, textures and animations. The “programmed graphics” are just basic lighting and bump mapping. You’re not going to be able to implement ambient occlusion, tessellation, volumetric lighting, subsurface scattering, e.t.c. on a phone for a very long time. In my opinion, these damn phones are a huge step back for game graphics. It’s all left to artists to make games look good on those plaforms (not implying that programming itself isn’t an art xD). As I’m interested in graphics programming, I hope your future never comes, Cas, or that it comes fast enough so I actually have something to do in that future. :wink:

These are advanced features and jparril1 seems to be a beginner in OpenGL, that’s what I meant.

I agree with you, knowing how the low level layers work is fine to make a better use of high level APIs.

Nor are you going to use any of those features if you are using libgdx. Mario would be the first to tell you the reason libgdx exists is to let you develop your Android games on the desktop and then deploy them unchanged to Android. So using straight LWJGL calls is going to break that, rendering the library relatively pointless.

Also - OpenGL ES is very nearly as powerful as OpenGL 4 as it is, and most of us in here being Not Very Good At Making Games, is easily as powerful as any of us really need. Further more it more closely mimics the way you really need to do things anyway, eg. removing immediate mode.

Cas :slight_smile:

The only thing I know about libgdx is basically that it’s called libgdx and is a library. My last post was just to say that he doesn’t need OpenGL 4+ support right now so he shouldn’t care about it when making his choice. If he wants to focus on graphics in games though, starting with raw LWJGL is more beneficial.

Very true. Listen to this, JParril1!

This is completely wrong. libgdx provides a huge amount functionality beyond LWJGL. Using libgdx to develop desktop only applications makes complete sense. If you are doing that and want to use straight LWJGL calls, there is no reason not to.

You are probably right. I did think he made libgdx originally for that purpose though.

Cas :slight_smile:

That it does, though I personally wish it was a bit better modularised so that it was easier to pick and choose the aspects you need from it - mind you, I tend to feel like that about most libraries that are out there! :slight_smile:

I’ve recently been working on the OpenGL pipeline in Praxis, for which the whole of libgdx was overkill, and ended up forking 7-8 classes (textures, shaders, meshes, etc.) to work directly with LWJGL. They would make a great little util library for LWJGL by themselves.

Well thanks for all the advice. Honestly my focus is LARGELY on PC development. I didnt choose to learn Libgdx because of the Android functionality, it was more of a bonus for me. My dev choice was between C#/XNA and JAVA/some library. I really like Java, and I did some cool things with Slick, so I decided to keep going in Java. Libgdx seemed perfect because it seems progressive, has the LWJGL backend so I can mess with pure openGL if I want to, it has the option to easily convert to android given that I avoid pure LWJGL :), plus the community seems strong.) I kind of dropped the idea of XNA just because I have heard mixed things about its future, but most importantly I have no interest in DirectX at all.

So does it seem like Libgdx is a solid library for a Java person who wants to focus on 2d PC games and eventually dabble in 3d games and 3d graphics in general?

I could go the C++/SFML route, but honestly I dont see the reason to program hobby games in C++. I have far more Java experience than any other language.

SFML works not very well on very low end machines, on some platforms (especially Mac OS X) and it has some problems when operating with other windowing systems, some problems with parenting.

SFML versus Libgdx:
http://www.badlogicgames.com/wordpress/?p=1492

Guess which one is faster? :wink:

Interesting article. So Im guessing you all agree that Libgdx is the way to go for me to develop 2d and 3d for PC? I really dont wanna go the engine route, and this seems perfectly low level enough for me to learn a lot.