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 7017039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:51:47+00:00 2026-05-27T22:51:47+00:00

I have recently migrated from a 32bit environment to a 64bit one, and it

  • 0

I have recently migrated from a 32bit environment to a 64bit one, and it has gone smoothly apart from one problem: glMultiDrawElements uses some arrays that do not work without some tweaking under a 64bit OS.

glMultiDrawElements( GL_LINE_LOOP, fCount_, GL_UNSIGNED_INT,
                     reinterpret_cast< const GLvoid** >( iOffset_ ),
                     mesh().faces().size() );

I am using VBOs for both the vertices and vertex indices. fCount_ and iOffset_ are arrays of GLsizei. Since a buffer is bound to GL_ELEMENT_ARRAY_BUFFER, iOffset_‘s elements are used as byte offsets from the VBO beginning. This works perfectly under a 32bit OS.

If I change glMultiDrawElements to glDrawElements and put it into a loop, it works fine on both platforms:

int offset = 0;
for ( Sy_meshData::Faces::ConstIterator i  = mesh().faces().constBegin();
                                        i != mesh().faces().constEnd(); ++i ) {
    glDrawElements( GL_LINE_LOOP, i->vertexIndices.size(), GL_UNSIGNED_INT,
                    reinterpret_cast< const GLvoid* >( sizeof( GLsizei ) * offset ) );
    offset += i->vertexIndices.size();
 }

I think what I am seeing is OpenGL reading 64bit chunks of iOffset_ leading to massive numbers, but glMultiDrawElements does not support any type wider than 32bit (GL_UNSIGNED_INT), so I’m not sure how to correct it.

Has anyone else had this situation and solved it? Or am I handling this entirely wrong and was just lucky on a 32bit OS?

Update

Swapping out my existing code for:

typedef void ( *testPtr )( GLenum mode, const GLsizei* count, GLenum type,
                           const GLuint* indices, GLsizei primcount );
testPtr ptr = (testPtr)glMultiDrawElements;
ptr( GL_LINE_LOOP, fCount_, GL_UNSIGNED_INT, iOffset_, mesh().faces().size() );

Results in exactly the same result.

  • 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-27T22:51:48+00:00Added an answer on May 27, 2026 at 10:51 pm

    The simple reason is, that glMultiDrawElements doesn’t expect an array of integer offsets (32bit on your platform), but an array of pointers (64bit on your platform), interpreted as buffer offsets.

    But you are just casting the array of (or pointer to) integers to an array of (or pointer to) pointers, which won’t work, as the function now just reinterprets your n consecutive 32bit values as n consecutive 64bit values. Of course it works for glDrawElements because you’re just casting a single integer into a single pointer, which essentially converts your 32bit value into a 64bit value.

    What you need to do is not cast your pointer/array, but each individual value in this offset array:

    std::vector<void*> pointers(mesh().faces().size());
    for(size_t i=0; i<pointers.size(); ++i)
        pointers[i] = static_cast<void*>(iOffset_[i]);
    glMultiDrawElements( GL_LINE_LOOP, fCount_, GL_UNSIGNED_INT, 
                         &pointers.front(), mesh().faces().size() );
    

    Or better, just store your offsets as pointers instead of integers right from the start.

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

Sidebar

Related Questions

We have a 3.5 Gb SVN repository recently migrated from a 6 Gb one.
We have recently migrated a large, high demand web application to Tomcat 5.5 from
I recently migrated an older application we have at work from Java 1.5 to
We are recently migrated from CVS to SVN and I have setup SVN WebDAV
We have recently migrated to Git from SVN. We have setup a bare repository
We have a setup with a development trunk in our recently-migrated-to-from-VSS TFS system and
We have recently migrated tests from NUnit to MSTest and I am struggling to
We have recently migrated tests from NUnit to MSTest and I am struggling to
Recently I have migrated my project from SQLServer 2000 to MySQL 5.2 using MySQL
Our team has recently migrated to git. We have production web application server with

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.