Comments (6)
from opengltutor.
glGenVertexArrays(2, &VAO2);
改成
glGenVertexArrays(1, &VAO2);
因为在内存中VAO2变量的后面刚好是shaderProgram2,而glGenVertexArray(2, arrofvao)这里2的含义是生成两个VAO对象,他的指针参数认为是2个int组成数组,把第二个VAO的int越界写入到shaderProgram2了。
from opengltutor.
你不会以为这个2是第二次调用的意思吧?你这里不是1他就认为你的指针是数组首地址指针了,认为你为了追求性能而批量分配VAO。我的建议是第一个参数焊死,始终为1不要乱动,就当这个参数不存在。
from opengltutor.
感谢小彭老师,╰(°▽°)╯
我又试了下,我把VAO2改成了数组,结果为什么又正常了呢
不知道小彭老师有没有兴趣简单讲下opengl的内存模型或者是调试方法呢︿( ̄︶ ̄)︿
from opengltutor.
哦~,明白了,感谢小彭老师!!
from opengltutor.
from opengltutor.
Related Issues (3)
- 学完真的能构建爆款游戏引擎吗? HOT 4
- 问题:计算具有biased的顶点法向量,代码中是不是需要关于顶点做个轮换 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opengltutor.