Samssonart
Samssonart

Reputation: 3593

Can I draw geometric primitives with OpenGL using anything other than GLUT?

I know GLUT's quadrics, I used it in a few programs when I was in school. Now I'm working on a real world application and I find myself in need of drawing some geometric primitives (cubes, spheres, cylinders), but now I also know that GLUT is a no longer supported and it's last update was in like 2005. So I'm wondering if there's anything other than GLUT's quadrics to draw such geometric shapes. I'm asking if there's anything made before I go ahead and start making my own from vertices arrays.

Upvotes: 0

Views: 938

Answers (4)

kevintodisco
kevintodisco

Reputation: 5181

While GLUT has not been maintained, FreeGLUT has. There are still several alternatives though.

GLFW is a cross-platform windowing system which is easy to get up and running, and also provides the programmer with control of the main application loop.

SFML has support for many languages and also integration capabilities with other windowing schemes, in addition to being cross-platform.

Finally, Qt is another, popular, cross-platform windowing framework.

Upvotes: 0

datenwolf
datenwolf

Reputation: 162164

GLUT is just some conveniece framework that came to life way after OpenGL. The problem is not, that GLUT is unmaintained. The problem is, that GLUT was not and never will be meant for serious applications.

Then there's also GLU providing some primitives, but just as GLUT it's merely a companion library. You don't need either.

The way OpenGL works is, that you deliver it arrays of vertex attributes (position, color, normal, texture coordinates, etc.) and tell to draw a set of primitives (points, lines, triangles) from those attributes from a second array of indices referencing into the vertex attribute arrays.

There used to be the immediate mode in versions prior to OpenGL-3 core, but that got depreceated – good riddance. It's only use was for populating display lists which used to have a slight performance advantage if one was using indirect GLX. With VBOs (server (=GPU) side vertex attribute storage) that's no longer an issue.

Upvotes: 1

SigTerm
SigTerm

Reputation: 26409

Now I'm working on a real world application and I find myself in need of drawing some geometric primitives (cubes, spheres, cylinders),

Actually, I don't remember anything except glut that would provide generic primitives. This might have something to do with the fact that those generic primitives are very easy to implement from scratch.

You can use other libraries (libsdl, for example, or Qt) to initialize OpenGL, though.

Most likely if you find generic library for loading meshes (or anything that provides "Mesh" object), then it will have primtives.

is a no longer supported and it's last update was in like 2005

Contrary to popular belief, code doesn't rot and it doesn't get worse with time. No matter how many years ago it was written, if it still works, you can use it.

Also there is FreeGLUT project. Last update: 2012.

Upvotes: 0

karlphillip
karlphillip

Reputation: 93410

Yes, you can! You can use the native API of the OS to create a window with OpenGL capabilities.

The advantage of GLUT is that is makes this task easier and is a cross-platform solution.

There are other cross-platform libraries that are more complex to work with but provide the same functionality, like Qt.

NeHe has a huge amount of examples that use several different technologies to accomplish what you are looking for. Check the bottom of the page.

Here is a demo for Windows that creates a window and draws a simple OpenGL triangle inside it. This demo removes all the window frame to give the impression that a triangle is floating on the screen. And here is a similar demo for Linux.

Upvotes: 1

Related Questions