Coder Social home page Coder Social logo

Comments (6)

singleo0 avatar singleo0 commented on June 22, 2024

output

from opengltutor.

archibate avatar archibate commented on June 22, 2024
glGenVertexArrays(2, &VAO2);

改成

glGenVertexArrays(1, &VAO2);

因为在内存中VAO2变量的后面刚好是shaderProgram2,而glGenVertexArray(2, arrofvao)这里2的含义是生成两个VAO对象,他的指针参数认为是2个int组成数组,把第二个VAO的int越界写入到shaderProgram2了。

from opengltutor.

archibate avatar archibate commented on June 22, 2024

你不会以为这个2是第二次调用的意思吧?你这里不是1他就认为你的指针是数组首地址指针了,认为你为了追求性能而批量分配VAO。我的建议是第一个参数焊死,始终为1不要乱动,就当这个参数不存在。

from opengltutor.

singleo0 avatar singleo0 commented on June 22, 2024

感谢小彭老师,╰(°▽°)╯
我又试了下,我把VAO2改成了数组,结果为什么又正常了呢
image
image
不知道小彭老师有没有兴趣简单讲下opengl的内存模型或者是调试方法呢︿( ̄︶ ̄)︿

from opengltutor.

singleo0 avatar singleo0 commented on June 22, 2024

哦~,明白了,感谢小彭老师!!

from opengltutor.

archibate avatar archibate commented on June 22, 2024

from opengltutor.

Related Issues (3)

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.