Σχόλια 0

Το κείμενο του εγγράφου

Question 2

Write a critical appraisal of OpenGL or, at least, those parts of OpenGL thatwe have covered in the course.Identify the strengths and weaknesses of OpenGL as you see them. You can giveexamples of source code (or even complete programs) that demonstrate good or badfeatures of OpenGL if you like. If you know another graphics API, such as Glide orDirect3D, you may make comparisons between them and OpenGL.

Since we have evolved to a technological age where hardware performance isnot quite an issue as it was before, an emphasis has been put to provide high endoutput and graphics to the user. Thus, cards manufacturers and graphics developershave started working hand in hand to give out a good graphics standard for everyoneto use. All began in the 1980s where Silicon Graphics used to manufacture verypowerful graphics machines along with drivers to support them. These machines areno more considered powerful since what used to be high end then is now worse thanconsumer products. In 1992, OpenGL was created from the IRIS GL API for UNIX.OpenGL was a library to set open standards. It was written in C code to allow both Cand C++ implementations. Later, Microsoft adopted OpenGL 1.2 and included it inwindows. What are the goods and bad that OpenGL includes, and in what ways is itdifferent from currently available graphics API’s like D3D and GLIDE? Most of thesewill be discussed in this short paper.

OpenGL was engineered to satisfy graphics needs for the future. This meansthat most of the conceptions put in it back when it was written weren’t available ongraphics hardware to make use of it. As hardware improved, OpenGL didn’t changedramatically to fit the needs of the new technologies. For example, consider T&Larchitecture, which is currently embedded in most graphics GPUs, wasn’t there 3years ago. However, OpenGL had the functions and methods to emulate translationand lighting effects even without the hardware. This is called software rendering.OpenGL hides the hardware layer making it easy to program for all kinds of hardwareand making sure that the same effect will show on all. This is defined byconformance. Moreover, considering different operating systems, OpenGL would dojust fine on any of them (Portability) since it is open source. OpenGl has anarchitecture review board (ARB) which decides on the open standards. Althoughmany big companies are involved in the ARB, they tend to set standards not to takeadvantage of them personally. One bad thing is that whoever holds a license toupdate OpenGL can publish it and then there may be many versions out there; evenversions which are made to specific hardware cards. This makes it a bit non-standard. OpenGL has evolved through the years, since 1992, and now the mostcurrent usable version is OpenGL 1.4. OpenGL 1.5 specifications have come out butthere are still corrections being made to it and in the near future, OpenGL 2.0 isbeing developed by 3DLabs. OpenGL 2.0 is thought to be another version that shouldset the standards for many years to come. As far as it is known, OpenGL 2.0 is aShading language.

On the other hand, DirectX’s D3D is considered as the competitor to OpenGL.D3D is developed and applied by Microsoft. Microsoft only has the privilege to updateand release D3D versions. Moreover, what is being done is that there is a newversion of D3D in at most every new year. This makes DirectX up-to-date withcurrent technology, but at the cost of programmers needing to know the languageupdates as soon as they come out in order to use the newly available features intheir software. Microsoft has been working with card manufacturers side by side tokeep up with the coming technologies and include them in their new versions ofDirectX. All the above concepts smash Microsoft DirectX’s D3D in favor of OpenGL.We can say that OpenGL makes very large steps once in a while, while DirectXchanges very frequently and what programmers do not want is to keep on learningthe new language rather than spending time on creating new ideas for their gamesand applications. This has also some good points if ever OpenGL is not up-to-dateand needs a new set of standards to make up with time, which is the case nowadaysand this is why 3DLabs is working on OpenGL 2.0. For more info about this mattercheck the following website:http://www.3dlabs.com/support/developer/ogl2/index.htm.

Since most games are made on Windows OS platforms, then the use ofDirectX is a common practice in the game industry. Moreover, DirectX works only inC++ because of its class and COM objects based architecture. This is different fromOpenGL where everything is done in C (could be used in C++) and everything isprocedural by calling some functions to do the job after passing it the neededattributes. In DirectX, working with COM technology has its goods and bads which isnot in the topic of this paper. But one thing is that everybody likes programming inOpenGL because of its minimal use of code to do something. D3D started with 800lines of code for initialization only with D3D version 5, Microsoft somehow correctedthe mistake and code initialization was dropped down to 200 with D3D 7. Howevercompared to OpenGL, this is way too much. One page of OpenGL code can make uup and running with no errors because of conformance on all hardware cards. D3Dhas to divide the classes of cards into cases and deal with each case separately. Inthe following example, OpenGl code is shown to create a triangle from 3 vertices.Same thing in D3D with is significantly a lot more code. D3D uses something calledexecute buffers. D3D programmers have to initialize everything and store the dataand commands in arrays and then they pass the whole thing in a single call. Thismay seem easy and short, but it creates a lot of code and everything has to bedefined before it is processed.OpenGL D3DglBegin (GL_TRIANGLES);glVertex (0,0,0);glVertex (1,1,0);glVertex (2,0,0);glEnd ();(psuedo code, and incomplete)v = &buffer.vertexes[0];v->x = 0; v->y = 0; v->z = 0;v++;v->x = 1; v->y = 1; v->z = 0;v++;v->x = 2; v->y = 0; v->z = 0;c = &buffer.commands;c->operation = DRAW_TRIANGLE;c->vertexes[0] = 0;c->vertexes[1] = 1;c->vertexes[2] = 2;IssueExecuteBuffer (buffer);

Concerning which API is better and more performing, one can’t really say.Both of them are top leading in the market and both work perfectly the same on aWindows OS machine and they cover the most important functionalities available invideo cards today. However, as told before, OpenGL contains some features like theT-buffer (allows to calculate which texture to display first in terms of depth) whichwill be available very soon or are now in the newest and very expensive cards. AndD3D has some features unavailable in OpenGL like specular blend at each vertex,color key transparency, and no clipping hints. The most important concepts likevertex arrays in OpenGL and vertex pools in D3D are basically equivalent. However,still not very used features like transparency and translucency are not near to get inD3D which makes OpenGl still ahead for some time now. DirectX doesn’t run on non-Windows platform so basically to make sure your code works anywhere anytime, it’sbetter to go with OpenGL. OpenGL, as said before, hides the hardware layer andprovides a high level, clear, straightforward language which lets you express whatyou want to do. You don’t have to know what hardware your program will be runningon since conformance tests have been run on these cards by the manufacturers. It isa guarantee that whatever you develop will work on any compatible OpenGL cardand, moreover, will look the same on all. In D3D, once a program is done, it has tobe tested on all the available cards on the market and some adjustments (actually alot as described by one article) have to be made to the code so that it is up andworking without problems. D3D is a layer between the hardware and the programtending more to be on the hardware programming side. D3D programmers have toconsider different cases for different hardware and their features. Most programmerstend to develop with D3D because of Microsoft’s market dominance. Anyways,everybody can choose his or her preference. It’s a free world.

Both API are powerful and stable and there is no doubt that both of them arerequired to develop a good game on Windows PC, but only OpenGL would be usedfor anything else because of its high standards and precision. Some applications thatuse one and not the other are shown in the table below. And, it is known (asdescribed by SGI itself) that all CAD, digital engineering and Military visualizationsuse OpenGL because of its reliability and platform independent structure.Direct3D OpenGLSimply 3DUnreal TournamentEarth 2150Warcraft IIIMicrosoft Flight SimulatorBattle Isle 4ArchiCADAutodesk (AutoCAD 2000)Quake (GL-Quake, Quake II & III)Microstation 95MathGL3D (Mathematica)Maya (Character animation, Modeling)It is clear that OpenGL is used for more applications than games although it woulddo just fine with games. The fact is that DirectX contains a big set of tools tomanipulate sound, input and network along with D3D. Games need a combination ofall of these together to be interesting. Most of game programmers use Direct3Dsince they will eventually use the other features that come with it like DirectSound,DirectInput and DirectPlay. Applications like CAD tend to be purely graphical andOpenGl is highly accurate and easier to program with than D3D. There are plenty oftopics and opinions on which is better and they go into the very details of thelanguages. These can be found at the references section of this paper. One aspect isthat by combining D3D and OpenGL, it would be better for all and there would beone and only one language to deal with. D3D retained mode is capable of sitting ontop of OpenGL since it is a higher level language, unlike D3D Immediate mode whichfrom it comes all the problems and cases. New kits are coming up for OpenGL andthey are being developed by the graphics leading company SGI. These packages aredescribed in the following table. Like DirectSound, OpenAL is an audio library to bepart of the Open family. However, we do not hear about it a lot. I guess because nobody is really working on it seriously. OpenML is a library intended to contain allOpen family components like DirectX contains Direct3D, DirectSound, etc… Thebottom point is that it does not matter which API you program with. Both APIs aregood and if you learn one, it would be easy to learn the other since the core conceptsare the same.

As for GLIDE, they say it was a really good and straightforward library likeOpenGL. But it only works on 3DFX chipsets that support it! Programmers tend todevelop something for the whole Market rather than specific cards although 3DFX aregood ones. But the market contains a lot of different cards and types soprogramming in GLIDE is not common. 3DFX chipsets are included in Creative Labs,TNT, and Voodoo Hardware which are not the best sellers today compared to NVidia,ATI, etc… There are rumors that 3DFX is fusing GLIDE into OpenGL to create a betterlibrary. NVidia has developed its own graphics library called Cg which is C-like andhandles a lot of complex programming in easy straightforward functions. It is similarto OpenGL structure. Cg is most commonly being referred to as a shading language.

OpenGLVolumizer: usedfor treatingvolumetric thesame way as youdo for surfacedata.