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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:12:06+00:00 2026-06-17T16:12:06+00:00

I’m making a Connect4 game using freeglut and glew. This is how my game

  • 0

I’m making a Connect4 game using freeglut and glew. This is how my game looks. The circles (white/red/blue) were the only objects rendered at every single call back of the display() function.

Circle * ChessPiece = new Circle(0.08f);

enter image description here

Every thing worked fine, except that if I let the app sit for about 2 minutes, it crashed with the following error message:

enter image description here

The way I resolved this issue was to add these 2 lines right above glGenVertexArrays()

glewExperimental = GL_TRUE;

glewInit();

This worked. However, it resulted in a performance hit (since glewInit() was called every single time a circle was rendered, at every display() call back).

I tried to put glewExperimental and glewInit() inside the display() call-back function hoping to improve the performance, but the app still crashed after 2 minutes of running.

Another work-around was to pre-render all the circles at the very beginning, and then just change the color as the game progresses. This worked also. However, I would prefer to dynamically generate circles during the game progress, not at the beginning of the game.

So, my question is:

Is this a GLEW bug? or is this my code problem? The reason why I’m thinking its’ a glew bug was because when I added glewExperimental and glewInit() right before glGenVertexArrays(), the game no longer crashed. The only downside was the massive performance hit.

Putting glewExperimental and glewInit() in the main() function or in the display() call-back function didn’t work either. The app would compile and run fine for the first 2 minutes before it crashed.

If it’s a GLEW bug, how do I get around this issue? (without having to pre-render the circles at the beginning of the game).

Code snipet for drawing the circle:

void Circle::draw(float x, float y, float z)
{
    //Codes to generate circle vertices 

    //These stop the app from crashing after 2 minutes, but I don't want to use them
    //glewExperimental = GL_TRUE;
    //glewInit();

    glGenVertexArrays(1, &vertexArray_Circle);
    glBindVertexArray(vertexArray_Circle);
    glGenBuffers(1, &vertexBuffer_Circle);

    glBindBuffer(GL_ARRAY_BUFFER, vertexBuffer_Circle);
    glBufferData(GL_ARRAY_BUFFER, (sizeof(Circle_vertices)/sizeof(float))*sizeof(GLfloat), Circle_vertices, GL_STATIC_DRAW);
    glVertexAttribPointer((GLuint)0, 3, GL_FLOAT, GL_FALSE, 0, 0);
    glEnableVertexAttribArray(0);

   //Draw circle
   glBindVertexArray(vertexArray_Circle);
   glVertexAttrib3f((GLuint)1, RED, GREEN, BLUE);
   glDrawArrays(GL_TRIANGLE_FAN, 0, index/3);

   glDisableVertexAttribArray(0);
}
  • 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-06-17T16:12:07+00:00Added an answer on June 17, 2026 at 4:12 pm

    It would be nice to see the actual code, rather than just a screen-shot of it, but it looks like you’re generating a new vertex array every time you draw, and it fails just after this…

    I suspect that you’re not actually deleting those vertex arrays, and given long enough, you’re running out of resources and the call fails. Without checking for errors, you end up crashing.

    Really you should not regenerate the array unless necessary, and if it is, make sure you delete the old one.

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

Sidebar

Related Questions

I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am using JSon response to parse title,date content and thumbnail images and place
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.