GL: Graphic Library
Visual Studio设置openGL:https://content.byui.edu/file/2315e65e-a34a-48d3-814d-4175a2b74ed5/1/intro/165-opengl-visualStudio2017.html#:~:text=Configure%20Visual%20Studio%20for%20OpenGL&text=With%20your%20project%20open%20in,type%3A%20Install%2DPackage%20nupengl.
**
Properties for Open GL:
- OpenGL is independent of windows system
- OpenGL does not work by itself
- GULT(OpenGL Utility Toolkit) -provides basic functions to operate windows
- header file: #include
glColor4f: 4->(r,g,b,alpha); f->float note: -> glVertex2fv(a) a stands for an array
g]lBegin -> set to be polygon w->waitng
glBertex2f -> set vertexs
note: RGB (0,0,0)=black
(link in lecture notes)
example:
DOUBLE->buffering
glutInit(&argc,argv) ->pass commend line options
glutInitWindowSize -> set window size
glutCreateWindow -> cause the window to appear, (“”) -> title for the window
init() -> function defined by coder
glutMainLoop -> blocking until the window is closed
keep going thru the evensts, whenever a event is present, corresponding call back function will activate
CallBackFunctions:
Inbuild functions?
eg. sphere:
apply:
Glint slice: larger number as smoother sphere (longitudinal lines)
Glint stacks: horizontal lines
Viewing
Default Camera Location:
gluLookAt:
order of translating and rotating is important
glLoadMatrix(), glMultMatrix()
glLoadMatrix - replaces current matrix with the one whose elements are specified by m.
glMultMatrix - multiplies the current matrix with the one specified using m, and replaces the current matrix with the product
note: current matirx is the projection matrix, modelview matrix, or texture matrix depending on the current matrix mode
Translate:
eg.
Rotate:
eg.
Scale
eg.