win 10 安装 glew 方法

开发环境是 visual studio 2012

1 : 下载 glew 2.0 , 地址 http://glew.sourceforge.net/

2 : glew.h 文件copy to  C:\Program Files (x86)\Windows Kits\8.0\Include\um\gl

3 :  glew.lib  copy to  C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib

4 : glew32.dll copy to C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin

注意  lib 和 dll 都用32位的 , 因为 VS 在  C:\Program Files (x86)

测试程序, 这个能跑起来就说明安装正确

#include <stdio.h>
#include <GL/glew.h>
#include <GL/glut.h>
//#include "ogldev_math_3d.h"

#pragma comment(lib , "glut32.lib")
#pragma comment(lib , "glew32.lib")

struct Vector3f
{
    float x;
    float y;
    float z;

    Vector3f()
    {
    }

    Vector3f(float _x, float _y, float _z)
    {
        x = _x;
        y = _y;
        z = _z;
    }

    Vector3f(float f)
    {
        x = y = z = f;
    }

    Vector3f& operator+=(const Vector3f& r)
    {
        x += r.x;
        y += r.y;
        z += r.z;

        return *this;
    }

    Vector3f& operator-=(const Vector3f& r)
    {
        x -= r.x;
        y -= r.y;
        z -= r.z;

        return *this;
    }

    Vector3f& operator*=(float f)
    {
        x *= f;
        y *= f;
        z *= f;

        return *this;
    }

    operator const float*() const
    {
        return &(x);
    }

    Vector3f Cross(const Vector3f& v) const;

    Vector3f& Normalize();

    void Rotate(float Angle, const Vector3f& Axis);

    void Print() const
    {
        printf("(%.02f, %.02f, %.02f)", x, y, z);
    }
};

GLuint VBO;

static int i = 0;

static void RenderSceneCB()
{

        int j ;
        glClear(GL_COLOR_BUFFER_BIT);

        glEnableVertexAttribArray(0);
        //glBindBuffer(GL_ARRAY_BUFFER, VBO);
        glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);

        j = (i++) % 2 ;

        glDrawArrays(GL_POINTS, 0, 1);

        glDrawArrays(GL_POINTS, 0, 2);

        //glDrawArrays(GL_POINTS,j, 1);

        glDisableVertexAttribArray(0);

        glutSwapBuffers();

}

static void InitializeGlutCallbacks()
{
    glutDisplayFunc(RenderSceneCB);
    glutIdleFunc(RenderSceneCB);
}

static void CreateVertexBuffer()
{
    Vector3f Vertices[2];
    Vertices[0] = Vector3f(0.0f, 0.0f, 0.0f);

    Vertices[1] = Vector3f(0.2f, 0.2f, 0.0f);

    glPointSize(20.0);

     glGenBuffers(1, &VBO);
    glBindBuffer(GL_ARRAY_BUFFER, VBO);
    glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW);
}
int main(int argc, char** argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGBA);
    glutInitWindowSize(1024, 768);
    glutInitWindowPosition(100, 100);
    glutCreateWindow("Tutorial 02");

    InitializeGlutCallbacks();

    // Must be done after glut is initialized!
    GLenum res = glewInit();
    if (res != GLEW_OK) {
      fprintf(stderr, "Error: ‘%s‘\n", glewGetErrorString(res));
      return 1;
    }

    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

    CreateVertexBuffer();

    glutMainLoop();

    return 0;
}
时间: 2024-12-20 06:22:17

win 10 安装 glew 方法的相关文章

Windows 10安装pip方法

pip是一款非常方便的python包管理工具,本文主要介绍在windows 10下安装pip方法. 1. 下载pip 地址:https://pypi.python.org/pypi/pip#downloads 注意选择tar.gz压缩包,目前最新版本为9.0.1,这里选择的版本是:pip-9.0.1.tar.gz (md5, pgp) 2. 解压安装 解压下载的压缩包至工作目录下(如D:\),打开Windows cmd,运行如下命令进入解压后的pip目录 cd /d D:\pip-9.0.1 使

win 10安装应用程序提示Error 1317的解决方法

打开windows防火墙 关闭文件夹权限访问保护 原文地址:https://www.cnblogs.com/yao-zhang/p/10434639.html

Win 10安装mysql以及常见问题总结

一.mysql免安装版本配置1.从官网下载安装包,解压后,在电脑属性环境变量的path中配置bin的路径 2.配置my.ini [mysql] # 设置mysql客户端默认字符集 default-character-set=utf8 [mysqld] #设置3306端口 port = 3306 # 设置mysql的安装目录 basedir=D:\Program Files\mysql-5.6.26-winx64 # 设置mysql数据库的数据的存放目录 datadir=D:\Program Fi

win 10 安装.msi 程序出现the error code is 2503

解决方法: C:\Windows\temp文件夹的权限不够,需要给其更高权限 右键temp文件夹 点击属性进入属性对话框 组或用户名的里面的All APPLICATION PACKAGES和所有受限制的应用程序包的权限,都设置成完全控制,最后应用并确定即可

win 10 安装软件 报错发布者不受信任

1:打开任务管理器, [运行新任务] 2:(勾上以系统管理员权限创建此任务) 输入 cmd 3:进入要安装的软件所在的目录:cd D:\111_安装包\submit 3  (本文以安装submit 为例子) 4:输入命令:Sublime Text Build 3083 x64 Setup.exe   就会弹出安装界面

解决Win 10安装软件时提示:文件系统错误 (-1073740940)

1.win+R输入 gpedit.msc 2.左边计算机配置 windows设置——安全设置——本地策略——安全选项 3.在安全选项右边选择 用户账户控制:管理员批准模式中管理员的提升权限提示的行为,将选项改为不提示,直接提升

MySQL 5.6 for Windows 解压缩版配置安装(win 10 64位亲测)附安装包下载链接

转载自百度经验:http://jingyan.baidu.com/article/f3ad7d0ffc061a09c3345bf0.html MySQL是一个小巧玲珑但功能强大的数据库,目前十分流行.但是官网给出的安装包有两种格式,一个是msi格式,一个是zip格式的.很多人下了zip格式的解压发现没有setup.exe,面对一堆文件一头雾水,不知如何安装.下面笔者将介绍如何解决此情况下安装过程中的各种问题 工具/原料:win 10 64位操作系统 MYSQL zip格式安装包 方法/步骤: 1

Win 10 x64 版本安装华为 ENSP 模拟器

1.安装ensp模拟器主程序 去官网下载安装包,链接如下; http://support.huawei.com/enterprise/SoftwareVersionActionNew!showVDetailNew?idAbsPath=fixnode01|7919710|21782036|21782103|21782135|9017384&pid=9017384&vrc=9017411|9169984|21726015&from=soft 下载如下图所示软件; 安装过程这里就不叙述了

win 7 sp1 升级 win 10 更新时报错代码80070002的解决方法

win 7 sp1 升级 win 10 的过程中不免会遇到各种各样的错误,我所遇到的错误就是在更新下载出现报错代码为80070002.当时我就想知道这串数字代表着什么?它又是什么意思?肯定先要利用搜索引擎来看看windows update 80070002 错误到底是什么? 出现错误的图片为: 为了保护电脑的一些程序不被删除,建议选择微软官网来寻找它的解决方法,微软官网的东西可信度还是相当高的. 首先是进入微软官网的首页:http://www.microsoft.com/en-us/ 其次是在右