不学细节,只看概念
见字如面:
glutMainLoop
glutSetWindowTitle
glClear
glEnable
glDisable
glPointSize
glLineWidth
gltMakeTorus
GLTriangleBatch
甜甜圈的批次类
颜色
GLfloat vGreen[] = { 0.0f, 1.0f, 0.0f, 1.0f };
M3DMatrix44f:
typedef float M3DMatrix44f[16]
GLShaderManager
1 2
| GLint UseStockShader(GLT_STOCK_SHADER nShaderID, ...);
|
GLMatrixStack
矩阵堆栈,数据结构[单元矩阵/矩阵/矩阵相乘/压栈/出栈/缩放/平移/旋转]
1 2 3 4 5 6 7 8 9 10 11 12
| inline void LoadMatrix(const M3DMatrix44f mMatrix)
inline void MultMatrix(const M3DMatrix44f mMatrix)
inline void LoadIdentity(void)
void PushMatrix(GLFrame& frame) inline void PopMatrix(void)
|
GLBatch
传输顶点/光照/纹理/颜色数据到存储着色器中
1 2 3 4 5 6 7 8 9 10 11
| void Begin(GLenum primitive, GLuint nVerts, GLuint nTextureUnits = 0)
inline void CopyVertexData3f(GLfloat *vVerts)
void End(void)
virtual void Draw(void)
|
GLGeometryTransform
几何变换管道
1 2 3 4 5
| inline void SetMatrixStacks(GLMatrixStack& mModelView, GLMatrixStack& mProjection)
const M3DMatrix44f& GetModelViewProjectionMatrix(void)
|
GLFrame
矩阵变换工具类
1 2 3 4 5 6 7 8 9 10 11
| inline void MoveForward(float fDelta)
void RotateWorld(float fAngle, float x, float y, float z)
void GetMatrix(M3DMatrix44f matrix, bool bRotationOnly = false)
void GetCameraMatrix(M3DMatrix44f m, bool bRotationOnly = false)
|
GLFrustum
投影[空间|盒子]模型【正投影、透视投影】[3D->2D]
1 2 3 4 5 6 7 8
|
void SetPerspective(float fFov, float fAspect, float fNear, float fFar)
const M3DMatrix44f& GetProjectionMatrix(void) { return projMatrix; }
|
第二部分:实战画图
待续…