QT带行编码输出cout

止 - 

 。

#include <QDebug>
#define cout qDebug() << "["<< __FILE__ << ":"<< __LINE__ << "]"

    QMatrix4x4 matrix = {1,2,3,4,
                        1,2,3,4,
                        1,2,3,4,
                        1,2,3,4};
    matrix(1,1) = 7;
    cout<<matrix.row(0);
    cout<<matrix.row(1);
    cout<<matrix.row(2);
    cout<<matrix.row(3);

#include<GL/gl.h>     


//const GLubyte * name = glGetString(GL_VENDOR);
const GLubyte * biaoshifu = glGetString(GL_RENDERER);
const GLubyte * OpenGLVersion = glGetString(GL_VERSION);
// const GLubyte * gluVersion = glGetString(GL_EXTENSIONS);
//cout<<QStringLiteral("OpenGL实现厂商的名字")<<QString((char*)name);
cout<<QStringLiteral("渲染器标识符:")<<QString((char*)biaoshifu);
cout<<QStringLiteral("OpenGL实现的版本号:")<<QString((char*)OpenGLVersion);
//cout<<QStringLiteral("GLU工具库版本:")<<QString((char*)gluVersion);

 QVector<float>::iterator iter;
    for (iter=vertices.begin();iter!=vertices.end();iter++)
    {
        float a,b,c;
        a=*iter;
        iter++;
        b=*iter;
        iter++;
        c=*iter;
        cout<<a<<"  "<<b<<"  "<<c;

    }

VAO[0].create();// 创建一个VAO对象,OpenGL会给它(顶点数组缓存对象)分配一个id
VAO[0].bind();//将RC中的当前顶点数组缓存对象Id设置为VAO的id
vertices = loadAscllStl("E://max.STL",1);
VBO.create();
VBO.bind();
VBO.allocate(vertices.data(),sizeof(float)*vertices.size());//将顶点数据分配到VBO中,第一个参数为数据指针,第二个参数为数据的字节长度
int n = vertices.capacity()/sizeof(float);
QOpenGLVertexArrayObject::Binder bind(&VAO[0]);//绑定
this->glDrawArrays(GL_TRIANGLES,0,n);


vertices2 = loadAscllStl("E://min.STL",1);
VAO[1].create();// 创建一个VAO对象,OpenGL会给它(顶点数组缓存对象)分配一个id
VAO[1].bind();//将RC中的当前顶点数组缓存对象Id设置为VAO的id
VBO2.create();
VBO2.bind();
VBO2.allocate(vertices2.data(),sizeof(float)*vertices2.size());//将顶点数据分配到VBO中,第一个参数为数据指针,第二个参数为数据的字节长度
int n2 = vertices2.capacity()/sizeof(float);
//QOpenGLVertexArrayObject::Binder bind(&VAO[1]);
this->glDrawArrays(GL_TRIANGLES,0,n2);

。 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值