Step 1.
到 OpenGL 官網下載 GLUT:https://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip
Step 2.
◇ glut.h 放到C:\Program Files (x86)\Microsoft Visual Studio\2017
\Community\VC\Tools\MSVC\14.15.26726\include
◇ glut.lib, glut32.lib 放到
C:\Program Files (x86)\Microsoft Visual Studio\2017
\Community\VC\Tools\MSVC\14.15.26726\lib\x64
◇ glut.dll, glut32.dll 放到
C:\Windows\System32
Step 3.
安裝Nuget套件:nupengl
Step 4.
範例程式:#include <GL/glut.h>
void display(void) {
glClear(GL_COLOR_BUFFER_BIT);
glRectf(-0.5f, -0.5f, 0.5f, 0.5f);
glFlush();
}
int main(int argc, char *argv[]) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA | GLUT_SINGLE);
glutInitWindowSize(300, 300);
glutCreateWindow("Hello OpenGL");
glutDisplayFunc(&display);
glutMainLoop();
return 0;
}
沒有留言:
張貼留言