Exception thrown at 0x047E6100 (nvoglv32.dll)

-1

I am trying to render vertices with opengl "direct rendering" from khronos.org, I get Exception thrown (nvoglv32.dll) every single time i try to fix things :/

heres the exception (edit: "Exception thrown at 0x7978FCF6 (nvoglv32.dll) in Game Engine Test2.exe: 0xC0000005: Access violation reading location 0x00000000.")

This exception is thrown after "glDisableVertexAttribArray", i think it has to do with glDrawElements. m_Model is working and gets the vao, vbo, ibo with all the vertices and indices. (with the memory adresses and stuff) (edit: realised that i was missleading when i tried to use "glDrawElements" not "glDrawArrays")

and also i wanted to ask if you can use "vertexcount" as your "indexcount" also or if you need to have "vertexcount" and "indexcount"

void Renderer3D::Render(Model* model, void* positions, GLushort* indices, GLsizei vertexcount, GLsizei indexcount)
{
    m_Model = model;
    m_Model->setthings(positions, indices, vertexcount, indexcount);
    
    //binding stuff
    glBindVertexArray(m_Model->getVaoID());

    //enabling vertex attrib arrays
    glEnableVertexAttribArray(0);
    glEnableVertexAttribArray(1);
    glEnableVertexAttribArray(2);

    //drawing
    glDrawElements(GL_TRIANGLES, m_Model->getIndexCount(), GL_UNSIGNED_SHORT, nullptr); 
    
    //disabling vertex attrib arrays
    glDisableVertexAttribArray(0);
    glDisableVertexAttribArray(1);
    glDisableVertexAttribArray(2);

    //unbinding vao
    glBindVertexArray(0);
}
c++
opengl
game-engine
asked on Stack Overflow Aug 12, 2020 by Adam • edited Aug 12, 2020 by genpfault

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0