-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
请教大佬,为什么运行完189行代码之后,shaderProgram2的值变了 #29
Comments
改成
因为在内存中VAO2变量的后面刚好是shaderProgram2,而glGenVertexArray(2, arrofvao)这里2的含义是生成两个VAO对象,他的指针参数认为是2个int组成数组,把第二个VAO的int越界写入到shaderProgram2了。 |
你不会以为这个2是第二次调用的意思吧?你这里不是1他就认为你的指针是数组首地址指针了,认为你为了追求性能而批量分配VAO。我的建议是第一个参数焊死,始终为1不要乱动,就当这个参数不存在。 |
哦~,明白了,感谢小彭老师!! |
这个不是opengl内存模型,而是cpp内存模型
无法顺畅的大口呼吸,是活着的最好证明
…---原始邮件---
发件人: ***@***.***>
发送时间: 2023年7月30日(周日) 晚上9:52
收件人: ***@***.***>;
抄送: ***@***.******@***.***>;
主题: Re: [parallel101/opengltutor] 请教大佬,为什么运行完189行代码之后,shaderProgram2的值变了 (Issue #29)
感谢小彭老师,╰(°▽°)╯
我又试了下,我把VAO2改成了数组,结果为什么又正常了呢
不知道小彭老师有没有兴趣简单讲下opengl的内存模型或者是调试方法呢︿( ̄︶ ̄)︿
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: