Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: [SOLVED] Getting started with openGL

  1. #1
    Join Date
    Nov 2007
    Beans
    273
    Distro
    Xubuntu 8.10 Intrepid Ibex

    [SOLVED] Getting started with openGL

    I need to learn to program basic openGL applications and such. The problem is, any online tutorials I find just get to programming, and do not deal with initial setup.

    I believe I need those header files (glx.h, gl.h, glu.h) in order to compile the C and C++ programs I am writing. Shouldn't they already be installed?

    I installed "build-essential" and have compiled and run C and C++ programs. It is just that the compiler spits back "not found" errors for the "GL_***" functions.
    Angel's Egg: Go watch this, and then the movie. You have never seen anything like it.
    A shout-out to the Linux Mint team for their excellent port of Ubuntu.
    Use any OS worry-free with Derek's Virtual Box.

  2. #2
    Join Date
    Apr 2006
    Beans
    220

    Re: Getting started with openGL

    Here is my humble recommendation. I would suggest for you to install either something like a perl, pythong binding to OpenGL(I'm not sure if this is the right terminology) or install SDL or GLFW. These libraries will handle the boring stuff for you. Creating a window, handling input etc. Believe me you do not want to code what those libraries do from scratch .

    The problem is, any online tutorials I find just get to programming, and do not deal with initial setup.
    What do you mean? Not matter which way you go you need to "program". Unless you use some sort of tool that will do things for you but I think you want to learn. Once you have managed to create a window with SDL or GLFW all you have to do is to follow any OpenGL tutorial like NeHe collections etc.

    -r
    EGE::Easy Game Engine
    The programmer must rely on good code, rather than language features, to avoid problems.
    -David Chisnall

  3. #3
    Join Date
    May 2008
    Beans
    Hidden!

    Re: Getting started with openGL

    Quote Originally Posted by Yuki_Nagato View Post
    I need to learn to program basic openGL applications and such. The problem is, any online tutorials I find just get to programming, and do not deal with initial setup.
    I suspect there's a need for a information reference like this , just a simple GL setup with a basic window displaying some shape for the different toolkits. (wxwidgets, GTK+, etc...)

    I looked at the recommendation of GLFW but it seems limited;

    It allows you to create an OpenGL-capable window. No menus, no buttons.


    Seems all it does is put up a window that you can render into.



    You might be better off just using GTK+ or QT, even FLTK is a good choice, it's the one I'm using right now for the function graphing program I'm working on.

    It's super simple to set up OpenGL with FLTK, and GTK+ is not so bad with GTK you'll also need the gtkglext library.

    If you need a GUI with OpenGL capability GLFW doesn't seem like what you need.

    What exactly are you wanting to do?


    Quote Originally Posted by Yuki_Nagato View Post
    I installed "build-essential" and have compiled and run C and C++ programs. It is just that the compiler spits back "not found" errors for the "GL_***" functions.
    Before dealing with this, we'd still need to know how you are going to create your OpenGL window?

    OpenGL does not create a window for you to render into. You could even create your window with Xlib , but the point is you'll need to sort that out first.
    Last edited by techmarks; September 12th, 2008 at 08:16 PM. Reason: the image was too big

  4. #4
    Join Date
    Apr 2006
    Beans
    220

    Re: Getting started with openGL

    Quote Originally Posted by techmarks View Post
    I looked at the recommendation of GLFW but it seems limited;
    Seems all it does is put up a window that you can render into.
    It does more than just put up a window . The op seems to want to learn OpenGL and not a GUI tool kit. Also, he needs to learn how to help the compiler find the needed libraries and headers.

    -r
    Last edited by rnodal; September 12th, 2008 at 08:00 PM.
    EGE::Easy Game Engine
    The programmer must rely on good code, rather than language features, to avoid problems.
    -David Chisnall

  5. #5
    Join Date
    Jun 2008
    Beans
    53
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Getting started with openGL

    I need those header files (glx.h, gl.h, glu.h) in order to compile the C and C++ programs I am writing
    Search in Synaptic for a package with glx & dev in the name, Description will be someting like "driver development files"

    For example, my driver is nvidia-glx-new-envy, and the matching package nvidia-glx-new-dev-envy contains a glx.h & gl.h

    Also, see
    http://ubuntuforums.org/showpost.php...34&postcount=2

  6. #6
    Join Date
    Aug 2007
    Beans
    33

    Re: Getting started with openGL

    glutmaster is what I would suggest for just starting out. It sets up a demoWindow class that you can use. It's fairly simple and uses C++ wrappers for the callback functions. All you have to do is make sure 'glut' is installed (search synaptic) and then download all the files into a directory. Then, you'll just have to do a 'make' and you should have a running application with two shapes. Super easy to modify and do your own stuff, just have to touch two methods.
    Last edited by bfhicks; September 13th, 2008 at 12:52 AM.

  7. #7
    Join Date
    Jan 2006
    Beans
    1,237
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Getting started with openGL

    Quote Originally Posted by Yuki_Nagato View Post
    I need to learn to program basic openGL applications and such. The problem is, any online tutorials I find just get to programming, and do not deal with initial setup.

    I believe I need those header files (glx.h, gl.h, glu.h) in order to compile the C and C++ programs I am writing. Shouldn't they already be installed?

    I installed "build-essential" and have compiled and run C and C++ programs. It is just that the compiler spits back "not found" errors for the "GL_***" functions.
    okay first you need to install these
    Code:
    sudo apt-get install mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev
    than you can include opengl headers like this
    Code:
    #include <GL/gl.h>
    #include <GL/glu.h>
    ...
    to compile your project add these as linker flags
    Code:
    -lGL -lGLU
    thats all you need to get started, also I highly recommend that you use glfw, glut or sdl. glfw is the simplest among these but it's very powerful too. also look at nehe.gamedev.net for tutorials

  8. #8
    Join Date
    Nov 2007
    Beans
    273
    Distro
    Xubuntu 8.10 Intrepid Ibex

    Re: Getting started with openGL

    Thank you all.

    I am beginning to receive less errors than before. Which libraries I had to install was most useful. I will continue to pursue this.
    Angel's Egg: Go watch this, and then the movie. You have never seen anything like it.
    A shout-out to the Linux Mint team for their excellent port of Ubuntu.
    Use any OS worry-free with Derek's Virtual Box.

  9. #9
    Join Date
    Nov 2007
    Beans
    273
    Distro
    Xubuntu 8.10 Intrepid Ibex

    Re: Getting started with openGL

    PHP Code:
    /tmp/cc97Lses.oIn function `resize':
    open_GL.c:(.text+0x16b): undefined reference to 
    `glutPostRedisplay'
    /tmp/cc97Lses.o: In function `display'
    :
    open_GL.c:(.text+0x5d1): undefined reference to `glutSwapBuffers'
    /tmp/cc97Lses.o: In function 
    `main':
    open_GL.c:(.text+0x5f7): undefined reference to `glutInit'
    open_GL.c:(.text+0x603): undefined reference to `glutInitDisplayMode'
    open_GL.c:(.text+0x61a): undefined reference to 
    `glutInitWindowSize'
    open_GL.c:(.text+0x62e): undefined reference to `glutInitWindowPosition'
    open_GL.c:(.text+0x63a): undefined reference to `glutCreateWindow'
    open_GL.c:(.text+0x646): undefined reference to 
    `glutDisplayFunc'
    open_GL.c:(.text+0x652): undefined reference to `glutIdleFunc'
    open_GL.c:(.text+0x65e): undefined reference to `glutReshapeFunc'
    open_GL.c:(.text+0x66a): undefined reference to 
    `glutKeyboardFunc'
    open_GL.c:(.text+0x676): undefined reference to `glutSpecialFunc'
    open_GL.c:(.text+0x680): undefined reference to `glutMainLoop'
    collect2: ld returned 1 exit status 
    That is what I get when I link up with:

    Code:
    gcc -lGL -lGLU open_GL.c
    Does anyone recognize what functions those are from? I ran some through Google, and the Windows people are linking up "glut32" and other "*32" files.

    I am using GLUT in this code.

    Such junk as:
    Code:
    gcc file.c -lglut -lGL -lGLU -lX11 -lXmu
    does not work.
    Angel's Egg: Go watch this, and then the movie. You have never seen anything like it.
    A shout-out to the Linux Mint team for their excellent port of Ubuntu.
    Use any OS worry-free with Derek's Virtual Box.

  10. #10
    Join Date
    Feb 2008
    Location
    readlink("/proc/self/exe"
    Beans
    1,120
    Distro
    Ubuntu Development Release

    Smile Re: Getting started with openGL

    Quote Originally Posted by Yuki_Nagato View Post
    PHP Code:
    /tmp/cc97Lses.oIn function `resize':
    open_GL.c:(.text+0x16b): undefined reference to 
    `glutPostRedisplay'
    /tmp/cc97Lses.o: In function `display'
    :
    open_GL.c:(.text+0x5d1): undefined reference to `glutSwapBuffers'
    /tmp/cc97Lses.o: In function 
    `main':
    open_GL.c:(.text+0x5f7): undefined reference to `glutInit'
    open_GL.c:(.text+0x603): undefined reference to `glutInitDisplayMode'
    open_GL.c:(.text+0x61a): undefined reference to 
    `glutInitWindowSize'
    open_GL.c:(.text+0x62e): undefined reference to `glutInitWindowPosition'
    open_GL.c:(.text+0x63a): undefined reference to `glutCreateWindow'
    open_GL.c:(.text+0x646): undefined reference to 
    `glutDisplayFunc'
    open_GL.c:(.text+0x652): undefined reference to `glutIdleFunc'
    open_GL.c:(.text+0x65e): undefined reference to `glutReshapeFunc'
    open_GL.c:(.text+0x66a): undefined reference to 
    `glutKeyboardFunc'
    open_GL.c:(.text+0x676): undefined reference to `glutSpecialFunc'
    open_GL.c:(.text+0x680): undefined reference to `glutMainLoop'
    collect2: ld returned 1 exit status 
    That is what I get when I link up with:

    Code:
    gcc -lGL -lGLU open_GL.c
    Does anyone recognize what functions those are from? I ran some through Google, and the Windows people are linking up "glut32" and other "*32" files.

    I am using GLUT in this code.

    Such junk as:
    Code:
    gcc file.c -lglut -lGL -lGLU -lX11 -lXmu
    does not work.
    apt-get update
    apt-cache search glut

    apt-get install apt-file
    apt-file update
    apt-file search glu.h
    all:~# apt-file search glut.h
    autoconf-archive: /usr/share/doc/autoconf-archive/html/ax_check_glut.html
    doc-linux-html: /usr/share/doc/HOWTO/en-html/Nvidia-OpenGL-Configuration/instglut.html
    fltk1.1-doc: /usr/share/doc/fltk1.1-doc/HTML/glut.html
    freeglut3-dev: /usr/include/GL/freeglut.h
    freeglut3-dev: /usr/include/GL/glut.h
    freeglut3-dev: /usr/share/doc/freeglut3-dev/freeglut.html
    libguichan-dev: /usr/include/guichan/glut.hpp
    libroot5.18: /usr/lib/root/5.18/cint/include/GL/glut.h
    python-opengl-doc: /usr/share/doc/python-opengl-doc/documentation/pydoc/OpenGL.GLUT.freeglut.html
    python-opengl-doc: /usr/share/doc/python-opengl-doc/documentation/pydoc/OpenGL.tests.test_loadglut.html
    all:~# apt-file search glu.h
    autoconf-archive: /usr/share/doc/autoconf-archive/html/ax_check_glu.html
    gambas2-doc: /usr/share/gambas2/help/help/comp/gb+opengl/glu.html
    libfltk1.1-dev: /usr/include/FL/glu.h
    libglu1-mesa-dev: /usr/include/GL/glu.h
    libroot5.18: /usr/lib/root/5.18/cint/include/GL/glu.h
    libsdl-erlang: /usr/lib/erlang/lib/esdl-0.96.0626/c_src/esdl_glu.h
    libsdl-erlang: /usr/lib/erlang/lib/esdl-0.96.0626/include/glu.hrl
    libsdl-erlang: /usr/share/doc/libsdl-erlang/html/doc/glu.html
    mingw32-runtime: /usr/i586-mingw32msvc/include/GL/glu.h
    sudo apt-get install freeglut3 freeglut3-dbg freeglut3-dev libglu1-mesa libglu1-mesa-dev libglui2c2 libglui-dev libglut3 libglut3-dev

    gcc OpenGL.c -o test -lglut
    Last edited by WitchCraft; September 13th, 2008 at 04:22 PM.
    In a world without walls and fences, who needs Windows and Gates?
    Linux is like a wigwam.... no Gates, no Windows but Apache inside!
    http://www.debianadmin.com
    apt-get install libstdc++6-4.3-doc

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •