freeglut

freeglut安装与使用

https://blog.csdn.net/smilife_/article/details/89010423

#include <windows.h>
#include <stdio.h>
#include <GL/freeglut.h>

int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH);
    glutInitWindowSize(300, 300);
    glutInitWindowPosition(100, 100);
    glutCreateWindow("OpenGL Version");
    const GLubyte* name = glGetString(GL_VENDOR);
    const GLubyte* biaoshifu = glGetString(GL_RENDERER);
    const GLubyte* OpenGLVersion = glGetString(GL_VERSION);
    const GLubyte* gluVersion = gluGetString(GLU_VERSION);
    printf("OpenGL实现厂商的名字:%s\n", name);
    printf("渲染器标识符:%s\n", biaoshifu);
    printf("OOpenGL实现的版本号:%s\n", OpenGLVersion);
    printf("OGLU工具库版本:%s\n", gluVersion);

    system("pause");

    return 0;
}
 

freeglut编译及使用

https://blog.csdn.net/kupepoem/article/details/108295563?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.channel_param

#include <windows.h>
#include <GL/freeglut.h>  
void myDisplay(void)
{
    glClear(GL_COLOR_BUFFER_BIT);
    glColor3f(1.0, 0, 0);
    static float sc = 1.0;
    glRectf(-0.5f*sc, -0.5f*sc, 0.5f*sc, 0.5f*sc);
    sc = sc *1.01;
    glFlush();
}
 
void timerProc(int id)
{
    myDisplay();
    glutTimerFunc(33, timerProc, 1);//需要在函数中再调用一次,才能保证循环
}
 int main(int argc, char *argv[])
 
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
    glutInitWindowPosition(100, 100);
    glutInitWindowSize(400, 400);
    glutCreateWindow("第一个OpenGL程序");
    glutDisplayFunc(&myDisplay);
    glutTimerFunc(33, timerProc, 1);
    glutMainLoop();
    return 0;
}

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值