) How to use OpenGL 2.0 APIs (including glsl) in Windows)

Source: Internet
Author: User
Tags unsupported

 

 

OpenGL version is too low

Http://forum.ubuntu.com.cn/viewtopic.php? F = 42 & t = 163346 & view = previous

The above article is a post on the UBUNTU Forum, which describes the relationship between OpenGL, Mesa, and graphics card drivers, but I still don't understand (dizzy)

[Excerpt] OpenGL is an international standard. The so-called international standard is something written on paper, rather than something actually available. But major manufacturers will follow this pile of paper to write OpenGL in their drivers. That is, OpenGL is a standard, and driver + ICD + OpenGL. dll is an implementation.
Mesa3d is an open-source OpenGL implementation.
The core function of mesa3d is soft acceleration, that is, all operations are performed by the CPU, and xlib is used for Screen Writing. DRI is a component of mesa3d and is responsible for Hard acceleration. It is called direct rendering ). Due to the current complex structure of mesa3d, functions implemented by soft acceleration cannot replace functions not implemented in direct rendering. That is to say, the core of mesa3d and the rendering of DRI are different. As a result, mesa3d has implemented opengl2.1, but the DRI driver is still running opengl1.3/1.4.
Each time mesa3d releases a new version, there will be a release note, an important part of which is the driver status, which details the current OpenGL support status of each mesa3d driver, here is the latest Mesa3D-7.2.
Driver status

Driver status
--------------------------------------------
DRI drivers varies with the driver
Xmesa/Glx (on xlib) implements OpenGL 2.1
Osmesa (off-screen) implements OpenGL 2.1
Windows/Win32 implements OpenGL 2.1
Glide (3dfx voodoo1/2) implements OpenGL 1.3
Svga unsupported
Wind River ugl unsupported
Djgpp unsupported
GGI unsupported
BEOs unsupported
Allegro unsupported
D3d unsupported

DRI represents varies with the driver, so the DRI components support different graphics cards. Intel, to 7.2, supports opengl1.4.

//////////////////////////////////////// /////////////////////

How to use OpenGL 2.0 APIs (including glsl) in Windows)

Http://bbs.gameres.com/showthread.asp? Threadid = 109485

First, let's briefly describe how OpenGL is developed in Windows:

1. Use opengl1.1 + glut provided by Windows (which must be compiled by yourself) or other glut Enhanced editions freeglut and openglut

2. Use Mesa

3. Use opengl1.1 + glut + glew provided by windows for extension

Some precautions for configuring OpenGL implemented by Mesa in Windows:

First, you need to download the source package to www.mesa3d.org. generally, you need to use two packages, mesalib.zipand mesaglut.zip. It is worth noting that, like many open-source projects, mesa3d only provides source code and does not provide directly available binary files, you need to re-compile the source code to use binary files. After the download is complete, put the two packages under the same directory and select "decompress to the current directory... to decompress the two packages. By default, the two packages are extracted to the same folder (for example, Mesa-7.0.3 ). Then, find the solution file (Mesa. sln) of Visual Studio 7.0.3 In the "/Mesa-2005/Windows/vc8" path ). Open it and find that there are many projects in this solution (generally four projects, such as GDI, Glu, Mesa, and osmesa). You do not need to modify any settings (the default is the debug target, not the release, do not modify). Right-click each project item in Solution Explorer on the right and select generate ". After all the projects are successfully generated, you can get 3 DLL files (opengl32.dll, glu32.dll, osmesa32.dll) from the path "/Mesa-7.0.3/lib) and the corresponding library file (*. lib ). Similarly, under the path "/Mesa-7.0.3/Windows/vc8/progs/glut", you can find the glut project file (glut. vcproj), generate the glut project according to the same method. Then, you can find the library file and the corresponding library file in the path "/Mesa-7.0.3/lib.

All the DLL files and corresponding library files of OpenGL 2.0 are obtained. All header files required for programming can be found in the path "Mesa-7.0.3/include" (or you can simply set this directory to the include search directory of Visual Studio ).

Note that the GL. h. h. h. H and other header files conflict, so it is best to delete the corresponding files in Visual Studio (we recommend that you back up these files). Similarly, the opengl32.lib file in Visual Studio should also be deleted (we recommend that you back up the files ).

 

Added by myself:

Alternatively, you can add the include, Lib, and path of Mesa to the system before include, Lib, and path when setting environment variables. For more information, see

// Mesa (another Implementation of OpenGL). bat

@ Echo off

Echo sets the Mesa (unofficial Implementation of OpenGL) Environment Variable
Echo note:
Echo -- Because Windows comes with 1.1opengl implementation
Echo -- the include directory of Windows SDK contains Gl. h and Glu. h.
Echo -- and opengl32.dll and glu32.dll under the System32 directory
Echo -- therefore, you need to add the include, Lib, and path of Mesa to the front of the system path,
Echo -- otherwise, an error occurs during compilation.

Set mesa_dir = D:/Program/MESA/Mesa-7.4.2

REM has added D:/Program/MESA/Mesa-7.4.2/bin to the user's path environment variable.
Rem Windows searches for the path from the user path, and then searches for the path of the system,
Rem therefore, mesa DLL is always found before opengl32.dll and glu32.dll of windows.
Rem set Path = D:/Program/MESA/Mesa-7.4.2/bin; % PATH %

Set include = % mesa_dir %/include; % include %

Rem does not include the debug version. The debug version has been compiled,
Rem, but I see that its demo does not link the lib and DLL of the debug version.

Set Lib = % mesa_dir %/LIB; % lib %

According to the content of the post referenced above, many people think that mesa is slower than d3d in windows. There are several statements:

1. opengl2.0, 1.1, or higher can be used for OpenGL development in windows, however, this requires the support of the video card driver and cannot be used across platforms.

2. Use glew. This library encapsulates different OpenGL extensions in a unified manner.

3. directly use Windows d3d or managed d3d (. NET d3d)

4. Mesa is more suitable for Linux, and its performance is no worse than that of d3d in windows. That is to say, Mesa is not suitable for Windows.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.