• Breaking News

    glBindVertexBuffer and INVALID_OPERATION(0x502) Hello. From documentation: But I bind VAO before calling glBindVertexBuffer. Initialization: glGenVertexArrays(1, &m_VAO); glBindVertexArray(m_VAO); glVertexAttribFormat(0, 3, GL_FLOAT, false, offsetof(vertex, coords)); glVertexAttribBinding(0, 0); glEnableVertexAttribArray(0); glVertexAttribFormat(1, 3, GL_FLOAT, false, offsetof(vertex, color)); glVertexAttribBinding(1, 0); glEnableVertexAttribArray(1); glVertexAttribFormat(2, 2, GL_FLOAT, false, offsetof(vertex, tex_coords)); glVertexAttribBinding(2, 0); glEnableVertexAttribArray(2); glVertexAttribFormat(3, 3, GL_FLOAT, false, offsetof(vertex, normal_coords)); glVertexAttribBinding(3, 0); glEnableVertexAttribArray(3); glBindVertexArray(0); glGenBuffers(1, &m_VBO); glGenBuffers(1, &m_EBO); glBindBuffer(GL_ARRAY_BUFFER, m_VBO); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_EBO); glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(vertex), vertices.data(), GL_STATIC_DRAW); glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(unsigned), indices.data(), GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); rendering: glBindVertexArray(m_VAO); glBindVertexBuffer(0, m_VBO, 0, sizeof(vertex)); int error = glGetError(); // INVALID_OPERATION(0x502) glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_EBO); glDrawElements(GL_TRIANGLES, m_indexCount, GL_UNSIGNED_INT, 0); //crash https://ift.tt/eA8V8J

    Hello. From documentation: But I bind VAO before calling glBindVertexBuffer. Initialization: glGenVertexArrays(1, &m_VAO); glBindVertexArray(m_VAO); glVertexAttribFormat(0, 3, GL_FLOAT, false, offsetof(vertex, coords)); glVertexAttribBinding(0, 0); glEnableVertexAttribArray(0); glVertexAttribFormat(1, 3, GL_FLOAT, false, offsetof(vertex, color)); glVertexAttribBinding(1, 0); glEnableVertexAttribArray(1); glVertexAttribFormat(2, 2, GL_FLOAT, false, offsetof(vertex, tex_coords)); glVertexAttribBinding(2, 0); glEnableVertexAttribArray(2); glVertexAttribFormat(3, 3, GL_FLOAT, false, offsetof(vertex, normal_coords)); glVertexAttribBinding(3, 0); glEnableVertexAttribArray(3); glBindVertexArray(0); glGenBuffers(1, &m_VBO); glGenBuffers(1, &m_EBO); glBindBuffer(GL_ARRAY_BUFFER, m_VBO); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_EBO); glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(vertex), vertices.data(), GL_STATIC_DRAW); glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(unsigned), indices.data(), GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); rendering: glBindVertexArray(m_VAO); glBindVertexBuffer(0, m_VBO, 0, sizeof(vertex)); int error = glGetError(); // INVALID_OPERATION(0x502) glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_EBO); glDrawElements(GL_TRIANGLES, m_indexCount, GL_UNSIGNED_INT, 0); //crash

    from GameDev.net http://bit.ly/2Vo44vv

    ليست هناك تعليقات

    Post Top Ad

    ad728

    Post Bottom Ad

    ad728