Giter VIP home page Giter VIP logo

qtopengl's Introduction

Qt5 OpenGL

Qt5写的一些OpenGL小例子集合 是在学习LearnOpenGL教程的过程中,使用Qt制作的

  • lesson01

    以QOpenGLWidget为框架,简单的纹理贴图,使用定时器控制纹理旋转。 lesson01

  • lesson02

    立方体贴图的例子,自己用画板画了一个图,然后贴成一个Cube。可以用鼠标控制立方体旋转。 lesson02

  • HelloTriangle

    绘制了10个立方体,每个立方体的每个表面使用2张纹理混合贴图。混合比例按数字键1/2进行调节。 HelloTriangle

  • QuickOpenGL

    这个是在不了解QML Quick内部原理的时候,在qml中添加自定义OpenGL渲染控件,用的是QQuickWindow的beforeRendering信号。后来知道了QQuickFramebufferObject之后,基本上这种方式就被抛弃了。这里保留项目仅作为观赏,建议参考下面FrameBufferObject。 QuickOpenGL

  • FrameBufferObject

    效果与上一个例子QuickOpenGL 类似,多了全屏放大功能,纹理沿着三个坐标轴旋转的功能。

    使用QQuickFramebufferObject 作为OpenGL自绘制控件,相当于QQuickItem了。

    QQuickFramebufferObject是 Qt封装好的,需要理解其使用架构。

    这里大概说一下用法:

    1. 继承QQuickFramebufferObject实现一个自定义item,并注册到QML中使用
    2. 继承QQuickFramebufferObject::Renderer,实现一个自定义Renderer
    3. 自定义Renderer内部再封装一个OpenGL相关的渲染类。Renderer是在Scene Graph线程工作,始终拥有OpenGL上下文环境,所以渲染类写在Renderer内部,非常方便。
    4. Renderer 有个函数叫void synchronize(QQuickFramebufferObject *item), 可以用来做线程同步 (Item工作在主线程,Renderer 工作在Scene Graph绘图线程) 我用的时候,是把参数item可以强制转换成我从Item派生出来的子类,然后用里面的数据和这个Renderer交互就好了。 FrameBufferObject
  • light

    Shader光照的例子。 一个立方体的前面, 放一个移动的光源。 light

  • lightCasters

    手电筒光源

    lightCasters

  • mulitLight

    镜面反射、漫反射,手电筒的集合 mulitLight

  • material

    材质的使用,边缘部分发光,中间部分不发光

    material

  • DepthTest

    利用深度测试,后面的箱子边缘部分用红色绘制出来

    DepthTest

  • CubeMap

    天空盒

    CubeMap

qtopengl's People

Contributors

jaredtao avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.