zoukankan      html  css  js  c++  java
  • win7 64 &vs2010 与 opengl配置

    http://blog.csdn.net/lixam/article/details/7618015

    http://blog.sina.com.cn/s/blog_7745fc8601017m36.html

    _________________________________________________________________

    我的配置:

    1. 把解压得到的glut.h放到"C:Program Files (x86)Microsoft SDKsWindowsv7.0AIncludegl"
          2. 把解压得到的glut.lib和glut32.lib放到"D:ToolsMicrosoft Visual Studio 10.0VClib" (安装目录)
          3. 把解压得到的glut.dll放到"C:WindowsSysWOW64"(win7 64位)
          4. 把glut32.dll放到“D:ToolsMicrosoft Visual Studio 10.0VCin”下(注意这个,网上有人说放到system32里,但是我试过,会报错)(安装目录)
          5. 打开vs2010,随便打开或新建一个项目。 选择 project->project property-> Configuration Properties->Linker->Input->Additional Dependencies 在其中添加opengl32.lib glu32.lib glut32.lib

    测试代码

    #include <Windows.h>  
    #include <gl/GL.h>  
    #include <gl/GLU.h>
    #include <gl/glut.h>
    void init()  
    {  
    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);  
    glShadeModel(GL_SMOOTH);  
    }  
    void draw_triangle()  
    {  
    glBegin(GL_POLYGON);  
    glVertex3f(0.25f, 0.25f, 0.0f);  
    glVertex3f(0.75f, 0.25f, 0.0f);  
    glVertex3f(0.75f, 0.75f, 0.0f);  
    glVertex3f(0.25f, 0.75f, 0.0f);  
    glEnd();  
    }  
    void display()  
    {  
    glClear(GL_COLOR_BUFFER_BIT);  
    draw_triangle();  
    glFlush();  
    }  
    void reshape(int w, int h)  
    {  
    glViewport(0, 0, (GLsizei) w, (GLsizei) h);  
    }  
    int main(int argc, char **argv)  
    {  
    glutInit(&argc, argv);  
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);  
    glutInitWindowPosition(600, 400);  
    glutInitWindowSize(800, 600);  
    glutCreateWindow("OpenGL Hello World");  
    init();  
    glColor3f(1.0f, 1.0f, 1.0f);  
    glOrtho(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f);  
    glutDisplayFunc(display);  
    glutReshapeFunc(reshape);  
    glutMainLoop();  
    return 0;  
    }  
    

      

  • 相关阅读:
    TD
    TD
    required
    Cookie
    cookie 与 session区别
    折线图
    <a>标签
    十六进制颜色表
    js获取当前页面的url网址信息
    stopPropagation() 方法
  • 原文地址:https://www.cnblogs.com/aminxu/p/4272978.html
Copyright © 2011-2022 走看看