Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm new to OpenGL and found that there are a lot of libraries to do that in C, and I also found that glx is most friendly with Linux X Server, I just want to do basic stuff, and I cannot find any tutorials for GLX.

Is GLX a bad thing? I just want to do some small graphical things without installing many libraries and getting confused. Can anyone suggest me something which has tutorials and simple to compile?

I found a link with an example with GLX and it worked perfect with no errors: anyone please suggest where I can find nice documentation or any better libraries.

share|improve this question
    
It's unclear what problem you want solved: GLX does what you want, so what's missing? –  Brendan Long Aug 27 '12 at 15:45
    
I want to draw spheres, I found cold which draws a square in 2d –  pahnin Aug 27 '12 at 15:59
    
You should really edit your question to be more specific about what you want then. I don't think OpenGL has any way to draw spheres though (you'd generally "build" your own sphere out of triangles). There's bound to be libraries that abstract that away for you though.. –  Brendan Long Aug 27 '12 at 16:05
    
@BrendanLong: As I recall, the GLUT libraries have some functionality for drawing primitives such as spheres. But I haven't worked with OpenGL/GLU/GLUT in many many years. Not sure if they're still that commonly used. –  FrustratedWithFormsDesigner Aug 27 '12 at 16:11
    
I can build my own sphere my question is choice for library friendly with linux –  pahnin Aug 27 '12 at 16:28
show 2 more comments

2 Answers

GLX library is written to communicate OpenGL application with the X server. It probably doesn't do anything more than that, but it's enough for you. When you create and set up your window and GL context with GLX, you start using OpenGL like everywhere else. In other hand do you really want to set up everything yourself using so low-level libraries only to draw a 3D sphere? IMO it overkill. Won't it be better for you to use a wrapper framework, like i.e. GLFW? It'll do for you everything you'll want to without need of writing a lot of redundant C-code.

And if you are using Linux, installing additional libraries (or any other package) sure won't be a problem. Every distro is using package manager, which makes installing almost anything very easy.

share|improve this answer
    
GLFW? It only manages windows and input + basic image loading.No geometry creation (like in GLUT) . Also drawing a sphere with "pure" OpenGL is simple. –  Michael IV Dec 19 '12 at 8:50
add comment

GLX is necessary in Linux, since it is the glue between OpenGL and the running X server.

Certainly, GLX is fairly complex for beginners, especially when the goal is learning OpenGL, and nothing more.

All libraries out there that allow OpenGL rendering uses GLX, but they wraps GLX calls in a way to simplify OpenGL-enabled window creation.

I suggest to setup your application with GLUT, since you can create a window and manage system events (i.e. Key inpus). Additionally, GLUT is available for other systems also, allowing you to port you application somewhere else.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.