简体   繁体   English

向QT OpenGL场景图添加纹理

[英]Add texture to QT OpenGL scene graph

I am trying to render a texture to a simple opengl square. 我正在尝试将纹理渲染为简单的opengl正方形。 I just want to map the texture directly onto the rectangle. 我只想直接将纹理映射到矩形上。 I followed the scene graph example, located here , on how to call opengl functions and display shapes, but i'm lost with trying to add a texture. 我遵循了此处的场景图示例,该示例涉及如何调用opengl函数和显示形状,但是我迷失于尝试添加纹理的过程。 I checked through multiple docs and they all dealt with using the fixed function pipeline, or subclassing QGLWidget. 我检查了多个文档,并使用固定功能管道或对QGLWidget进行子类化处理。 I would like to keep this example OpenGL ES and with utilizing shaders. 我想保留此示例OpenGL ES并利用着色器。

I am new to OpenGL so if anyone could give me an understanding of what has to happen, that would be wonderful. 我是OpenGL的新手,所以如果有人可以让我了解发生了什么,那就太好了。

You need to render a texture in a Frame Buffer Object and then display it in the scene graph. 您需要在帧缓冲区对象中渲染纹理,然后在场景图中显示它。 See the Scene Graph - Rendering FBOs example. 请参见“ 场景图-渲染FBO”示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM