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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:31:21+00:00 2026-05-24T18:31:21+00:00

I read the red book (7th edition) and while testing glMultiDrawElements I got nothing

  • 0

I read the red book (7th edition) and while testing glMultiDrawElements I got nothing on my screen, and “Access violation” error in debug console. I use MVS2010, and here are main code parts I compile:

// C4UB_V2F interwined format, vertex are CCW ordered
static const GLfloat vertex[] = {

    // First triangle
    0xff0000ff, 0.25f, 1.0f, // nevermind on that incorrect integer colors
    0x00ff00ff, 0.0f,  0.0f,
    0x0000ffff, 0.5f,  0.0f,

    // Second one
    0xff0000ff, 0.75f, 0.0f,
    0x00ff00ff, 0.5f,  1.0f,
    0x0000ffff, 1.0f,  1.0f

};


void init() {

    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    glShadeModel(GL_SMOOTH);
    glInterleavedArrays(GL_C4UB_V2F, 0, vertex);

}


static const GLubyte order[] = { 0, 1, 2, 3, 4, 5 };

static GLubyte oneIndices[] = {0, 1, 2};
static GLubyte twoIndices[] = {3, 4, 5};
static GLsizei count[] = {3, 3};
static GLvoid * indices[2] = {oneIndices, twoIndices};

void render() {

    glClear(GL_COLOR_BUFFER_BIT);

    // This one works perfectly:
    //glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_BYTE, order); 

    // And this one generates access violation error
    // in the book there's no indices casting, but MVS2010 is too lazy to cast it itself
    glMultiDrawElements(GL_TRIANGLES, count, GL_UNSIGNED_BYTE, (const GLvoid **)indices, 2);


    // This command never executes 'cause of acces violation error occuring 
    glFlush();

}

Seems to me I’ve missed something while casting indices, but I can’t get what exactly. Any ideas?

  • 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-24T18:31:22+00:00Added an answer on May 24, 2026 at 6:31 pm

    I just checked – printf(“%i”, glDrawElementsInstanced); is printing zero.

    There are two possibilities for that.

    1. Your OpenGL implementation doesn’t support them. This would mean that you have ancient drivers, or you aren’t creating a context properly. Since you’re using FreeGLUT, a context creation problem is unlikely. If your hardware was made in the last 7 years, you should be able to get them.

    2. You did not initialize GLEW. You must call glewInit after creating the OpenGL window with FreeGLUT. Otherwise, you will not have properly initialized GLEW, and your function pointers will be NULL.

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

Sidebar

Related Questions

I've read quite a bit of the Red Bean Software SVN Book, and some
I've read the SVN red-bean book, and research how people layout their SVN repos,
As described in: http://hgbook.red-bean.com/read/handling-repository-events-with-hooks.html I thought I could write a small hook which rejects
I have read that while plug-ins are not supported for SQL Server Management Studio,
I have a users model and a book model. Users can read books (as
Read about Server push here . I want to push data to client from
Read on before you say this is a duplicate, it's not. (as far as
Read (skimmed enough to get coding) through Erlang Programming and Programming Erlang . One
I read this PHP RegEx page , but either I'm missing something, misreading something,
Having read the threads Is SqlCommand.Dispose enough? and Closing and Disposing a WCF Service

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.