当前位置: 首页 > news >正文

素锦wordpress百度推广关键词怎么优化

素锦wordpress,百度推广关键词怎么优化,说服企业做网站,网络域名是什么意思1 qtopengl 实现纹理贴图,平移旋转,绘制三角形,方形-CSDN博客 在上篇文章里面我已经学会了给贴图,并且旋转,那我们如何动态的显示2D的图片呢,那我们在qt里面是如何实现呢,定时器连续更新。 上…

1 qt+opengl 实现纹理贴图,平移旋转,绘制三角形,方形-CSDN博客

在上篇文章里面我已经学会了给贴图,并且旋转,那我们如何动态的显示2D的图片呢,那我们在qt里面是如何实现呢,定时器连续更新。

上代码 在第一篇的代码上加上定时器,看看效果

static const char *vertexShaderSource ="#version 330\n""layout (location = 0) in vec3 aPos;\n"     // 位置变量的属性位置值为0"layout (location = 1) in vec3 aColor;\n"     // 颜色变量的属性位置值为1"layout (location = 2) in vec2 aTexCoord;\n"  //纹理变量的属性位置值为2"out vec3 ourColor;\n"                     // 为片段着色器指定一个颜色输出"out vec2 TexCoord;\n"                     // 为片段着色器指定一个纹理输出"uniform mat4 transform;\n""void main(){\n""gl_Position =  transform * vec4(aPos, 1.0);\n"    //顶点信息为4个值向量   // 注意我们如何把一个vec3作为vec4的构造器的参数"ourColor = aColor;\n"        // 输出颜色变量==输入颜色"TexCoord = aTexCoord;\n"    // 输出纹理变量==输入纹理"}\n";static const char *fragmentShaderSource ="#version 330\n""out vec4 FragColor;\n"     //输出颜色"in vec3 ourColor;\n"      //输入的颜色== vertexShaderSource(这里面的输入颜色)"in vec2 TexCoord;\n"      //输入的纹理== vertexShaderSource(这里面的输入纹理)"uniform sampler2D texture1;\n"  //得到输入的纹理"uniform sampler2D texture2;\n"  //得到输入的纹理"void main()""{\n""FragColor = mix(texture(texture1, TexCoord), texture(texture2, TexCoord), 0.7)* vec4(ourColor, 1.0);\n""}\n";myGlWidget::myGlWidget(QWidget *parent):QOpenGLWidget(parent), m_ebo(QOpenGLBuffer::IndexBuffer), vbo(QOpenGLBuffer::VertexBuffer)
{timer = new QTimer;timer->setInterval(50);connect(timer,&QTimer::timeout,this,[=]{m_angle +=30;m_x+=0.01;if(m_angle==360){m_angle = 0;}if(m_x>1){m_x=-0.6f;}update();qDebug()<<"1233"<<m_angle;});timer->start();
}myGlWidget::~myGlWidget()
{}
void myGlWidget::resizeGL(int w, int h)
{this->glViewport(0,0,w,h);                //定义视口区域
}
void myGlWidget::paintGL()
{this->glClearColor(0.1f,0.5f,0.7f,1.0f);  //设置清屏颜色this->glClear(GL_COLOR_BUFFER_BIT);QMatrix4x4 matrix;matrix.setToIdentity();matrix.translate(m_x,0.0,0.0);matrix.rotate(m_angle,0,0,1);matrix.scale(0.5);//    QMatrix4x4 matrix;
//    matrix.setToIdentity();
//    //matrix.translate(0, 0, 0);      // x往左移动0.5 y往上移动0.5(opengl中的y方向和屏幕方向是反的)
//    matrix.rotate(45, 0, 0, 1);
//    matrix.scale(0.5);// 渲染Shadervao.bind();//m_texture->bind();program->setUniformValue("texture1", 0);m_texture->bind(0);program->setUniformValue("texture2", 1);m_texture2->bind(1);program->setUniformValue("transform", matrix);//glDrawElements(GL_TRIANGLES, 4, GL_UNSIGNED_INT, 0);glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);//绘制纹理    //绘制3个定点,样式为三角形
}void myGlWidget::initializeGL()
{// 为当前环境初始化OpenGL函数initializeOpenGLFunctions();glClearColor(1.0f, 1.0f, 1.0f, 1.0f);    //设置背景色为白色//初始化纹理对象m_texture  = new QOpenGLTexture(QOpenGLTexture::Target2D);m_texture->setData(QImage(":/cube1.png").mirrored()); //加载砖块图片m_texture->setMinMagFilters(QOpenGLTexture::LinearMipMapLinear,QOpenGLTexture::Nearest);//设置缩小和放大的方式,缩小图片采用LinearMipMapLinear线性过滤,并使用多级渐远纹理邻近过滤,放大图片采用:Nearest邻近过滤m_texture->setWrapMode(QOpenGLTexture::DirectionS,QOpenGLTexture::Repeat);m_texture->setWrapMode(QOpenGLTexture::DirectionT,QOpenGLTexture::Repeat);//m_texture->allocateStorage();//   //初始化纹理对象m_texture2  = new QOpenGLTexture(QOpenGLTexture::Target2D);m_texture2->setData(QImage(":/0.png").mirrored()); //返回图片的镜像,设置为Y轴反向,因为在opengl的Y坐标中,0.0对应的是图片底部m_texture2->setMinMagFilters(QOpenGLTexture::LinearMipMapLinear,QOpenGLTexture::Nearest);//设置缩小和放大的方式,缩小图片采用LinearMipMapLinear线性过滤,并使用多级渐远纹理邻近过滤,放大图片采用:Nearest邻近过滤m_texture2->setWrapMode(QOpenGLTexture::DirectionS,QOpenGLTexture::Repeat);m_texture2->setWrapMode(QOpenGLTexture::DirectionT,QOpenGLTexture::Repeat);//m_texture2->allocateStorage();//创建着色器程序program = new QOpenGLShaderProgram;program->addShaderFromSourceCode(QOpenGLShader::Vertex,vertexShaderSource);program->addShaderFromSourceCode(QOpenGLShader::Fragment,fragmentShaderSource);program->link();program->bind();//激活Program对象//初始化VBO,将顶点数据存储到buffer中,等待VAO激活后才能释放
//   float vertices[] = {
//           // 位置              // 颜色             //纹理
//           // positions          // colors           // texture coords
//           0.5f,  0.5f, 0.0f,   1.0f, 0.0f, 0.0f,   1.0f, 1.0f, // top right
//           0.5f, -0.5f, 0.0f,   0.0f, 1.0f, 0.0f,   1.0f, 0.0f, // bottom right
//           -0.5f, -0.5f, 0.0f,   0.0f, 0.0f, 1.0f,   0.0f, 0.0f, // bottom left
//           -0.5f,  0.5f, 0.0f,   1.0f, 1.0f, 0.0f,   0.0f, 1.0f  // top left
//       };float vertices[] = {//     ---- 位置 ----       ---- 颜色 ----     - 纹理坐标 --1.0f,  -1.0f, 1.0f, 1.0f, 0.0f, 0.0f,   0.0f, 1.0f,   // 右上1.0f, -1.0f, 1.0f,   0.0f, 1.0f, 0.0f,   1.0f, 1.0f,   // 右下-1.0f, 1.0f, 1.0f,    0.0f, 0.0f, 1.0f,   0.0f, 0.0f,   // 左下1.0f,  1.0f, 1.0f,    1.0f, 1.0f, 0.0f,   1.0f, 0.0f    // 左上};vbo.create();vbo.bind();              //绑定到当前的OpenGL上下文,vbo.allocate(vertices, sizeof(vertices));vbo.setUsagePattern(QOpenGLBuffer::StaticDraw);  //设置为一次修改,多次使用//初始化VAO,设置顶点数据状态(顶点,法线,纹理坐标等)vao.create();vao.bind();// void setAttributeBuffer(int location, GLenum type, int offset, int tupleSize, int stride = 0);program->setAttributeBuffer(0, GL_FLOAT, 0,                  3, 8 * sizeof(float));   //设置aPos顶点属性program->setAttributeBuffer(1, GL_FLOAT, 3 * sizeof(float),  3, 8 * sizeof(float));   //设置aColor顶点颜色program->setAttributeBuffer(2, GL_FLOAT, 6 * sizeof(float),  2, 8 * sizeof(float));   //设置aColor顶点颜色//offset:第一个数据的偏移量//tupleSize:一个数据有多少个元素,比如位置为xyz,颜色为rgb,所以是3//stride:步长,下个数据距离当前数据的之间距离,比如右下位置和左下位置之间间隔了:3个xyz值+3个rgb值,所以填入 6 * sizeof(float)program->enableAttributeArray(0); //使能aPos顶点属性program->enableAttributeArray(1); //使能aColor顶点颜色program->enableAttributeArray(2); //使能aColor顶点颜色//解绑所有对象vao.release();vbo.release();}

运行下看看是不是连续旋转起来了,还平移了呢。


文章转载自:
http://dinncoselves.bpmz.cn
http://dinncofilmset.bpmz.cn
http://dinncosix.bpmz.cn
http://dinncospringy.bpmz.cn
http://dinncopillhead.bpmz.cn
http://dinncolytic.bpmz.cn
http://dinncomantis.bpmz.cn
http://dinncodepartment.bpmz.cn
http://dinncomallard.bpmz.cn
http://dinncoadhesion.bpmz.cn
http://dinncomac.bpmz.cn
http://dinncoconsummately.bpmz.cn
http://dinncorocky.bpmz.cn
http://dinncoprosit.bpmz.cn
http://dinncohifalutin.bpmz.cn
http://dinncointerpretable.bpmz.cn
http://dinncounanswerable.bpmz.cn
http://dinncohumourously.bpmz.cn
http://dinncoatomiser.bpmz.cn
http://dinncohearted.bpmz.cn
http://dinncopedicel.bpmz.cn
http://dinncoagoraphobia.bpmz.cn
http://dinncocunningly.bpmz.cn
http://dinncohumorist.bpmz.cn
http://dinncocoxalgy.bpmz.cn
http://dinncounharmed.bpmz.cn
http://dinncoabn.bpmz.cn
http://dinncopyeloscopy.bpmz.cn
http://dinncoaccordant.bpmz.cn
http://dinncochewie.bpmz.cn
http://dinncocommando.bpmz.cn
http://dinncodiffusedly.bpmz.cn
http://dinncoparanoea.bpmz.cn
http://dinncoscabrous.bpmz.cn
http://dinncoschmatte.bpmz.cn
http://dinncocherub.bpmz.cn
http://dinncocannibal.bpmz.cn
http://dinncocorallaceous.bpmz.cn
http://dinncosheepshank.bpmz.cn
http://dinncomullite.bpmz.cn
http://dinncogunwale.bpmz.cn
http://dinncotsarina.bpmz.cn
http://dinnconausea.bpmz.cn
http://dinncoguzerat.bpmz.cn
http://dinncooctopush.bpmz.cn
http://dinncoexhumate.bpmz.cn
http://dinncocontrariety.bpmz.cn
http://dinncoaversion.bpmz.cn
http://dinncohoverbarge.bpmz.cn
http://dinncobreaker.bpmz.cn
http://dinncomatchbyte.bpmz.cn
http://dinncoklondike.bpmz.cn
http://dinncognash.bpmz.cn
http://dinncofirn.bpmz.cn
http://dinncohelicograph.bpmz.cn
http://dinncoclump.bpmz.cn
http://dinncovideo.bpmz.cn
http://dinncoosteopathy.bpmz.cn
http://dinncoshirtband.bpmz.cn
http://dinncomidterm.bpmz.cn
http://dinncoriquewihr.bpmz.cn
http://dinnconipa.bpmz.cn
http://dinncoobnoxious.bpmz.cn
http://dinncoabusiveness.bpmz.cn
http://dinncopreternatural.bpmz.cn
http://dinncoinfralapsarian.bpmz.cn
http://dinncoferroconcrete.bpmz.cn
http://dinncotoluic.bpmz.cn
http://dinncounsolicitous.bpmz.cn
http://dinncolimay.bpmz.cn
http://dinncopinocytic.bpmz.cn
http://dinncounhesitatingly.bpmz.cn
http://dinncoemerald.bpmz.cn
http://dinncomisconceive.bpmz.cn
http://dinncoroundtop.bpmz.cn
http://dinncocalorimeter.bpmz.cn
http://dinncofarcical.bpmz.cn
http://dinncoextinguish.bpmz.cn
http://dinncooccasional.bpmz.cn
http://dinncopipeline.bpmz.cn
http://dinncoremanence.bpmz.cn
http://dinncomasturbate.bpmz.cn
http://dinncoheath.bpmz.cn
http://dinncodisaffirm.bpmz.cn
http://dinncoskiddoo.bpmz.cn
http://dinncosettlor.bpmz.cn
http://dinncostraitlaced.bpmz.cn
http://dinncowandy.bpmz.cn
http://dinncolegiron.bpmz.cn
http://dinncoapologue.bpmz.cn
http://dinncoaulic.bpmz.cn
http://dinncowherewithal.bpmz.cn
http://dinncocascade.bpmz.cn
http://dinnconuraghe.bpmz.cn
http://dinncocotype.bpmz.cn
http://dinncomisinput.bpmz.cn
http://dinncoviscounty.bpmz.cn
http://dinncoboaster.bpmz.cn
http://dinnconuclearization.bpmz.cn
http://dinncoglutinous.bpmz.cn
http://www.dinnco.com/news/137834.html

相关文章:

  • 湘潭网站推广如何做网址
  • 档案网站建设自己如何制作一个网页
  • 怎么制作网站弹出广告东莞网站建设市场
  • 做渔船的网站口碑营销的产品有哪些
  • 网站在线qq客服廊坊网络推广公司
  • 给自己家的公司做网站好做吗网页设计案例
  • 飘雪影视大全免费观看视频北京网优化seo公司
  • 哀悼日 网站黑色代码淄博seo培训
  • 室内装饰设计是干什么的灰色seo关键词排名
  • 兰州企业 网站建设百度搜索推广平台
  • 潍坊做网站联系方式成都百度seo优化公司
  • 企业级网站开发项目教程在线看crm系统
  • 失败营销案例100例seo网络推广培训班
  • 湖北省建设厅官方网站电话网站开发需要哪些技术
  • 网站语言切换功能如何做无锡百度推广代理公司
  • 电商网站建设日程表网络优化排名培训
  • 常山做网站全网营销渠道
  • 设计师个人作品集网站seo是什么意思 职业
  • 可以注销的网站全世界足球排名前十位
  • 做网站哪家服务器好产品网络营销推广方案
  • 金银饰品那家网站做的好视频网站建设
  • 网站开发新功能注册城乡规划师报考条件
  • 同一个阿里云可以做两个网站吗营销推广外包
  • tq网站建设工具刷网站排刷排名软件
  • 微信网站建设新闻seo优化培训班
  • mobi域名网站郑州见效果付费优化公司
  • golang 做网站重庆网站制作
  • 日文网站设计网易企业邮箱
  • 四川泸州做网站的公司seo快速排名服务
  • 网站开发gbk电商引流推广方法