Newbie looking for Tutorials

as already mentioned i am new to linux, and want to start on opengl programming under linux (SUSE), opengl is not that problem since i did some things under win32. I just need some tutorials on how to set up a working opengl environment and how to write the first application / framework (set up a window, get opengl to draw into my window such stuff)
i hope that some people can help me out every help is welcome

win32 is ugly. X is ugly. My suggestion is to use something like GLFW. http://hem.passagen.se/opengl/glfw/

If you still want to write your own basecode, I don’t know of any good tutorials. I would reccomend looking at other peoples basecode. Such as Humus’ code: http://esprit.campus.luth.se/~humus/

what exactly is glfw

what i am looking for is something similar to the nehe style tutorials for windows like
setting up a window that is capable of displaying things via opengl.
I know that there are ports of nehe basecodes to linux but since this forum is aimed towards linux opengl development i thought i ask for some tutorials where everything is explained in detail just from the beginning point to the final black opengl window (like in windows CreateWindow -> wglMakeCurrent), another thing that bothers me is that there are some opengl distributions or something like that, which one do you recommend. Further explanations are very welcome, tnx in advance

It’s the same under Linux as on Windows, just use glx instead of wgl (docs @ XFree86.org documentation pages).
(and of course you should use X then, and not win32… but be warned: X can be a real bitch)

And I’ve never heard about an ‘opengl distribution’
Any distro (even LFS) can use OpenGL, as long as the correct drivers are installed/used.

Hi!

GLFW is a cross-platform OpenGL framework API (similar to GLUT - but yet different enough to make it interesting ). You will find some NeHe style (“from-scratch”) tutorials on the GLFW page (hopefully more will come - when I get the time to write them). GLFW currently supports Win32 & Unix (Linux, IRIX, SunOS, etc). A Mac OS X port is being worked on, and even an AmigaOS port

With ‘OpenGL distros’, do you mean drivers? Check http://hem.passagen.se/opengl/getstarted/ (click the ‘Drivers’ link). Linux is not much different from Win32 - each manufacturer supplies its own GL driver. The installation process is quite different though, so carefully read the installation instructions.

By the way, richardve, I think X is much nicer to code than Win32. The latter is too much of let’s-add-a-function-for-this-thing-too, rather than a robust underlying philosophy. Plus, of course, the entire X protocol (including glX) can run across a network - which is very cool. Both interfaces suffer from pretty poor naming conventions etc, though.

The two major drawbacks of X (in my opinion) are: 1) the lack of a unified window manager interface (different window managers require different code), and 2) the lack of a standardized GUI toolkit (there are of course MOTIF, GTK etc, but they are not core X). Neither of these two will bother you too much if you’re coding pure OpenGL though (especially not if you use a tool like GLFW).

[This message has been edited by marcus256 (edited 01-19-2003).]

i am sorry for the word opengl distributions that i used. what i meant was that on windows you have the opengl32.dll/ gl.h but on several pages i searched i saw glut, mesa (i know these are for windows too), and some more implementations or workarounds i don’t know how to call them. tnx for your tips i will check them out.
Another questions i have (non opengl related) is how to create makefiles or is there any tutorial on that topic (i used msvc++ and never did any makefiles) and i forgot the commandname that lists me all running processes including their pid, if anyone knows i would be very happy to hear
Tnx in advance

You might want to get the basecode from the nehe ports and then get the xlib reference manual and start looking up the functions etc. to see more or less how things work.You’re going to need the xlib progamming manual if you want to write X code anyway.
marcus:I don’t think a widget toolkit has anything to do with a windowing system.It is therefore in theory better and more correct to allow for the development and use of many toolkits as a layer on top of X(isn’t it)?

okay so i will take a closer look on that xlib manual thing, tnx for the help and expect more questions soon
another question is x11 the same as x or is this something different

[This message has been edited by powerpad (edited 01-20-2003).]

zen, yes I totally agree that the widget library and core windowing API should be separate (that’s the way it was done under AmigaOS too, for instance). The problem is that there is not even a crappy-looking-low-end-less-functional standard widget library that is associated with X. The best thing we have is Xt, and that hardly fulfills the needs. MOTIF is commercial, and lesstif is far from available everywhere.

My problem is that I would like to add some very basic GUI dialog functions to GLFW (e.g. YES/NO prompts and a video mode selection dialog), without mandating the installation/use of a 3rd party library - GLFW should compile out of the box on any X(11) system, so MOTIF/lesstif/GTK is not an option.

powerpad, X11 is just short for “X Window System version 11”. You will also see things like X11R6, where R6 means revision 6 (or release 6?). X11R6 is the latest (I’ve even seen notations like X11R6.3). X10 is many years old, so I don’t think you’ll ever encounter it.

Process view: top

Makefiles… They use a very simple syntax, basically the two only constructs you have to deal with are:

  1. Dependencies. If FileA is older than FileB, then execute ThisAndThat (which should usually generate FileA):

FileA: FileB
<tab>command1
<tab>command2
<tab>etc

Example:

mysource.o: mysource.c
<tab>gcc -c mysource.c

  1. String constants.

Assignment:
A = xyz

Using constant:
$(A)

Knowing this, you should be able to poke into just about any makefile to learn how to create your own (try the GLFW source, for instance). Someone once said: “Only one makefile has ever been written. All other makefiles are derivatives of that one makefile.” (or something similar)

More on makefiles…

Search google for “makefile tutorial”.

Here is a good introduction: http://users.actcom.co.il/~choo/lupg/tutorials/writing-makefiles/writing-makefiles.html

The GNU make manual can come in handy: http://www.gnu.org/manual/make/html_node/make_toc.html

Here is a tutorial for how to use makefiles under Windows (that’s how I use MSVC - no freaking IDE ): http://www.opussoftware.com/tutorial/TutMakefile.htm

[This message has been edited by marcus256 (edited 01-20-2003).]

Originally posted by marcus256:
By the way, richardve, I think X is much nicer to code than Win32. The latter is too much of let’s-add-a-function-for-this-thing-too, rather than a robust underlying philosophy. Plus, of course, the entire X protocol (including glX) can run across a network - which is very cool. Both interfaces suffer from pretty poor naming conventions etc, though.

Well, it’s a bit nicer when you know how it works, yes… but when you’re just using it for the first time it really is a bitch, mostly because there’s not that much (good) documentation either.

The two major drawbacks of X (in my opinion) are: 1) the lack of a unified window manager interface (different window managers require different code)

True, but it’s becoming better (see freedesktop.org)
And the window managers themselves also become better
(for example, the latest version of Metacity combined with a Gtk2-xsync patch makes things much faster when resizing a window (and nice too because Gtk2 uses double buffering for each widget))

  1. the lack of a standardized GUI toolkit (there are of course MOTIF, GTK etc, but they are not core X).

Yeah, but X was never meant to be that

tnx again for the help on what x(11) is and on the link / little tutorial presented to explain those makefiles

richardve:do you have a copy of the X11 programming manual(in html that is).It explains every call and also has quite a few sections on doing most of the stuff you acn do in X(explaining for example window creation,event handling,keycodes vs. keysyms etc.).with that I didn’t have much trouble(not [b]much[\b]) with X for simple tasks like windows,events etc.
I don’t know much about win32 but from some old posts especially by marcus it looks like it sucks quite a bit.
marcus:why don’t you use ogl for the interface?It should be fairly easy for simple things like dialog boxes,etc.

Originally posted by zen:
richardve:do you have a copy of the X11 programming manual(in html that is).

I think this is an incomplete HTML conversion of the Xlib Programming Manual (fairly unstructured) - I used it alot:
http://library.psyon.org/programming/xlib/

This one looks more complete:
http://mac.pp.ru/Xlib/contents.html

For a PS version (I converted it to PDF using GSview):
ftp://ftp.x.org/pub/R6.6/xc/doc/hardcopy/X11/

The x.org site also has some good background infos:
http://www.x.org/X11.htm

I don’t know much about win32 but from some old posts especially by marcus it looks like it sucks quite a bit.

That’s my opinion, anyway There are many flaws in the Win32 API, like:

  • Poor naming conventions (and uninformative function names, e.g. CloseWindow() iconifies a window!)

  • Many different functions do the same thing

  • Many functions work differently depending on Windows version (X is more unified accross different platforms than Windows is accross different versions!)

  • Very low level data/register handling. For instance, the CharUpper function takes a 32-bit argument. If the upper 16-bit part of the argument is zero, then the lower 16 bits must be a character code. If the upper 16-bit part of the argument is non-zero, then the argument must be a string pointer (!!!).

  • If an application has opened a window, it must empty the event queue frequently, or the system may stall!

A good thing, though, is the online manuals at http://msdn.microsoft.com/ - something that I miss on the X side (there are of course man-pages - Linux, google etc - but they are not as structured as the MSDN site).

marcus:why don’t you use ogl for the interface?It should be fairly easy for simple things like dialog boxes,etc.

I’ve thought about it (it’s still an option), but then I miss out on the opportunity to use system style dialogs (e.g. nice aqua dialogs under Mac, or native video mode selection dialogs under AmigaOS).

At the moment, I am considering using GTK if it exists (find out using my compile.sh script), or fall back to no dialog at all. I think the GLFW API would look like this:

glfwOpenWindowHint( GLFW_VIDEO_MODE_DIALOG, GL_TRUE );
glfwOpenWindow( preferred, parameters, … );

The video mode dialog would pop up a list of fullscreen videomodes and a check-box for using windowed mode instead of fullscreen mode. The checkbox and the list would be pre-selected according to the preferred parameters passed to glfwOpenWindow. If no video mode dialog is possible (no GTK), simply use the preferred parameters.

[This message has been edited by marcus256 (edited 01-21-2003).]

Marcus, this is a bit OT, but on the subject of GUIs and widgets, what do you think about Qt? I’ve also heard mention of ParaGUI. I’m interested in this topic because soon I’m going to need to start working on a GUI for a Linux program I’m developing.

Gib

gib,

I have no idea… I’m very new to GUIs under X. In any case, I think you have to figure out what you need. My need is simple: I will use the GUI toolkit that is the most portable, easiest to get and build (=free) and meets some functional requirements that I have (e.g. “close window” etc should NOT do exit() on my app).

If the toolkit is light and/or has good looks, it’s a bonus.

If the toolkit has support for complex OO design comes in a distant last place of my priority list (I will only be using it for requesters anyway).

Originally posted by gib:
[b]Marcus, this is a bit OT, but on the subject of GUIs and widgets, what do you think about Qt? I’ve also heard mention of ParaGUI. I’m interested in this topic because soon I’m going to need to start working on a GUI for a Linux program I’m developing.

Gib[/b]

Never mention QT! I am going insane because of the Opengl overlays supporting on QT.

You can use GLUT or SDL. Its the same as win32 pretty much. Most win ogl tutorials are easily converted to linux especially with SDL. QT and GTK are really for apps(like gaim kdevelop etc) you seem to just want to do ogl so dont worry about that stuff.

no, no i not only wanna do ogl i also want to get familiar with linux, and that window managing stuff, for the ogl thing i could have used windows (since the drive and tutorial support is very well as you have to admit)

If you want to get to know linux just play around with it. The way I learned was from screwing with linux everyone inawhile totaling it and having to reinstall but live and learn . For tutorials in QT/KDE look on www.kdevelop.org