I can't speak to using LibGDX, but the OpenGL functions you are trying to call are part of the fixed pipeline and are deprecated. Maybe LibGDX only exposes relevant functionality based on the OpenGL version you're working in?

Aside from that, I would like to steer you away from the deprecated functions. For every function which has been placed on the endangered species list, there now exists a newer and better way of accomplishing the same goal. I'm curious why you need to use the older methodology.

keep in mind that this method of rendering has been deprecated for a long time. with lower subdivisions it will look a little weird that's because the alpha is blended for each triangle separately making the fact that there are many different triangles apparent

edit: Just realized your talking about using LWJGL through LibGDX. dunno how you would do this in LibGDX this is just the straight LWJGL way to do it. If it exists in LibGDX i would assume it would be very similar to the above code though

As RobinB said, you'll want to use Vertex Array Objects, Vertex Buffer Objects and Shaders. These are the meat and potatoes of the new OpenGL pipeline. The process involves stuffing a bunch of information like Vertices into a buffer and then a script (called a shader) processes the data for rasterization. As DaveDes said, LibGDX has some utilities to make your life easier. It's also going to require using matrices to position your objects in the 3D world. Again, LibGDX likely has a lot of that hard work done for you.But don't let all those long words scare you away. Just take it piece by piece and you'll find it's really not that bad. A little more work than the fixed pipeline, but easily doable.

BillboardingThis is likely getting a bit ahead of you, since you'll want to get the basics of working VAOs, VBOs and Shaders down first. So this is for after you go down that dark road.

It looks like you're putting together some billboards. This is the process of taking a flat panel and making it always face the camera. You can think of billboarding like a sign on the side of the road, only these signs would always face you no matter where you stand. Typically this is done with a quad and a transparent image instead of a disc. Rendering a quad is a lot faster, since it's only 4 vertices. Though it's not limited to just quads, so if you really want to use a disc, then you can still use the methods I'm going to list, to help tackle your problem.

Easy MethodJust don't billboard. Stuff a sphere into a VAO/VBO and render it where you need. I bring this up, because if you just want something to represent where your light is for development purposes, there's no reason to go mad over billboards just yet. If you want to use this in actual game play, then it's probably not the best method. Especially if you'd be using a lot of them, then you would need to use instanced rendering and blah blah... so no.

Medium MethodStuff a quad into a VAO/VBO. Pretty simple so far. The next part is a little more tricky and requires using something called a "Look At" matrix. This does what the name implies. You feed it 3D vectors called Eye, At and Up. The matrix then does some behind the scenes magic and makes the object face where you want it to. This is perfect for billboards, just tell it to look at the camera and shazam instant billboard.

The previously mentioned vectors areEye: The location of the object.At: A point the object is looking atUp: Which direction the top of the object is facing (sort of).

Note: sometimes people refer to these vectors in different names like "right, center and up". I imagine LibGDX has already implemented the math for this and you just need to figure out the syntax for calling it.

Difficult MethodMy favorite method for handling billboards expands on the previous example. Though instead of flipping back and forth between the CPU and GPU, we simply feed a bunch of 3D vectors to the GPU and then use something called a Geomtry shader to create the actual billboards.What makes this somewhat difficult is you'll first need to learn how to use Geometry shaders. Then you'll need to figure out how to calculate the Eye, At and Up vectors in the shader. So you'll need to know a bit of basic vector math.It's not terribly complicated, it just requires a lot of basic knowledge about a bunch of different things.

The really nice part about this is being able to deal with billboards as single points, which becomes very useful when you get into particles systems. It also leaves the door open for some advanced particle systems which exist solely on the GPU (which means stupid fast).

You'll probably want to work your way up to this though. I mention this mostly as something to keep in mind, so you don't get too entrenched in a more basic method.

Thanks for the reply Redocdam, I can tell you put work into it . I am just trying to do 2d geometry shadow mapping though, but this information is enormously helpful! I will go on and face the world of OpenGL!!!!! Thou hast strengthened me!

Was I before Chuang Tzu who dreamt about being a butterfly, or am I now a butterfly who dreams about being Chuang Tzu?

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org