Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: How to reach OpenGL?

  1. #1

    Question How to reach OpenGL?

    Hello, I want to make OpenGL programs by c++. Correct me, if I'm wrong. I think:
    1. GPU makers implement OpenGL, and directx. AMD, and Nvidia provide their own implementations of OpenGL APIs, and it comes with their drivers.
    2. Mesa's an open-source implementation of OpenGL. It can use hardware acceleration of Nvidia and AMD GPUs
    3. Proprietary drivers implementation's faster than Mesa.
    4. I installed fglrx from OpenSUSE, so I have the driver, and the APIs.
    I want to learn OpenGL, but I can't find it's library. When I compile:
    Code:
    #include <GL/gl.h>#include <GL/glut.h>
    void display()
    { 
    }
    int main(int argc, char **argv)
    {
        glutInit(&argc, argv);
        glutDisplayFunc(display);
        glutMainLoop();
    }
    , I get
    fatal error: GL/gl.h: No such file or directory
    #include <GL/gl.h>
    ^
    compilation terminated.
    1. How to use OpenGL provided with the drivers?
    2. If I want to use Mesa, what package should I install in OpenSUSE?
    Notes:
    1. I just downloaded the 64bit package for OpenSUSE 13.1, and installed it. I've switchable graphics AMD + Intel.
    2. I can run DOTA 2, so I guess the driver's successfully installed.
    3. What I wrote may be wrong.

  2. #2
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,654

    Default Re: How to reach OpenGL?

    Install freeglut-devel and Mesa-libGL-devel for the missing header
    files. I have no experience with ati, so I do not know if they provide
    an extra SDK with special header files.

    --
    PC: oS 13.1 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.11 | GTX 650 Ti
    ThinkPad E320: oS 13.1 x86_64 | i3@2.30GHz | 8GB | KDE 4.11 | HD 3000
    HTPC: oS 13.1 x86_64 | Celeron@1.8GHz | 2GB | Gnome 3.10 | HD 2500

  3. #3

    Post Re: How to reach OpenGL?

    Quote Originally Posted by martin_helm View Post
    Install freeglut-devel and Mesa-libGL-devel for the missing header
    files. I have no experience with ati, so I do not know if they provide
    an extra SDK with special header files.
    Hello, I installed freeglut-devel, which came with Mesa-libGL-devel, and I can use OpenGL now. Thanks for your help.
    I meant the ordinary OpenGL libraries (like libGL.so), which I think it's provided by AMD, and Nvidia, and I think it has better performance, and support for the latest versions of OpenGL (Mesa supports OpenGL 3.1).

  4. #4
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,654

    Default Re: How to reach OpenGL?

    Am 26.01.2014 15:56, schrieb sherif6:
    > Hello, I meant the ordinary OpenGL libraries(*-like libGL.so-*), which I
    > think it's provided by AMD, and Nvidia, and I think it has better
    > performance,

    Ok I misinterpreted what you meant, at least for nvidia you will have
    the linkage against the nvidia proprietary libraries automatically when
    you specify the usual -lGL as it overwrites the mesa libs (not really it
    just changes the symbolic links, I would need to check that).
    I would guess it is the same or similar if you have fglrx for ati
    installed and nothing special has to be done.

    --
    PC: oS 13.1 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.11 | GTX 650 Ti
    ThinkPad E320: oS 13.1 x86_64 | i3@2.30GHz | 8GB | KDE 4.11 | HD 3000
    HTPC: oS 13.1 x86_64 | Celeron@1.8GHz | 2GB | Gnome 3.10 | HD 2500

  5. #5
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,654

    Default Re: How to reach OpenGL?

    Just to add that you may want to check it yourself to be sure.
    Code:
    martinh@sirius:~/tmp> ldd a.out
    linux-vdso.so.1 (0x00007fff8cffe000)
    libGL.so.1 => /usr/X11R6/lib64/libGL.so.1 (0x00007f7c98771000)
    libglut.so.3 => /usr/lib64/libglut.so.3 (0x00007f7c98525000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f7c98176000)
    libnvidia-tls.so.331.38 =>
    /usr/lib64/tls/libnvidia-tls.so.331.38 (0x00007f7c97f73000)
    libnvidia-glcore.so.331.38 =>
    /usr/lib64/libnvidia-glcore.so.331.38 (0x00007f7c95765000)
    libX11.so.6 => /usr/lib64/libX11.so.6 (0x00007f7c95427000)
    libXext.so.6 => /usr/lib64/libXext.so.6 (0x00007f7c95215000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f7c95011000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f7c94d0e000)
    libXi.so.6 => /usr/lib64/libXi.so.6 (0x00007f7c94afe000)
    libXrandr.so.2 => /usr/lib64/libXrandr.so.2 (0x00007f7c948f4000)
    libXxf86vm.so.1 => /usr/lib64/libXxf86vm.so.1 (0x00007f7c946ee000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f7c98aa4000)
    libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x00007f7c944cf000)
    libXrender.so.1 => /usr/lib64/libXrender.so.1 (0x00007f7c942c5000)
    libXau.so.6 => /usr/lib64/libXau.so.6 (0x00007f7c940c1000)
    martinh@sirius:~/tmp> rpm -qf /usr/X11R6/lib64/libGL.so.1
    nvidia-glG03-331.38-23.1.x86_64
    martinh@sirius:~/tmp>
    For nvidia this shows that the libGL linked against is from nvidia-gl03
    which is the proprietary library (this rpm -qf of course only works
    because I used the rpm's for nvidia not the binary installer from their
    website).

    You can for sure do similar tests for your ati.


    --
    PC: oS 13.1 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.11 | GTX 650 Ti
    ThinkPad E320: oS 13.1 x86_64 | i3@2.30GHz | 8GB | KDE 4.11 | HD 3000
    HTPC: oS 13.1 x86_64 | Celeron@1.8GHz | 2GB | Gnome 3.10 | HD 2500

  6. #6

    Post Re: How to reach OpenGL?

    Quote Originally Posted by martin_helm View Post
    Just to add that you may want to check it yourself to be sure.
    Code:
    martinh@sirius:~/tmp> ldd a.out
    linux-vdso.so.1 (0x00007fff8cffe000)
    libGL.so.1 => /usr/X11R6/lib64/libGL.so.1 (0x00007f7c98771000)
    libglut.so.3 => /usr/lib64/libglut.so.3 (0x00007f7c98525000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f7c98176000)
    libnvidia-tls.so.331.38 =>
    /usr/lib64/tls/libnvidia-tls.so.331.38 (0x00007f7c97f73000)
    libnvidia-glcore.so.331.38 =>
    /usr/lib64/libnvidia-glcore.so.331.38 (0x00007f7c95765000)
    libX11.so.6 => /usr/lib64/libX11.so.6 (0x00007f7c95427000)
    libXext.so.6 => /usr/lib64/libXext.so.6 (0x00007f7c95215000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f7c95011000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f7c94d0e000)
    libXi.so.6 => /usr/lib64/libXi.so.6 (0x00007f7c94afe000)
    libXrandr.so.2 => /usr/lib64/libXrandr.so.2 (0x00007f7c948f4000)
    libXxf86vm.so.1 => /usr/lib64/libXxf86vm.so.1 (0x00007f7c946ee000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f7c98aa4000)
    libxcb.so.1 => /usr/lib64/libxcb.so.1 (0x00007f7c944cf000)
    libXrender.so.1 => /usr/lib64/libXrender.so.1 (0x00007f7c942c5000)
    libXau.so.6 => /usr/lib64/libXau.so.6 (0x00007f7c940c1000)
    martinh@sirius:~/tmp> rpm -qf /usr/X11R6/lib64/libGL.so.1
    nvidia-glG03-331.38-23.1.x86_64
    martinh@sirius:~/tmp>
    For nvidia this shows that the libGL linked against is from nvidia-gl03
    which is the proprietary library (this rpm -qf of course only works
    because I used the rpm's for nvidia not the binary installer from their
    website).

    You can for sure do similar tests for your ati.


    --
    PC: oS 13.1 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.11 | GTX 650 Ti
    ThinkPad E320: oS 13.1 x86_64 | i3@2.30GHz | 8GB | KDE 4.11 | HD 3000
    HTPC: oS 13.1 x86_64 | Celeron@1.8GHz | 2GB | Gnome 3.10 | HD 2500
    Output from
    Code:
    rpm -qf /usr/X11R6/lib64/libGL.so.1
    is
    file /usr/X11R6/lib64/libGL.so.1 is not owned by any package
    Output from
    Code:
    rpm -qf /usr/lib64/libGLU.so.1
    is
    libGLU1-9.0.0-7.1.2.x86_64
    Before installing freeglut-devel with Mesa-libGL-devel, the program in the first post hadn't compiled with -lGL, and -lGLU. Does it mean fglrx doesn't come with them?

  7. #7
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,654

    Default Re: How to reach OpenGL?

    Am 26.01.2014 23:06, schrieb sherif6:
    > Note: Before installing freeglut-devel with Mesa-libGL-devel, the
    > program in the first post didn't compile with -lGL, and -lGLU. Does it
    > mean fglrx doesn't come with them?


    I think you just have a more complex setting as you indicate in your
    first post that you have switchable graphics (I forgot about your dual
    graphics when I did my last post), so it makes a difference which
    graphics card is active for the run and you cannot use such a simple
    trick as I had shown, sorry I have no clue how to check for ati/intel
    dual graphics what is used with your program or not without benchmarking
    its performance.

    You may want to ask a moderator to move that thread to
    programming/scripting instead of hardware where it is now to get more
    feedback from other programmers who use in contrast to me amd gpu's.
    I am afraid they will not look here in hardware.

    --
    PC: oS 13.1 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.11 | GTX 650 Ti
    ThinkPad E320: oS 13.1 x86_64 | i3@2.30GHz | 8GB | KDE 4.11 | HD 3000
    HTPC: oS 13.1 x86_64 | Celeron@1.8GHz | 2GB | Gnome 3.10 | HD 2500

  8. #8

    Post Re: How to reach OpenGL?

    Quote Originally Posted by martin_helm View Post
    Am 26.01.2014 23:06, schrieb sherif6:
    > Note: Before installing freeglut-devel with Mesa-libGL-devel, the
    > program in the first post didn't compile with -lGL, and -lGLU. Does it
    > mean fglrx doesn't come with them?


    I think you just have a more complex setting as you indicate in your
    first post that you have switchable graphics (I forgot about your dual
    graphics when I did my last post), so it makes a difference which
    graphics card is active for the run and you cannot use such a simple
    trick as I had shown, sorry I have no clue how to check for ati/intel
    dual graphics what is used with your program or not without benchmarking
    its performance.

    You may want to ask a moderator to move that thread to
    programming/scripting instead of hardware where it is now to get more
    feedback from other programmers who use in contrast to me amd gpu's.
    I am afraid they will not look here in hardware.
    Hi, I found this post http://phoronix.com/forums/showthrea...e-wrong-soname, and I found in /usr/lib64/fglrx a script called switchlibGL:
    Code:
    #!/bin/sh#
    # Copyright (c) 2010-2013 Sebastian Siebert (freespacer@gmx.de)
    # All rights reserved.
    #
    # Permission is hereby granted, free of charge, to any person
    # obtaining a copy of this software and associated documentation
    # files (the "Software"), to deal in the Software without
    # restriction, including without limitation the rights to use,
    # copy, modify, merge, publish, distribute, sublicense, and/or sell
    # copies of the Software, and to permit persons to whom the
    # Software is furnished to do so, subject to the following
    # conditions:
    #
    # The above copyright notice and this permission notice shall be
    # included in all copies or substantial portions of the Software.
    #
    # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
    # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
    # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
    # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
    # OTHER DEALINGS IN THE SOFTWARE.
    
    
    # Set local language always to C
    export LC_ALL=C
    export LANG=C
    
    
    if [ "$(whoami)" != "root" ]; then
        echo "Must be root to run this script." 1>&2
        exit 1
    fi
    
    
    if [ $# -ge 2 ]; then
        echo "Usage: $(basename $0) <amd|intel|query>" 1>&2
        echo "Please choose one parameter" 1>&2
        exit 1
    fi
    
    
    ARCH=`uname -m`
    case "${ARCH}" in
        i?86)
            LIB="lib"
        ;;
        x86_64)
            LIB="lib64"
        ;;
    esac
    
    
    function switch_to_amd() {
    
    
        if [ -f /usr/${LIB}/libGL.so.1.2.0 ]; then
            OPENGL_VERSION="1.2.0"
            ln -snf /usr/X11R6/${LIB}/fglrx/fglrx-libGL.so.1.2 \
                    /usr/X11R6/${LIB}/libGL.so.1.2.0
            ln -snf libGL.so.1.2.0 /usr/X11R6/${LIB}/libGL.so.1.2
        elif [ -f /usr/${LIB}/libGL.so.1.2 ]; then
            OPENGL_VERSION="1.2"
            ln -snf /usr/X11R6/${LIB}/fglrx/fglrx-libGL.so.1.2 \
                    /usr/X11R6/${LIB}/libGL.so.1.2
        fi
        ln -snf libGL.so.1.2 /usr/X11R6/${LIB}/libGL.so.1
        ln -snf libGL.so.1 /usr/X11R6/${LIB}/libGL.so
        /sbin/ldconfig /usr/X11R6/${LIB}
        if [ "${LIB}" = "lib64" ]; then
            if [ "${OPENGL_VERSION}" = "1.2.0" ]; then
                ln -snf /usr/X11R6/lib/fglrx/fglrx-libGL.so.1.2 \
                        /usr/X11R6/lib/libGL.so.1.2.0
                ln -snf libGL.so.1.2.0 /usr/X11R6/lib/libGL.so.1.2
            elif [ "${OPENGL_VERSION}" = "1.2" ]; then
                ln -snf /usr/X11R6/lib/fglrx/fglrx-libGL.so.1.2 \
                        /usr/X11R6/lib/libGL.so.1.2
            fi
            ln -snf libGL.so.1.2 /usr/X11R6/lib/libGL.so.1
            ln -snf libGL.so.1 /usr/X11R6/lib/libGL.so
            /sbin/ldconfig /usr/X11R6/lib
        fi
    
    
    }
    
    
    function switch_to_intel() {
    
    
        if [ -f /usr/${LIB}/libGL.so.1.2.0 ]; then
            OPENGL_VERSION="1.2.0"
            ln -snf /usr/${LIB}/libGL.so.1.2.0 \
                    /usr/X11R6/${LIB}/libGL.so.1.2.0
            ln -snf libGL.so.1.2.0 /usr/X11R6/${LIB}/libGL.so.1.2
        elif [ -f /usr/${LIB}/libGL.so.1.2 ]; then
            OPENGL_VERSION="1.2"
            ln -snf /usr/${LIB}/libGL.so.1.2 \
                    /usr/X11R6/${LIB}/libGL.so.1.2
        fi
        ln -snf libGL.so.1.2 /usr/X11R6/${LIB}/libGL.so.1
        ln -snf libGL.so.1 /usr/X11R6/${LIB}/libGL.so
        /sbin/ldconfig /usr/X11R6/${LIB}
        if [ "${LIB}" = "lib64" ]; then
            if [ "${OPENGL_VERSION}" = "1.2.0" ]; then
                ln -snf /usr/lib/libGL.so.1.2.0 \
                        /usr/X11R6/lib/libGL.so.1.2.0
                ln -snf libGL.so.1.2.0 /usr/X11R6/lib/libGL.so.1.2
            elif [ "${OPENGL_VERSION}" = "1.2" ]; then
                ln -snf /usr/lib/libGL.so.1.2 \
                        /usr/X11R6/lib/libGL.so.1.2
            fi
            ln -snf libGL.so.1.2 /usr/X11R6/lib/libGL.so.1
            ln -snf libGL.so.1 /usr/X11R6/lib/libGL.so
            /sbin/ldconfig /usr/X11R6/lib
        fi
    
    
    }
    
    
    function get_current_driver() {
    
    
        if [ -f /usr/${LIB}/libGL.so.1.2.0 ]; then
            LIB_LINK="`readlink /usr/X11R6/${LIB}/libGL.so.1.2.0 2>/dev/null`"
        elif [ -f /usr/${LIB}/libGL.so.1.2 ]; then
            LIB_LINK="`readlink /usr/X11R6/${LIB}/libGL.so.1.2 2>/dev/null`"
        fi
    
    
        if [ "${LIB_LINK}" = "/usr/X11R6/${LIB}/fglrx/fglrx-libGL.so.1.2" ]; then
            echo "amd"
        elif [ "${LIB_LINK}" = "fglrx/fglrx-libGL.so.1.2" ]; then
            echo "amd"
        elif [ "${LIB_LINK}" = "/usr/${LIB}/libGL.so.1.2.0" ]; then
            echo "intel"
        elif [ "${LIB_LINK}" = "/usr/${LIB}/libGL.so.1.2" ]; then
            echo "intel"
        else
            echo "unknown"
        fi
    
    
    }
    
    
    case "$1" in
        amd)
            echo "Switch to AMD" 1>&2
            switch_to_amd
        ;;
        intel)
            echo "Switch to Intel" 1>&2
            switch_to_intel
        ;;
        query)
            get_current_driver
        ;;
        *)
            echo "Usage: $(basename $0) <amd|intel|query>" 1>&2
            exit 1
        ;;
    esac
    
    
    exit 0
    I ran it without knowing what it does, but I found in it libGL.so.1.2. Maybe the bug in the post is still exist?
    I agree with you. I'll send an E-mail to one of the global moderators to move it.

  9. #9

    Default Re: How to reach OpenGL?

    How to move a thread to an another location?

  10. #10
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,654

    Default Re: How to reach OpenGL?

    Am 29.01.2014 21:16, schrieb sherif6:
    >
    > How to move a thread to an another location?
    >
    >

    Below your posts there is a small triangle with an ! to report it, just
    enter as comment that you want to move it and where to move it. It is
    the report feature useful in such situations an admin will get the info,
    it is not only for spam.

    --
    PC: oS 13.1 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.11 | GTX 650 Ti
    ThinkPad E320: oS 13.1 x86_64 | i3@2.30GHz | 8GB | KDE 4.11 | HD 3000
    HTPC: oS 13.1 x86_64 | Celeron@1.8GHz | 2GB | Gnome 3.10 | HD 2500

Page 1 of 3 123 LastLast

Posting Permissions

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