如果您无法下载资料,请参考说明:
1、部分资料下载需要金币,请确保您的账户上有足够的金币
2、已购买过的文档,再次下载不重复扣费
3、资料包下载后请先用软件解压,在使用对应软件打开
OpenGL:IntroductionYanciZhangGameProgrammingIIOutlineOverviewofOpenGLOpenGLvs.DirectXOpenGL“HelloWorld”GLUTlibraryRenderingpipelineCoordinatesystemGameProgrammingIIWhatisOpenGL?OpenGL=OpenGraphicsLibraryGraphicsrenderingAPIProducehigh-qualitycolorimagescomposedof3DgeometricobjectsandimagesHardwareindependentCrossplatformGameProgrammingIIBasicFunctionBasesformanyadvanceddatastructuresingameprogrammingTypicalapplicationsScenegraphStategraphDecisiontreeKd-tree,quadtree…GameProgrammingIIWhatCanOpenGLDo?Renderingbasicprimitives,likepoints,lines,triangles…MatrixoperationsLocalilluminationTexturemappingPixeloperations…GameProgrammingIIWhatCanNotOpenGLDo?CreatewindowsHandlewindoweventsResponsetouserinputScenemanagement…GameProgrammingIIOpenGLvs.DirectX1/2OpenGLisonlygraphicslibraryDirectXhandlesgraphics,audio,userinputUseOpenGLimproperly,systemdoesnothingUseDirectXimproperly,systemdoessomethingbeyondexpectationGameProgrammingIIOpenGLvs.DirectX2/2OpenGLIndustrystandardmaintainedbyOpenGLArchitecturalReviewBoard(ARB)StablefunctioninterfaceCrossplatformVeryclean,easytolearnDirectXMicrosoft’sproductInstablefunctioninterfaceOnlysupportWindowsGameProgrammingIIOpenGLFunctionsNamingWithprefixglCapitalletterforeachnewwordExamplesglBegin,glEndglEnable,glDisableglClearGameProgrammingIIDataType&ConstantBasicdatatypeWithprefixGLAllsmalllettersSimilartoC++datatypeExample:GLdouble=double,GLfloat=float,GLint=int,GLuint=unsignedintConstantWithprefixGL_AllcapitallettersExamples:GL_POINTS,GL_CCWGameProgrammingIIHelloWorld1/3#include<GL/gl.h>Allopenglprogramsshouldincludegl.h.#include<GL/glu.h>Almostallopenglprogramsincludeglu.hmain(){initWindow();Initializewindowwhichisaplatform-dependentoperationglClearColor(0.0,0.0,0.0,0.0);ClearwindowswithblackcolorglClear(GL_COLOR_BUFFER_BIT);glColor3f