Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4615566
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:51:30+00:00 2026-05-22T01:51:30+00:00

While looping through all objects I want to render in my 3D-engine, I get

  • 0

While looping through all objects I want to render in my 3D-engine, I get an error when trying to call

glDrawArrays(mesh->primitiveType, 0, mesh->vertexCount); 

Because it tries to read from location 0x0000000, so apparently the pointer bound to the mesh->vertexBuffer index points to zero. This all happens within my RenderableObject class. Instances of this class have a mesh bound to them, and this mesh contains an index that should link to the VertexArray. But apparently

glBindBuffer(GL_ARRAY_BUFFER, mesh->vertexBuffer);

Is failing.

The strange thing is, that it will run on my mac, and various other windows computers – but it won’t run on this (windows) computer. Because I’m testing I removed all 3D models, and found it’s the primitives that are causing the problem, somehow the MSVC++ compiler “optimized” my code, to remove everything after

glGenBuffers(1, &CubeMesh.vertexBuffer);

And that’s probably why nothing got bound, or so I thought. I disabled linker/compiler optimizations, and I could see allbreakpoints would get hit now – but I still get the same exception, and I’m absolutely clueless as to why it doesn’t work.

The entire source of the project can be found @ https://github.com/Wrap/TwinGame/tree/master/src , as far as I can tell the problem is in the Primitives.cpp, and/or the RenderableObject.cpp (specifically the RenderableObject::Draw(); method) file. Am I trying to read something that is protected, what is wrong with the LoadPrimitives(); method?

Thanks for taking the time to read this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T01:51:31+00:00Added an answer on May 22, 2026 at 1:51 am
    RenderableObject::RenderableObject(ObjectManager* objectmgr) : Object(objectmgr), visible(true), scale(1.0f), mesh(0) {
        mObjMgr->registerRenderable(this);
    }
    

    I think here is your problem mesh(0). Maybe you are calling the Draw() method before you initialize this value. Maybe your Renderer class does it.

    Try to add assert(mesh != 0) before any function call.

    void RenderableObject::Draw(class ShaderManager* shaderMgr){
        //TODO: iterate through all meshes that belong to the object
    
        assert(mesh != 0)
    
        glBindBuffer(GL_ARRAY_BUFFER, mesh->vertexBuffer[0]);
    

    And I hope, that you are checking, if GL_ARB_vertex_buffer_object is available. I hope this works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looping through all my databases and aggregating the results into an aggregates
branch is of checkbox list type, but while looping through this it adds only
while reading cocoa fundamental guide i have gone through: (void)addObserver:(id)notificationObserver selector:(SEL)notificationSelector name:(NSString *)notificationName object:(id)notificationSender
I'm trying to make a list of all items in a binary search tree.
While looking at a micro-optimization question that I asked yesterday ( here ), I
While looking at online code samples, I have sometimes come across an assignment of
While looking for a light-weight Scala development environment, I came upon an Scala edit
While looking for an SFTP client in C# SSH File Transfer Protocol (SFTP), I've
Background: Recently while looking at a structured text editor I noticed they used a
While working on a C++ project, I was looking for a third party library

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.