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

  • Home
  • SEARCH
  • 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 3636236
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:00:20+00:00 2026-05-19T01:00:20+00:00

My problem seems to be really simple but I just can’t get the reason

  • 0

My problem seems to be really simple but I just can’t get the reason behind it:

  • I have a vertex and an index buffer that get filled in with glBufferSubData. There are a couple of meshes that get filled in one-by-one into this big VBO and its corresponding IBO
  • Then I try to render those small meshes with glDrawElements one-by-one

Problem is, only first mesh gets rendered – and multiple times – in places where each of those different meshes should be!!!

Following info may be useful:

I create VBO this way

gl.glGenBuffers(1, buffers_, 0);
gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, buffers_[0]);
gl.glBufferData(GL11.GL_ARRAY_BUFFER, sizeInBytes, null, GL11.GL_DYNAMIC_DRAW);

Then each mesh is filled into the VBO like this

gl.glBindBuffer(GL11.GL_ARRAY_BUFFER, name);
gl.glBufferSubData(GL11.GL_ARRAY_BUFFER, startOffsetInBytes, numBytesToCopy, nioBuffer);

And meshes are rendered in this fasion

  • bind VBO/IBO and set appropriate client states
  • then set vertex, normal, and texcoord “pointers” – they point at the beginning of VBO plus their offsets in vertex “structure”
  • and call gl.glDrawElements(GL10.GL_TRIANGLES, indicesNum, GL10.GL_UNSIGNED_SHORT, startIndexOffsetInBytes);
  • then finally, unbind VBO/IBO and disable client states

I debugged the code and I’m sure that sizeInBytes, startOffsetInBytes, numBytesToCopy and startIndexOffsetInBytes are correct values (in bytes:))) and indicesNum is the number of indices/vertices in the mesh (to render).

One suspicious place is setting vertex/normal/texcoord pointers – they get set only once – and set to the beginning of the VBO. Maybe I need to set them each time before calling glDrawElements?

  • 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-19T01:00:21+00:00Added an answer on May 19, 2026 at 1:00 am

    😀 Found that reason. Everything I described is correct indeed. Problem is in the way meshes are being added into the VBO/IBO – indices for each new mesh were restarted from 0!! So only the first mesh in VBO was getting rendered.

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

Sidebar

Related Questions

This seems like a really, really simple problem, but I can't figure it out.
Seems like a simple problem: I have an SVN repo inside our firewall. I
This seems like such a trivial problem, but I can't seem to pin how
This is probably a really basic problem but I can't seem to find any
I have a problem that seems like its a result of a deadlock-situation. Whe
This seems to be a common problem but I cannot find a solution. I
it seems that I just solved my problem why I couldn't use the ASP.NET
it seems I have run into a problem with Internet Explorer 7. I have
This seems like a very simple and a very common problem. The simplest example
This seems like it should be really simple. I compiled a library in Qt

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.