日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

win 10 安装 glew 方法

發布時間:2024/9/19 综合教程 32 生活家
生活随笔 收集整理的這篇文章主要介紹了 win 10 安装 glew 方法 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

開發環境是 visual studio 2012

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

2 : glew.h 文件copy to C:Program Files (x86)Windows Kits8.0Includeumgl

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

4 : glew32.dll copy toC:Program Files (x86)Microsoft Visual Studio 11.0VCin

注意 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'
", glewGetErrorString(res));
      return 1;
    }

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

    CreateVertexBuffer();

    glutMainLoop();

    return 0;
}

總結

以上是生活随笔為你收集整理的win 10 安装 glew 方法的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。