資源簡介
上學的assignment,新手適用,基本的畫畫~
代碼片段和文件信息
//
//?Standard?C++?headers?used?by?this?program
//
#include???//?console?I/O
#include????//?file?I/O
#include????//?string?streams
//
//?Headers?needed?by?OpenGL.?The?glew?header?must?come?first.
//
#include?
#include?
#define?VA_POSITION?????0
#define?VA_COLOR????????1
#define?BUFFER_OFFSET(i)?((void*)(i))
#define?GETRAND ((float)rand()/(float)RAND_MAX)
unsigned?frameCount?=?0;
float?g_vertexData[]?=?{
??????????-0.4f?-0.4f??0.0f?0.0f?0.0f
???????????0.4f?-0.4f??0.0f?0.0f?0.0f
???????????0.0f??0.1f??0.0f?1.0f?0.0f
???????????-0.3f?0.0f??0.0f?0.0f?0.0f
???????????0.3f??0.0f??0.0f?0.0f?0.0f
???????????0.0f??0.4f??0.0f?1.0f?0.0f
???????????-0.2f?0.3f??0.0f?0.0f?0.0f
???????????0.2f??0.3f??0.0f?0.0f?0.0f
???????????0.0f??0.65f??0.0f?1.0f?0.0f
???????????-0.05f?-0.4f??0.5f?0.25f?0.0f
???????????0.05f?-0.4f???0.5f?0.25f?0.0f
???????????-0.05f?-0.7f??0.0f?0.0f?0.0f
???????????0.05f?-0.7f??0.0f?0.0f?0.0f
??????????-1.0f?-0.7f??1.0f?1.0f?1.0f
???????????1.0f?-0.7f??1.0f?1.0f?1.0f
??????????-1.0f?-1.0f??0.5f?0.25f?0.0f
???????????1.0f?-1.0f??0.5f?0.25f?0.0f
????};
float?l_vertexData[]?=?{
??????????0.3f??0.55f??1.0f?0.65f?0.0f
??????????0.5f??0.7f???1.0f?1.0f?0.0f
??????????0.25f??0.7f??0.0f?1.0f?0.0f
??????????0.45f??0.55f??1.0f?0.0f?1.0f
??????????0.375f??0.775f?1.0f?0.0f?0.0f
};
unsigned?short?l_indexData[]?=?{
????????0?1
????????1?2
????????2?3
????????3?4
????????4?0
};
float?p_vertexData[]?=?{
????????
????????-0.4f?-0.4f??1.0f?0.65f?0.0f
???????????0.4f?-0.4f??1.0f?1.0f?0.0f
???????????0.0f?-0.4f???1.0f?0.75f?0.8f
????????????-0.3f?0.0f??0.0f?1.0f?1.0f
???????????0.3f??0.0f??1.0f?0.0f?1.0f
???????????0.0f?0.0f??1.0f?1.0f?0.0f
???????
????????????-0.2f?0.3f??1.0f?1.0f?1.0f
???????????0.2f??0.3f??0.2f?0.8f?0.2f
???????????0.0f??0.65f??1.0f?0.0f?0.0f
???????????0.0f?0.3f??0.0f?1.0f?0.0f
};
//
//?Function?prototypes.?These?tell?the?compiler?that?these?function?exist?somewhere?in?the?code.
//
//?the?function?that?initializes?everything
bool?Initialize(int?argc?char*?argv[]);
//?helper?functions?that?initialize?specific?components
bool?InitWindow(int?argc?char*?argv[]);
bool?InitExtensions();
bool?InitGeometry();
bool?InitShaders();
bool?InitScene();
//?callback?functions?that?freeglut?will?call?once?it?enters?the?main?loop
void?Resize(int?w?int?h);
void?Render();
void?Cleanup();
void?TimerFunction1(int?Value);
void?KeyPressed(unsigned?char?key?int?x?int?y);
//?functions?for?cleaning?up?specific?components
void?DeleteGeometry();
void?DeleteShaders();
//?function?that?reads?a?text?file?and?returns?it?as?a?string
std::string??ReadTextFile(std::string?path);
//?function?that?loads?a?shader?from?a?
- 上一篇:DSP28335的PMSM的SVPWM電機代碼
- 下一篇:Stm32 CAN通訊
評論
共有 條評論