OpenGL------Version History

Source: Internet
Author: User

Until today, there are nine versions of official OpenGL. (1.0, 1.1, 1.2, 1.2.1, 1.3, 1.4, 1.5, 2.0, 2.1)
The launch of each OpenGL release adds some new features that were popular or badly needed at the time. at the same time, OpenGL is backwards compatible , meaning that if a feature is present in a lower version, it will also be present in later versions. This feature also provides a bit of convenience for our programming.
The latest version of OpenGL is OpenGL 2.1, but not all computer systems have the latest version of OpenGL implementations. For example, if the Windows system does not have a graphics driver installed, or if the graphics driver does not come with OpenGL, the Windows system defaults to a software-implemented OpenGL, which does not use hardware acceleration, so the speed may be slow, the version is also very low, Only 1.1 versions are supported (I'm not sure if I hear that the OpenGL support from Windows Vista is available by default to version 1.4). Graphics giants such as Nvidia and ATI, whose mainstream graphics have basically provided support for OpenGL 2.1. However, some older graphics cards can only support OpenGL 2.0 or OpenGL 1.5 for reasons such as poor performance. Intel's integrated graphics, many of which only provide OpenGL 1.4 (which is said to have a later version, but I did not see).
OpenGL 2.0 is a larger change, and therefore the major version number is upgraded. It can be considered that OpenGL 2.0 is a watershed and supports OpenGL version 2.0, which is directly related to the effect of running OpenGL programs. I think the difference between OpenGL 1.5 and OpenGL 2.0 is like the difference between DirectX 8.1 and DirectX 9.0c, if you want to make an analogy.
Check your own version of OpenGL
It is easy to know the OpenGL version in your system by calling the Glgetstring function.

Const Char* Version = (Const Char*) glgetstring (gl_version);
printf("OpenGL version:%s\n", version);


Glgetstring (gl_version); Returns a String representing the version, The format of the string is x.x.x, which is three integers, separated by a decimal point, the first number represents the OpenGL major version number, the second number represents the OpenGL minor version number, and the third number represents the vendor release code. For example, I get "2.0.1"when I run, this means that my OpenGL version is 2.0 (major version number is 2, minor version number is 0), is the first release version of the manufacturer.
With the sscanf function, you can also divide a string into three integers for detailed judgment.

intMain_version, Sub_version, release_version;
Const Char* Version = (Const Char*) glgetstring (gl_version);
sscanf(Version,"%d.%d.%d", &main_version, &sub_version, &release_version);
printf("OpenGL version:%s\n", version);
printf("Major version:%d\n", main_version);
printf("Minor version number:%d\n", sub_version);
printf("Release number:%d\n", release_version);


Glgetstring can also get other strings.
Glgetstring (Gl_vendor); Returns the vendor for OpenGL.
Glgetstring (Gl_renderer); Returns the device that performs OpenGL rendering, usually the name of the video card.
Glgetstring (gl_extensions); Returns all supported extensions, separated by a space between each of the two extensions. See the description below for "OpenGL extensions" for details.
version Brief History
Different versions, the number of features available is different. Here is a list of the main features that are added when each OpenGL version is launched. Of course, each version of the revision is not just the following content, if you need to know more detailed situation, you can review the OpenGL standard.
OpenGL 1.1
A vertex array. All the vertex data (color, texture coordinates, vertex coordinates, etc.) are put into the array, which can greatly reduce the number of calls such as glcolor*, glvertex* and other functions. Although the display list can also reduce the number of calls to these functions, the data in the display list is not modifiable, and the data in the vertex array can be modified.
The texture object. The texture is managed as an object, and OpenGL can hold multiple textures at the same time (but only one of them is used). OpenGL can only hold one "current texture" when no texture object was previously available. To use other textures, only discard the current texture and reload. The original way is very influential in efficiency.
OpenGL 1.2
Three-dimensional texture. Previous OpenGL only supported one-dimensional, two-dimensional textures.
Pixel format. The new pixel format, such as Gl_bgra, has been added to the original. Allows compressed pixel formats, such as the Gl_unsigned_short_5_5_5_1 format, to represent two bytes, storing RGBA data, where R, G, b each account for 5 bits, and a for a bits.
Image processing. A new "image processing subset" has been added to provide special features for image processing, such as convolution, computed histogram, etc. Although this subset is a standard rule, OpenGL implementations can also choose not to support it.
OpenGL 1.2.1
No new features were added. However, the concept of "arb extension" was introduced. See the description below for "OpenGL extensions" for details.
OpenGL 1.3
Compresses the texture. When working with textures, use a compressed texture instead of the texture itself, which saves space (memory-saving) and transmission bandwidth (saving data from memory to video)
Multiple textures. Use multiple textures at the same time.
Multiple sampling. A full-screen anti-aliasing technique that allows the screen to be displayed smoother and less jagged when used. For NVIDIA graphics cards, there is a "3D smoothing setting" at setup, which is actually multi-sampling. You can usually choose 2x, 4x, high-performance graphics card can also choose 8x, 16x. Other graphics cards have similar setup options, but some video cards do not support multiple sampling, so it is 0x.
OpenGL 1.4
Depth texture. Depth values can be placed in the texture like pixel values, which is especially useful when drawing shadows.
Secondary color. Vertices have auxiliary colors in addition to colors. The use of light can show a more realistic effect.
OpenGL 1.5
The buffer object. Allows the data (primarily vertex data) to be left to OpenGL to be stored in higher-performance memory, increasing the drawing speed. has more advantages than vertex arrays. The vertex array simply reduces the number of function calls, and the buffered object not only reduces the number of function calls, but also speeds up data access.
Occlusion query. You can calculate how many pixels of an object will be drawn to the screen. If the object does not have any pixels to be drawn, then it is not necessary to load the relevant data (such as texture data).
OpenGL 2.0
Programmable coloring. Allows you to write a small piece of code in place of OpenGL's original vertex operation/fragment operation. This provides great flexibility and can achieve a wide variety of rich effects.
The texture size no longer has to be 2 of the entire number of times.
Point block texture. Applying a texture to a point, which may be more than one pixel in size, can be more efficient than drawing a rectangle.
OpenGL 2.1
Programmable coloring, the programming language is upgraded from the original version 1.0 to version 1.2.
The buffer object, which originally allowed only vertex data, is now also allowed to hold pixel data.
Get a new version of OpenGL
To get a new version of OpenGL, you should first login to your graphics card manufacturer's website and inquire about the latest information. Depending on the situation, download the latest driver or OpenGL package.
What if your graphics card doesn't support high-version OpenGL, or your operating system doesn't provide OpenGL at all? There is an open source project called Mesa, which has been written in C for an OpenGL implementation, and the latest Mesa 7.0 has implemented the various functions specified in the OpenGL 2.1 standard. Download Mesa's code and compile it to get the latest version of OpenGL. Oh, don't be happy too early. Mesa is software-implemented, which means that hardware acceleration is not used, so it can be slower to run, especially when using some of the advanced features specified by the new version of OpenGL, which is almost unbearable. Mesa won't let you play new games with your old graphics card (it's probably too slow to play), but if you just want to learn or try out the various features of the new version of OpenGL, Mesa can meet a subset of your requirements.
OpenGL Extension
The OpenGL version of the update is not fast. If a technology becomes popular, but there is no relevant provision in the OpenGL standard to support this technology, it can only be achieved by extension.
When the vendor releases OpenGL, in addition to complying with the OpenGL standard, providing the various functions provided by the standard, there are often other additional functions, which is the extension.
The presence of extensions makes it possible for new technologies to be quickly applied to OpenGL. For example, "multiple textures", which were added to the standard in OpenGL 1.3, and many OpenGL implementations were extended to support "multiple textures" before OpenGL 1.3 appeared. This way, even if the OpenGL version is not updated, you can provide new functionality as long as you add a new extension. This also means that even if the OpenGL version is low, it does not necessarily support some of the features that are provided by high-version OpenGL. In fact, some implementations of OpenGL 1.5 may also provide most of the functionality provided by the latest version of OpenGL 2.1.
Of course, the extension also has a disadvantage, that is, the program must be run at the time to check whether each extension is supported, resulting in complex code writing program.

name of the extension
Each OpenGL extension must be registered with the OpenGL site before it can become an extension. The extension after registration has a number and a name. The number is just an ordinal, and the name is related to the functionality provided by the extension.
The name is divided into three parts with an underscore. For example, the name of an extension might be: gl_nv_half_float, which has the following meanings:
The first part is the goal of expansion. For example, GL says this is an OpenGL extension. If it is WGL, this is an OpenGL extension for Windows, and if it is GLX it is an OpenGL extension of the X Window System for Linux.
The second part is the vendor that provides the extension. For example, NV says this is an extension provided by Nvidia. The corresponding ATI, IBM, SGI, APPLE, Mesa and so on.
The rest of the section represents what the extension provides. For example, Half_float, which represents a semi-precision floating-point number, has only half the precision of a single-precision floating-point number, so it can be saved with only two bytes. This expansion saves memory space and saves data from memory to the video card, at the cost of reduced accuracy.
ext extensions and ARB extensions
At first, each vendor offered its own extensions. The result is that, even if the same functionality is provided, different vendors offer different extensions, so it is cumbersome to use a feature to check each extension that might support this function when writing a program.
The ext extension and arb extension appear.
Ext extension is an extension that is formed by a number of vendors, and in the extension name, the "Vendor offering extension" column will no longer be a specific vendor name, but ext three letters. Gl_ext_bgra, for example, is an EXT extension.
ARB extensions are not only negotiated by multiple vendors, but also validated by the OpenGL Architecture Audit Committee (ARB). In the extension name, the "Vendor for Extended" column is no longer a specific vendor name, but a three-letter arb. Gl_arb_imaging, for example, is an ARB extension.
Typically, a feature is an ext extension if it is presented by multiple vendors. In a later time, if the ARB is confirmed, it becomes an arb extension. Later, if the maintainer of OpenGL believes that this functionality needs to be added to the standard specification, it is no longer an extension, but a part of the standard.
For example, Point_parameters, which is the first gl_ext_point_parameters, then Gl_arb_point_parameters, and finally to OpenGL 1.4, this feature provides the functionality required by the standard, is no longer an extension.
When using the features provided by OpenGL, you should follow the precedence of standard features, ARB extensions, ext extensions, and other extensions. For example, if an arb extension supports this feature, the EXT extension is not used.
In the program, determine if OpenGL supports an extension
As already mentioned, Glgetstring (gl_extensions) returns the names of all the extensions currently supported by OpenGL, separated by spaces, which is the basis for determining whether an extension is supported.

#include <string.h>//determine if OpenGL supports a specified extension//if supported, returns 1. Otherwise, 0 is returned. intHasextension (Const Char*name) {    Const Char* Extensions = (Const Char*) glgetstring (gl_extensions); Const Char* End = extensions +strlen (extensions); size_t Name_length=strlen (name);  while(Extensions <end) {size_t position= STRCHR (Extensions,' ') -extensions; if(Position = = Name_length &&strncmp (extensions, name, position)==0 )            return 1; Extensions+ = (position +1); }    return 0;}

The above code determines whether OpenGL supports the specified extension, and it can be seen that the judgment is accomplished entirely by string processing. Loop detection, find the first space, and then compare whether the string before the space matches the specified name. If consistent, the extension is supported, otherwise, the comparison continues. If all content is compared, the extension is not supported.
The ability to write program call extensions
Extended functions, constants, are slightly different from the usual OpenGL functions and constants when named. That is, the extended function, the constant will be the name of the manufacturer as the suffix.
For example, ARB extension, all ARB extension functions, function names end with ARB, constant names end with _arb. For example:
Glgenbufferarb (function)
Gl_array_buffer_arb (constant)
If you already know that OpenGL supports an extension, how do I invoke a function in the extension? The general idea is to use a function pointer. Unfortunately, in different operating systems, the methods for obtaining these function pointers vary. In order to be able to use the extension smoothly in each operating system, I introduce you to a small tool: GLEE.
Glee is an open source project that can be searched and downloaded from the Web. Its code consists of two files, one is glee.c and the other is GLee.h. Put two files in your own source code together compile, run, Glee can automatically determine whether all extensions are supported, if supported, Glee will automatically read the corresponding function for us to call.
When we write our own code, we need to include GLee.h first, then we will include gl/glut.h (note the order cannot be swapped), then we can easily use the various extension functions.

#include "GLee.h"
#include<GL/glut.h>//Note order, GLee.h to be used before glut.h


Glee can also help us to determine if OpenGL supports an extension, so with glee, it is not necessary to determine whether an extension is supported by the previous function.
Sample code
Let's end this lesson with a sample code.
We select an extension gl_arb_window_pos that is currently supported by most graphics cards to illustrate how to use Glee to invoke OpenGL extension functionality. Usually when we draw pixels, we need to use the glrasterpos* function to specify where to draw. However, the glrasterpos* function is not using screen coordinates, such as specifying (0, 0) is not necessarily the lower left corner, this coordinate needs to undergo various transformations (see Lesson Five, transformations), and finally get the window position on the screen.
With the gl_arb_window_pos extension, we can use the coordinates of the screen directly to specify the position of the drawing, no longer need to be transformed, so in many cases it will appear simple.

#include"GLee.h"#include<GL/glut.h>voidDisplayvoid) {glclear (gl_color_buffer_bit); if(Glee_arb_window_pos) {//If you support Gl_arb_window_pos//Use the Glwindowpos2iarb function to specify the drawing positionprintf"Support gl_arb_window_pos\n"); printf ("use the Glwindowpos function \ n"); Glwindowpos2iarb ( -, -); } Else{//If Gl_arb_window_pos is not supported//you can only use the Glrasterpos* series function//First, we calculate a transformation to get//(100, 100) coordinates (x, y, z)//then call Glrasterpos3d (x, y, z);Glint viewport[4]; Gldouble modelview[ -], projection[ -];        Gldouble x, y, Z; printf ("gl_arb_window_pos\n not supported"); printf ("use the Glrasterpos function \ n");         Glgetintegerv (Gl_viewport, VIEWPORT);         Glgetdoublev (Gl_modelview_matrix, Modelview);         Glgetdoublev (Gl_projection_matrix, PROJECTION); Gluunproject ( -, -,0.5, Modelview, projection, viewport,&x, &y, &z);     Glrasterpos3d (x, y, z); }     { //draw a 5*5 block of pixelsGlubyte pixels[5][5][4]; //sets all pixels in the pixel to red        intI, J;  for(i=0; i<5; ++i) for(j=0; j<5; ++j) {pixels[i][j][0] =255;//Redpixels[i][j][1] =0;//Greenpixels[i][j][2] =0;//Bluepixels[i][j][3] =255;//Alpha} gldrawpixels (5,5, Gl_rgba, gl_unsigned_byte, pixels); } glutswapbuffers ();}intMainintargcChar*argv[]) {Glutinit (&argc, argv); Glutinitdisplaymode (Glut_rgba|glut_double); Glutinitwindowposition ( -, -); Glutinitwindowsize ( +, +); Glutcreatewindow ("OpenGL"); Glutdisplayfunc (&display); Glutmainloop ();}

As you can see, the code is much simpler when you use the extension. Features that require more code to be implemented when the Gl_arb_window_pos extension is not supported can be easily resolved with the gl_arb_window_pos extension.
If you modify the code and use the else code directly without the extension, you can see that the effect is the same.
Tool Software
At the end of the course I also introduce a free tool software, this is the OpenGL Extension Viewer (the major software sites are downloaded, please search by themselves), the newer version is 3.0.
This software can view OpenGL information on its own computer system. Includes the OpenGL version, vendor, device name, supported extensions, and so on.
The information that the software can view is detailed, such as viewing the maximum allowable texture size, the maximum number of lights, and so on.
When viewing the extension, you can enter the name of the extension in the bottom column, and press ENTER to connect to the OpenGL official website to find detailed documentation on the extension, very good.
According to the configuration of the computer, automatically connect to the corresponding official website, easy to download the latest driver. (For example, I am Nvidia's video card, then connect to the Nvidia driver download page)
You can do OpenGL testing to see how the performance works.
The overall report can be given, and if some of the more important features are not supported, they will be indicated in bold characters.
The software also comes with a database that allows you to query the various vendors and models of the graphics card support for OpenGL extensions.
Summary

This lesson describes the OpenGL version and the OpenGL extension.
OpenGL from birth to now, has undergone 1.0, 1.1, 1.2, 1.2.1, 1.3, 1.4, 1.5, 2.0, 2.1 of these versions.
The OpenGL version may be different in each system. Use Glgetstring (gl_version) to view the current OpenGL version.
The new version of OpenGL will be compatible with older versions of OpenGL, while providing more new features and functionality.
OpenGL can be extended to provide additional functionality when implemented.
OpenGL extensions include factory extensions, ext extensions, ARB extensions. You should always try to use standard features, followed by ARB extensions, ext extensions, and factory extensions.
Glee is a free-to-use tool that makes it easy to determine whether the current OpenGL supports an extension or to make it easy to invoke extensions.
The OpenGL Extension Viewer is a software that checks the version of OpenGL supported by the system, supported extensions, and many more details.

OpenGL------Version History

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.