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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:34:20+00:00 2026-06-05T10:34:20+00:00

It’s getting frustrating. I’ve been trying to get a simple hello world type program

  • 0

It’s getting frustrating. I’ve been trying to get a simple hello world type program to run, but it just isn’t happening.

I’m using Windows 7 and my graphics card does support the newer OpenGL stuff.
Writing in C with freeglut, and I am compiling with MinGW and Code::Blocks.
In the linker I have freeglut, opengl32 and glu32.
I keep the freeglut stuff in the freeglut folder that is located in my MinGW folder, so under search directories in my build settings I have “C:\MinGW\freeglut\include” for the compiler and “C:\MinGW\freeglut\lib” for the linker.

Here’s my code:

#include <stdlib.h>
#include <GL/glut.h>

void NIAppIdle(void);
void NIAppDisplay(void);

int main(int argc, char *argv[])
{
    // Setup windwing
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE);
    glutInitWindowSize(800, 600);
    glutCreateWindow("HELLO WORLD");

    // Define GLUT callbacks
    glutIdleFunc(NIAppIdle);
    glutDisplayFunc(NIAppDisplay);

    // Enter render loop
    glutMainLoop();
    return 0;
}

void NIAppIdle(void)
{
    glutPostRedisplay();
}

void NIAppDisplay(void)
{
    glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT);

    float geometry[] =
    {
        -0.5f,  0.5f, 0.0f, 1.0f,
         0.5f, -5.0f, 0.0f, 1.0f,
         0.0f,  0.5f, 0.0f, 1.0f
    };
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 4, GL_FLOAT, 0, 0, geometry);
    glDrawArrays(GL_TRIANGLES, 0, 3);
    glutSwapBuffers();
}

The problem is with the “glEnableVertexAttribArray” and “glVertexAttribPointer” functions.
The compiler says that they are “not declared it this scope”.

Program can run without those lines, so I guess OpenGL is linked properly, but I simply can’t use those functions for some reason, and I know they are a part of OpenGL.
Is it something to do with the version of OpenGL I have or something?

Anyway, it is my first time learning OpenGL, I’ve probably done something horribly wrong, so I’m asking for somebody to help me. I’m sorry if this post seems a bit crappy, this is also my first time posting in this site. Also I’m sorry for my grammar, English isn’t my first language.

  • 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-05T10:34:22+00:00Added an answer on June 5, 2026 at 10:34 am

    I think you can only get to glEnableVertexAttribArray by manually loading the function pointer for it. If all you want to do is create a simple hello world program, I’d recommend you use GLEW to handle that for you.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
Seemingly simple, but I cannot find anything relevant on the web. What is the
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Specifically, suppose I start with the string string =hello \'i am \' me And
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a

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.