OpenGL (full write Open Graphics Library) is a programming language defines a cross, cross-platform programming interface specification, which for three-dimensional images (two-dimensional also.) OpenGL is a professional graphics program interface, is a powerful, easy to call the underlying graphics library.
directory
overview of the industry standard high-performance graphics algorithm development process status of OpenGL 3.1 features and functions of the advanced features introductory programming specifications and the difference between DirectX overview of the industry standard high-performance OpenGL ™ graphics algorithms is the industries most widely accepted 2D/3D graphics API, it has been spawned from the birth of a variety of computer platforms and equipment, thousands of excellent applications. OpenGL ™ is independent of the Windows operating system or other operating system is also network transparent. In includes CAD, content creation, energy, entertainment, game development, manufacturing, pharmaceutical and other industries in the area of Virtual Reality, OpenGL ™ help programmers to achieve in the PC, workstations, super computers and other hardware devices, high-performance, highly with a high impact visual expression graphics software.
OpenGL SGI, formerly known for its graphics workstations developed IRIS GL. IRIS GL is an industry standard 3D graphics software interface features, while powerful, but portability is not good, so SGI, IRIS GL will be the basis in the development of OpenGL. OpenGL's English name is Although the overall market leader in the home DirectX, but in the professional field of high-end graphics, OpenGL is the main character can not be replaced. OpenGL is a hardware-independent software interface, can be on different platforms such as Windows 95, Windows NT, Unix, Linux, MacOS, OS / 2 between the transplant. Therefore, support for OpenGL, the software has good portability, you can get a very wide range of applications. OpenGL is the graphics because the underlying graphics library, did not provide primitive geometric entities can not be directly used to describe the scene. However, through some conversion process, can easily be AutoCAD, 3DS/3DSMAX 3D graphics design software such as DXF and 3DS model produced files into OpenGL vertex array. There on the basis of the OpenGL Open Inventor, Cosmo3D, Optimizer and other high-level graphics library, to adapt to different applications. One, Open Inventor most widely used. The software is based on object-oriented toolkit for OpenGL to provide interactive 3D graphics applications to create objects and methods, provides predefined objects and events for the interactive processing module, create and edit 3D scenes of the advanced application unit , a print objects and exchange data with other graphics formats ability. OpenGL's development has been relatively slow in a situation, each version of the new technology to improve very little, mostly just to make some changes and improvement. July 1992, SGI released the OpenGL version 1.0 and later co-developed with Microsoft Windows NT version of OpenGL, so that some of the original high-end graphics workstations must be running on a large 3D graphics software on PC can be use. OpenGL version 1.1 in 1995 to market, this version has many performance than the 1.0 increase, and added some new features. These include improved printer support is included in the enhanced metafile call OpenGL vertex array of new features, improve the vertex position, normal, color, color index and texture coordinates, the polygon edges of the transmission speed of identification, introduced a new texture features and so on. OpenGL 1.5 has added a OpenGL 2.0 standard is not the principal strategist for the original SGI, but gradually take the initiative in the ARB in the status of 3DLabs. 2.0 The first step is complete with the old version of the compatibility between, while the vertex and pixel and memory management to work together with DirectX in order to maintain balance. OpenGL 1.3 OpenGL 2.0 will be associated with the existing features of the new functionality is fully compatible with the composition (Figure I). Stalled in the ARB to be launched each time a variety of instruction set extensions tangled to do a thorough streamlining. In addition, the realization of the hardware programmability also provides a better way to integrate the existing extensions. Now, with the continuous development and improvement of DirectX, OpenGL gradually lose the advantage, although there 3Dlabs has promoted the development of version 2.0 available, many of which joined in the programmable unit similar to the design of DirectX, but the manufacturer of the user's recognition knowledge is not high, the future prospects confused OpenGL. Development in July 1992, SGI released the OpenGL version 1.0 and later co-developed with Microsoft Windows NT version of OpenGL, so that some of the original high-end graphics workstations must be running on a large 3D graphics software can also microcomputer use. OpenGL 1.1 version of the 1995 market, the version number of performance improvements over 1.0, and added some new features. Including raising the vertex position, normal, color, color index and texture coordinates, the polygon edges of the transmission speed of identification,
air force one low nike, introduced a new texture features and more. 1997, Windows 95 games in large numbers under 3D, game development companies urgently need a powerful, compatibility, good 3D graphics interface, and when Microsoft's own DirectX 3.0, 3D graphics interface function is very bad. Thus the production of Microsoft finally the OSR2 version of Windows 95 and later Windows versions added support for OpenGL. This not only supports OpenGL, many widely used computer 3D games, and many in 3D graphics design software can also be used to support the standard OpenGL 3D accelerator card, which greatly improve the 3D graphics processing. 2003 July 28, SGI, and ARB announced OpenGL 1.5. OpenGL ARB OpenGL 1.5 includes specifications of the official extension language of drawing OpenGL 1.5 new features include: Vertex Buffer Object, Shadow features, hidden information, non-power texture. August 2004, OpenGL2.0 release ~ OpenGL 2.0 standard is not the principal strategist for the original SGI, but gradually take the initiative in the ARB in the status of 3Dlabs. opengl2.0 support the OpenGL Shading Language, new shader extension features several enhancements and other features. Early August 2008 at Siggraph 2008 Khronos Working Group meeting announced OpenGL 3.0 graphics interface specification, GLSL1.30 shader language, and other new features will once again open 3D interface to the development of future direction. OpenGL 3.0 API, code named Longs Peak, as usual, OpenGL 3.0 is still an open and cross-platform 3D graphics interface standard, popular in the Shader language today, OGL3.0 added a new version of the shader language: GLSL 1.30, can give full play to the potential of the current programmable graphics hardware. At the same time, OGL3.0 also introduces some new features, such as vertex matrix object, the object function of the whole frame buffer, 32bit floating point textures and render cache blocking queue based on the conditions of rendering, compact line of semi-floating-point vertex and pixel data, four new compression mechanism and so on. March 2009 also announced an upgraded version of the new specification OpenGL 3.1, is also a free cross-platform API set of the ninth update ever. Prior to the introduction of OpenGL 3.1 to OpenGL Shading Language buffer management. Broadly speaking, OpenGL 3.1, based on the 3.0 model system for the entire API has been simplified, and can greatly improve the efficiency of software development. August 2009 Khronos Group has released OpenGL 3.2, OpenGL since this is the year's third major upgrade. This version is still the direction of development continues to OpenGL graphics application developers in a variety of operating systems and platforms to better use the new GPU capabilities. OpenGL3.2 version improves performance, improved visual quality and improve the geometry processing speed, and make programs more easily ported to Direct3D OpenGL. In addition to OpenGL addition, Khronos will be the development of other standards to improve coordination in order to provide a wider field of powerful graphics capabilities and computing ecosystems, these standards include the use of parallel computing OpenCL, for mobile 3D the development of OpenGL ES graphics and 3D development for network WebGL. July 26, 2010 release OpenGL 4.1 and OpenGL OpenGL Shading Language 4.10. OpenGL4.1 enhance visual-intensive applications OpenCL ™ interoperability, and to continue to accelerate the calculation of profiles for the core support and compatibility for the first time introduced in OpenGL 3.2, allows developers to use a simplified API,
air force one shoes, or to retain backward compatibility with existing The OpenGL code, depending on their market needs. S Khronos OpenGL ARB (Architecture Review Board) of the Working Group introduced the GLSL 1.5OpenGLShading Language (OpenGL Shading Language) is an upgraded version of the framework and OpenGL3.2 introduced two new feature that allows developers to develop new procedures able to use the pipeline kernel features or compatibility features to choose between, which will provide compatibility with earlier versions of OpenGL features compatibility between. Features and functions of OpenGL is an open three-dimensional graphics packages, it is independent of the window system and operating system, in its based applications developed can be very easily portable between platforms; OpenGL can work closely with the Visual C + + interfaces for realized by the calculation and graphics algorithms, can guarantee the correctness and reliability; OpenGL easy to use and efficient. It has seven functions: 1. Modeling: OpenGL graphics library in addition to providing basic point, line, polygon drawing function, but also provide a complex three-dimensional objects (ball, cone, polyhedron, teapots, etc.) and complex curves and surface drawing function. 2. Transformation: OpenGL graphics library, including basic transformations of transformation and projection transformation. Transform a basic translation, rotation, mirroring the four transformation ratio transformation, projection transformation with parallel projection (also known as orthographic projection) and the two perspective projection transformation. The transformation helps to reduce the running time and improve the three-dimensional graphics display of speed. 3. Color mode: OpenGL color mode, there are two, namely, RGBA mode and color index (Color Index). 4. Light and material settings: OpenGL light has radiation light (Emitted Light), ambient light (Ambient Light), the diffuse (Diffuse Light) and specular light (Specular Light). Light reflectivity of the material is expressed. Scene (Scene) reflected in the final object the human eye color is light red, green and blue components of red, green and blue components and materials multiplied by the reflectivity of the color formed. 5: Texture Mapping (Texture Mapping). Texture mapping using OpenGL functions can be expressed very realistic surface details. 6: bitmap image display and image enhancement features in addition to basic reading and writing copy and pixels, but also provides integration (Blending), anti-aliasing (Antialiasing) and fog (fog) in the special image effects processing. The above three properties can be simulated more realistic, enhanced graphics effects. 7: double buffer animation (Double Buffering) double-buffer cache that is front and back cache, in short, the background scene cache calculated to generate the screen, front cache show back cache has drawn a good picture. In addition, the use of OpenGL but also to achieve the depth implied (Depth Cue), motion blur (Motion Blur) and other special effects. In order to achieve the blanking algorithm. Open GL is still status quo is the only alternative to Microsoft 3D graphics technology for complete control of the API. It still has some vitality, but the Silicon Graphics is no longer unhappy in any way to Microsoft's promotion of Open GL, so it there is a higher risk. Game developers is a country with independent-minded groups, many important developers are still in use Open GL. Therefore, the hardware developers are trying to strengthen the support for it. Direct3D is not presently support the high-end graphics equipment and professional applications; Open GL in these areas occupy a dominant position. Finally, the open source community (especially the Mesa project) has been dedicated to any type of computer (regardless of whether they use Microsoft's operating system) provides Open GL support. August 2008 formally announced OpenGL3.0 version. And received the support of nv, on its Web site to provide for the N card sdk download. At present, three-dimensional game development technology is a critical period in the catch-up abroad, from the creative, planning, research and development and implementation, operation and maintenance of the game, there are a lot of knowledge worth learning and exploration. The Linux operating system platform to promote, a variety of applications based on Linux software has grown, so cross-platform graphics library based on the three-dimensional cross-platform game development is also increasing. OpenGL (open graphics library) is an independent platform-independent development of three-dimensional graphics library, in the main frame under a variety of language development and application of OpenGL functions can be combined to develop three-dimensional games. However, due to platform development framework makes the game unable to compile and run cross-platform, so the way glut + OpenGL has become a good choice. But in the complex framework and support for various media, glut is not ideal. FLTK can be used under the Linux platform technology and other frameworks, including buttons, including a framework for more complex functions, but require specialized Linux development environment, many KDE lovers Window environment obviously can not fit in this. On the contrary, SDL (Simple DirectMedia Layer) as a free cross-platform multimedia application programming interfaces, has been widely used to develop two-dimensional game, good news of the framework of its support, file support, and so makes it sound support with Microsoft DirectX match one of the most mature technology. Khronos Group OpenGL 3.1 specification in March 2009 also announced an upgraded version of the new specification OpenGL 3.1, is also a free cross-platform API set of the ninth update ever. Prior to the introduction of OpenGL 3.1 to OpenGL Shading Language buffer management. Broadly speaking, OpenGL 3.1, based on the 3.0 model system for the entire API has been simplified, and can greatly improve the efficiency of software development. OpenGL 3.1 major new features: Texture Buffer Objects (texture buffer object), Uniform Buffer Objects (unified buffer object), Signed Normalized Textures (symbol normalized texture), Primitive Restart (to restart the basic elements), Instancing (instantiated), CopyBuffer API (copy buffer interface) ... ... and the OpenGL 3.1 specification synchronization,
nike air force one, OpenGL Architecture Review Board (ARB) has released a compatible extension that allows developers to access the OpenGL 3.1 The OpenGL 1.x/2.x have been deleted in the function to ensure full backward compatibility with applications. OpenGL 3.1 released, vendors will soon be the graphics industry support. AMD OpenGL director Suki Samra said: proudly announced the same day in regulating beta release of their drivers. AMD, NVIDIA, S3 Graphics video card driver currently has support for OpenGL 3.0. Advanced features OpenGL is designed to output only,
nike air force 1, so it provides only rendering functions. Core API has no window, audio, print, keyboard / mouse or other input device concept. Although this starting to look like a limit, but it allows the code to render him to run completely independent of the operating system that allows cross-platform development. However, some consolidation in what the native window system and the host system need to allow interaction. This is achieved through the following additional API: * GLX - X11 (including transparent network) * WGL - Microsoft Windows * AGL - Apple MacOS addition, GLUT library to a portable way to provide basic window functions. Introduction to OpenGL programming very easy drawing, so increasingly popular, but for many people, is carried out in the computer, the first problem encountered is how to adapt to computer environment. This is often the most crucial step, although also the most junior. In general, I do not recommend using glut package. So difficult to bring into full play the function of the interface windows. OpenGL programming in VC environment steps: the establishment of OpenGL-based application framework to create the project: the file -> New to create projects, based on a single document, View Cview add class library based on: the project-> Setting in the specified library initialization: Select View-> Class Wizard, open the MFC dialog box, add the appropriate class member added that the definition of OpenGL-based application framework have a good structure, after the user need only add the corresponding code to function. Here's how VC + + on OpenGL programming. OpenGL drawing of the general process can be seen as such, the first statement with the OpenGL graphics in OpenGL environment RenderContext (RC) in the draw a good map, and then process through a Swap buffer passed to the operating system to map drawing environment DeviceContext (DC) , the real way to draw to the screen. The following example to draw a Bezier curve, VC + + on the details of OpenGL programming method. The paper gives detailed notes in order to give clear guidelines for beginners. Do it step by step according to above, you will successfully draw the first to OpenGL graphics platform. First, the generation process framework Test.dsw New Project | MFC Application Wizard (EXE) | method produces BezierCurve.h BezierCurve.cpp two files: WorkSpace | ClassView | Test Classes | New Class | Generic Class (no MFC class) | write the definition and implementation of the following two files: BezierCurve.h BezierCurve.cpp four, set the build environment: 1. TestView.h within the BezierCurve.h and add: # include # include # include 2. in the Integrated Environment Project | Settings | Link | Object / library module | , set the OpenGL working environment: (following each operation, both for TestView.cpp) 1. processing PreCreateWindow (): set the OpenGL graphics window style cs.style | = WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CS_OWNDC; 2. processing OnCreate (): Creating OpenGL drawing equipment. OpenGL drawing mechanisms are: first with the OpenGL graphics context Rendering Context (referred to as RC) the picture is good, then painted Results SwapBuffer () function is passed to the drawing context of the Window Device Context (abbreviated as DC). Pay attention to that the program is running,
nike air force 1 high, you can have more than one DC, but only one RC. Thus, when a DC unfinished map, to the immediate release of RC, so that the other DC is also used. In the following code, will have more comments. int CTestView:: OnCreate (LPCREATESTRUCT lpCreateStruct) {if (CView:: OnCreate (lpCreateStruct) == -1) return -1; myInitOpenGL (); return 0;} void CTestView:: myInitOpenGL () {m_pDC = new CClientDC (this ); / / Create DC ASSERT (m_pDC! = NULL); if (! mySetupPixelFormat ()) / / set the bitmap graphics format, the function listed below return; m_hRC = wglCreateContext (m_pDC-> m_hDC); / / Create RC wglMakeCurrent (m_pDC-> m_hDC, m_hRC); / / RC associated with the current DC} / / CClient * m_pDC; HGLRC m_hRC; is CTestView member variable BOOL CTestView:: mySetupPixelFormat () {/ / we do regardless of format the specific content of what is familiar and then change the format of the future static PIXELFORMATDESCRIPTOR pfd = {sizeof (PIXELFORMATDESCRIPTOR), / / size of this pfd 1, / / version number PFD_DRAW_TO_WINDOW | / / support window PFD_SUPPORT_OPENGL | / / support OpenGL PFD_DOUBLEBUFFER, / / double buffered PFD_TYPE_RGBA, / / RGBA type 24, / / 24-bit color depth 0, 0, 0, 0, 0, 0, / / color bits ignored 0, / / no alpha buffer 0, / / shift bit ignored 0, / / no accumulation buffer 0, 0, 0, 0, / / accum bits ignored 32, / / 32-bit z-buffer 0, / / no stencil buffer 0, / / no auxiliary buffer PFD_MAIN_PLANE, / / main layer 0, / / reserved 0, 0, 0 / / layer masks ignored}; int pixelformat; if ((pixelformat = ChoosePixelFormat (m_pDC-> m_hDC, & pfd)) == 0) {MessageBox (return FALSE;} if (SetPixelFormat (m_pDC-> m_hDC, pixelformat, & pfd) == FALSE) {MessageBox (:: OnDestroy () {wglMakeCurrent (m_pDC-> m_hDC, NULL); / / release and m_hDC corresponding RC wglDeleteContext (m_hRC); / / delete the RC if (m_pDC) delete m_pDC; / / delete the current owners of the DC CView View :: OnDestroy ();} 4. processing OnEraseBkgnd () BOOL CTestView:: OnEraseBkgnd (CDC * pDC) {/ / TODO: Add your message handler code here and / or call default / / return CView:: OnEraseBkgnd (pDC); / / comment out the sentence, and if not, Window / / will use the white North View to refresh, resulting in screen flicker return TRUE; / / if null return can be. } 5. Processing OnDraw () void CTestView:: OnDraw (CDC * pDC) {wglMakeCurrent (m_pDC-> m_hDC, m_hRC); / / the RC associated with the current DC myDrawScene (); / / specific drawing function, RC draw SwapBuffers (m_pDC-> m_hDC); / / painted reached in the RC DC current, thus / / the screen wglMakeCurrent (m_pDC-> m_hDC, NULL); / / release the RC, so Other DC for drawing} void CTestView:: myDrawScene () {glClearColor (0.0f, 0.0f, 0.0f, 1.0f); / / set the background color to black glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix (); glTranslated (0.0f , 0.0f,-3.0f); / / the object along the (0,0, -1) direction of translation / / for projection visible. Because the default view in the (0,0,0), only remove the / / objects to be seen. / / This example is to demonstrate the plane Bezier curve, as long as a rotation / / transform, can more clearly see the 3D effect. / / Draw a Bezier curve below bezier_curve.myPolygon ();// draw Bezier curve control polygon bezier_curve.myDraw (); / / CBezierCurve bezier_curve / / is CTestView member variables / / specific function,
nike air force one low, see Appendix glPopMatrix (); glFlush (); / / end of the RC drawing return;} 6. processing OnSize () void CTestView:: OnSize (UINT nType, int cx, int cy) {CView:: OnSize (nType, cx, cy); VERIFY (wglMakeCurrent (m_pDC -> m_hDC, m_hRC ));// confirm the RC associated with the current DC w = cx; h = cy; VERIFY (wglMakeCurrent (NULL, NULL ));// DC confirmed the release of RC} 7 processing OnLButtonDown () void CTestView: : OnLButtonDown (UINT nFlags, CPoint point) {CView:: OnLButtonDown (nFlags, point); if (bezier_curve.m_N> MAX-1) {MessageBox (} / / The following is the coordinate transformation to prepare GetClientRect (& m_ClientRect); / / Get the viewport area the size of w = m_ClientRect.right-m_ClientRect.left; / / viewport width w h = m_ClientRect.bottom-m_ClientRect.top; / / viewport height h / / w, h is the CTestView member variables centerx = (m_ClientRect.left + m_ClientRect.right) / 2; / / center position, centery = (m_ClientRect.top + m_ClientRect.bottom) / 2; / / taken as the origin of / / centerx, centery is CTestView member variables GLdouble tmpx, tmpy; tmpx = scrx2glx (point.x); / / point coordinates on the screen into the OpenGL specification drawing coordinates tmpy = scry2gly (point.y); bezier_curve.m_Vertex [bezier_curve.m_N]. x = tmpx; / / add a vertex bezier_curve.m_Vertex [bezier_curve.m_N]. y = tmpy; bezier_curve.m_N ++;// number of vertices plus one InvalidateRect (NULL, TRUE); / / Flush redraw message} double CTestView:: scrx2glx (int scrx) {return (double) (scrx-centerx) / double (h);} double CTestView:: scry2gly (int scry) {} Appendix: 1.CBezierCurve statement : (BezierCurve.h) # include y;}; # define MAX 50 class CBezierCurve {public: myPOINT2D m_Vertex [MAX]; / / control points to an array of storage / / myPOINT2D is a two-dimensional point of deposit structure / / members Gldouble x, y int m_N; / / number of control points public: CBezierCurve (); virtual ~ CBezierCurve (); void bezier_generation (myPOINT2D P [MAX], int level); / / algorithm realization void myDraw ();// a curve function void myPolygon ( ); / / draw control polygon}; 2. CBezierCurve implementation: (BezierCurve.cpp) # include ; m_Vertex [0]. x =- 0.5f; m_Vertex [0]. y =- 0.5f; m_Vertex [1]. x =- 0.5f; m_Vertex [1]. y = 0.5f; m_Vertex [2]. x = 0.5f; m_Vertex [2]. y = 0.5f; m_Vertex [3]. x = 0.5f; m_Vertex [3]. y =- 0.5f;} CBezierCurve:: ~ CBezierCurve () {} void CBezierCurve:: myDraw () {bezier_generation (m_Vertex, LEVEL);} void CBezierCurve:: bezier_generation (myPOINT2D P [MAX], int level) {/ / specific description of the algorithm, please refer to the relevant books int i, j; level -; if (level = i; j -) {Q [j]. x = (Q [j-1]. x + Q [j]. x) / double (2); Q [j]. y = (Q [j-1]. y + Q [j]. y) / double (2);}} R [0]. x = Q [m_N-1]. x; R [0]. y = Q [m_N-1]. y; bezier_generation (Q, level); bezier_generation (R, level);} void CBezierCurve:: myPolygon () {glBegin (GL_LINE_STRIP); / / Draw the connection section glColor3f (0.2f, 0.4f , 0.4f); for (int i = 0; i 4
http://blog.163.com/xtdx888888 @ 126/blog/static/2955727520083661133565 /
5
http://www.khronos.cn/index.shtml
Open Category: computers, operating systems, computer I have to perfect