c++ - OpenGL着色器和绘图命令的共存
问题描述
在我的应用程序中,我使用 OpenGL 使用经典的 Shader + VAO + many VBO 绘制许多形状并调用 glDrawArrays(...)
它运行良好,但为了实现轴可视化,我尝试使用 OpenGL 命令。
我想出了这段代码:
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
WhenPaint(); //The function which loop around all object and draw using proper VAO and shaders
//Here I start use OpenGL draw commands to draw my axis
glMatrixMode(GL_PROJECTION);
glLoadMatrixf(&(camera.GetProjectionMatrix(Upp::Sizef{sizeW,sizeH})[0][0])); //Setting up projection
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf(&(camera.GetViewMatrix()[0][0])); //Setting up viewMatrix
if(ShowAxis)GLDrawFunction::PaintAxis(0, 0, 0,200); //a function that draw axis
这项工作,但只有当我评论WhenPaint()函数......
在这里,您可以看到没有 WhenPaint() 函数的视图:
当我使用WhenPaint() 时,您可以看到这里的视图(在OpenGL Draw 命令之前或之后无关紧要):
是否有可能使这两种绘制事物的方式一起工作?
解决方案
推荐阅读
- apache-spark - spark 结构化流中的度量来获取总批处理时间
- xquery - 如何计算具有相同日期的子项的节点
- html - 删除特定
- treeview - 如何在 Vuetify 中使用按钮折叠 v-treeview?
- oracle - Oracle 选择查询不获取值为空的记录
- node.js - Sequelize "raw = true" 用点更改 json 模型属性名称
- javascript - Leaflet.draw 发出事件以停止绘图
- sparql - SPARQL:排除 COUNT 中的双重资源
- docker - Kubernetes 拉取镜像 k8s.gcr.io 失败
- java - 在更新其父级时防止休眠选择子级?