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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:06:06+00:00 2026-05-27T11:06:06+00:00

I have attempted to start programming with OpenGl using this tutorial , and have

  • 0

I have attempted to start programming with OpenGl using this tutorial, and have the following code so far:

#include <gl/glut.h> // Include the GLUT header file

void display (void)
{
}

int main(int argc, char **argv)
{
    glutInit(&argc, argv); // Initialize GLUT
    // Set up a basic display buffer (only single buffered for now)
    glutInitDisplayMode (GLUT_SINGLE);
    glutInitWindowSize (500, 500); // Set the width and height of the window
    glutInitWindowPosition (100, 100); // Set the position of the window
    // Set the title for the window
    glutCreateWindow("Your first OpenGL Window!");

    glutDisplayFunc(display);
    glutMainLoop();
    glClearColor(1.f, 0.f, 0.f, 1.f); // Clear the background of our window to red

    return 0;
}

I build and run the project in Eclipse, it compiles all fine, but nothing happens (no windows pop up or anything). Can anybody tell me what I could be doing wrong?

  • 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-27T11:06:06+00:00Added an answer on May 27, 2026 at 11:06 am
    glutInitDisplayMode (GLUT_SINGLE);
    

    You also need to define the kind of framebuffer format you want, i.e. add a GLUT_RGBA, at least (and you probably also want a depth buffer). And there are only few cases where one not wants a double buffer. So: glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE);

    Then your display function will not be called, unless you add a glutDisplayFunc(display); after glutCreateWindow.

    glutMainLoop();
    glClearColor(1.f, 0.f, 0.f, 1.f);
    

    glutMainLoop does not return. And even if it did, glClearColor had no effect at that place in the program.

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

Sidebar

Related Questions

I just start using Mercurial yesterday (I don't have much programming experiences). I noticed,
I have attempted to use this CSS to set the width of my form
I believe this question might have been previously attempted in 2006 on a different
I have some experience making multiplayer turn-based games using sockets, but I've never attempted
Let's say I have an input text file of the following format: Section1 Heading
I have attempted to make my first 3 tier application. In the process I
I have a two-column primary key on a table. I have attempted to alter
Can Unicode characters be encoded and decoded with Base64 ? I have attempted to
I have created a skin for DotNetNuke 5.x and I attempted to do as
I have c++ code that attempts to dynamically allocate a 2d array of bytes

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.