Announcement

Collapse
No announcement yet.

OpenGL FAQ

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • OpenGL FAQ

    1. What is OpenGL?
    OpenGL is a library of 2D/3D graphic functions, which comes in the form of two DLLs - opengl32.dll and glu32.dll. OpenGL is open source and is a direct competitor to the Microsoft DirectX technologies. OpenGL exposes several hundred API (functions) which PowerBASIC programmers can use in their applications.

    OpenGL works at the "primitive" level. It draws only such basic shapes as points, lines, triangles, quads, and other polygons. This means that OpenGL is a low-level, procedural API, requiring the programmer to dictate the exact steps required to render a scene. This contrasts with descriptive languages where a programmer only needs to describe a scene and can let the library manage the details of rendering it.

    2. Where do I get OpenGL?
    The two OpenGL DLLs are included with Windows. You do not have to download any library files nor do you have to include the OpenGL DLLs in the distribution of your applications. See question #9 below for version release information and for instructions on how to determine which version of OpenGL is installed in your system.

    3. Where can I get the OpenGL include files?
    Jose Roca has created include files for both of the OpenGL DLLs. The two includes (gl.inc and glu.inc) are available at his web site and are included in his Windows API headers download file.

    4. Where are some good sources of information about OpenGL?
    There are literally hundreds of sites which provide information about OpenGL. Most, however are not directed towards PowerBASIC programming. Here are some of the more popular sites:

    These additional sites provide information specific to using OpenGL with PowerBASIC:

    Finally, there are two OpenGL books that get good press. Neither is PowerBASIC specific.

    5. How do I use OpenGL in PowerBASIC?
    In general, there are 3 steps involved in using OpenGL in your PowerBASIC application:
    • Use Window's API to create an OpenGL-compatible drawing canvas (dialog or control)
    • Use PowerBASIC code to detect user actions (mouse/keyboard)
    • Use OpenGL function to draw your 3D scenes

    Source code examples of applying these steps to your PowerBASIC application may be found in the PowerBASIC Source Code forum as well as on a few external web sites. Here are the links a DDT and SDK introductory example:


    6. How does OpenGL compare with DirectX?
    In general, both OpenGL and DirectX have their proponents. And both technologies have been successfully used in commercial products, including games. So whether one technology has an edge over the other is an ongoing debate. Go to Google and type in "opengl vs directx" and you'll find hundreds of discussions on this topic.

    7. Are There Limitations to OpenGL?
    There are two feature sets which OpenGL does not provide, that PowerBASIC programmers should be aware of:
    • 1. OpenGL cannot create windows
      You must use PowerBASIC and API functions (DDT or SDK) to create the window in which OpenGL will work
    • 2. OpenGL cannot receive user inputs
      Mouse and keyboard events are not detected by OpenGL. You must use PowerBASIC and API functions to monitor mouse and keyboard activity.

    8. What is GLUT?
    The two limitations mentioned above spawned several attempts to provide extensions to OpenGL to provide the windowing and user interface capabilities. Today, there are two available free libraries, GLUT (glut32.dll) and freeGLUT (freeglut.dll) which are very popular. Neither is distributed with Windows, but can be downloaded at their respective home pages:

    GLUT was last updated in 2001 but is still used by many programmers, whereas freeGLUT continues to be developed. The include files for both of these can be found at Jose Roca's web site.

    9. What is the latest version of OpenGL?

    4.0 is the latest version. Here's a history of version releases. To determine which version of OpenGL is installed on your system, you can use the source code provided here or this freeware utility. Both of these also provide information on OpenGL features supported by your system.
    • 4.0 2010
    • 3.3 2010
    • 3.2 2009
    • 3.1 2008
    • 3.0 2008
    • 2.1 2006
    • 2.0 2004
    • 1.5 2003
    • 1.4 2002
    • 1.3 2001
    • 1.2 1998
    • 1.1 1992
    • 1.0 1992


    10. Are there 3rd party tools are available that to help me add OpenGL to my PowerBASIC applications?

    There are several categories of tools which can help:
    Graphic Libaries:
    - GDImage - graphics library which supports OpenGL features
    Utilities:
    - GLView4 - analyze installed OpenGL features and hardware capabilities


    I welcome comments, suggestions, or corrections to this FAQ.
    Gary Beene
    Last edited by Gary Beene; 25 Jun 2010, 10:18 PM.

  • #2
    Jose Roca has created include files for both of the OpenGL DLLs. The two includes (gl.inc and glu.inc) are available at his web site and are included in his Windows API headers download file.
    They are excellent, I am using them for years. Just one more clarification - there are actually 4 headers:

    gl.inc
    This one is the most necessary for newcomers, provides access to OpenGL 1.1 API

    If you develop OpenGL 3.0+ application in forward compatible context, you cannot use all the function from this header, it contains deprecated functions.

    If you develop OpenGL 3.0+ application in backwards compatible context, you can use this header.

    glu.inc
    This one is good for beginners, as it makes easier to abstract some OpenGL concepts regarding projection and so on.

    If you develop OpenGL 3.0+ application in forward compatible context, do not use this header, it uses deprecated functions.

    If you develop OpenGL 3.0+ application in backwards compatible context, you can use this header.

    glaux.inc
    GLAUX has been used a lot around year 2000, but it is known to be not very reliable and is considered obsolete.

    glext.inc
    The most important header for people going the cutting edge route. It makes possible using functionalities like Vertex Buffer Objects or GLSL shaders.
    If you are doing game developer for living, you cannot live without this include file.

    6. How does OpenGL compare with DirectX?
    Better to compare OpenGL with Direct3D. DirectX is not just graphics, it is also about networking, sound and other multimedia related technologies.

    Three facts talking for preffering use of OpenGL from my point of view are:
    • Backwards compatibility ... for 20 years you can run the same code
    • As of now, speed of OpenGL and Direct3D applications is basically the same
    • OpenGL allows using techniques like last model of shaders and tesselation on Windows XP, while DirectX 10&11 requires Vista and 7 for it



    Petr
    Last edited by Petr Schreiber jr; 24 Jun 2010, 03:04 AM.
    [email protected]

    Comment


    • #3
      Gary: Thank you for all of your effort on the OpenGL front. I am glad to see people starting to use it with PowerBASIC.

      That said, FAQ #2 is a bit misleading:

      The two OpenGL DLLs are included with Windows. You do not have to download any library files
      Windows does not ship with full OpenGL support. Windows only ships with software emulated OpenGL support. ie, anything OpenGL will run extremely slow.

      To enable hardware accelerated OpenGL support you must download the graphics card drivers from the manufacturer of your graphics card. The graphics card manufacturers (not Microsoft) are the ones who provide hardware accelerated support for OpenGL.

      (Windows itself does include graphics card drivers that are limited and one of those limitations is the lack of proper OpenGL support.)

      FWIW, with OpenGL, the main problem EUs usually report is shoddy performance which is usually due to only having the graphics card drivers that ship with Windows installed


      Backwards compatibility ... for 20 years you can run the same code
      I won't name any names, but one gaming company I worked for in the late 90s would not listen to me when I said we needed to be using an OpenGL based 3D engine. Instead of listening to me, they opted to use a 3D engine based on Glide. Of course by the time the game was finished, Glide, 3DFX and Voodoo were all but dead and the company folded because they could not sell a game nobody could play

      Comment


      • #4
        The include files for both of these can be found at Jose Roca's web site.

        Link is broken!

        Comment


        • #5
          > Link is broken!

          It happens often with old threads.

          Try this one: http://www.jose.it-berater.org/smffo...p?topic=4833.0
          Forum: http://www.jose.it-berater.org/smfforum/index.php

          Comment


          • #6
            Hi Gary, your links are broken https://www.garybeene.com/power/opengl.htm

            could you please provide another link as I'm struggling to learn OpenGL

            Thank you Sir

            Comment


            • #7
              Maybe http://www.garybeene.com/power/code/...s%20-%20OpenGL ?

              Comment


              • #8
                Thank you Frank

                Comment

                Working...
                X