你好,游客 登录 注册 搜索
阅读内容

OpenGL的C++封装库 OGLplus

运行环境:
授权方式:BSD
软件大小:M
下载量:
更新日期:2013-08-15
来源地址:
联系作者:Linux

OGLplus (oglplus) 是一个仅包含头文件的 C++ 语言库,用于实现一个瘦面向对象的 OpenGL 门面操作接口,提供了自动资源和对象管理的封装,让在 C++ 中使用 OpenGL 更加简单和安全。

OGLplus

示例代码:

#include <oalplus/al.hpp>
#include <oalplus/all.hpp>
#include <oalplus/alut.hpp>

#include <chrono>
#include <thread>

int main(int argc, char** argv)
{
    // open the default device
    oalplus::Device device;
    // create a context using the device and make it current
    oalplus::CurrentContext context(device);
    // create an instance of ALUT
    oalplus::ALUtilityToolkit alut(false, argc, argv);
    // create a listener and set its position, velocity and orientation
    oalplus::Listener listener;
    listener.Position(0.0f, 0.0f, 0.0f);
    listener.Velocity(0.0f, 0.0f, 0.0f);
    listener.Orientation(0.0f, 0.0f,-1.0f, 0.0f, 1.0f, 0.0f);
    // create a Hello World sound and store it into a buffer
    oalplus::Buffer buffer = alut.CreateBufferHelloWorld();
    // create a source from the data in buffer and set its position
    oalplus::Source source;
    source.Buffer(buffer);
    source.Position(0.0f, 0.0f,-1.0f);
    // let the source play the sound
    source.Play();
    // wait for a while
    std::chrono::seconds duration(2);
    std::this_thread::sleep_for(duration);
    //
    return 0;
}

推荐阅读:

OpenGL三维球体数据生成与绘制【附源码】 http://www.linuxidc.com/Linux/2013-04/83235.htm

linux
相关资讯       OGLplus 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款