0

I wrote this code in C++:

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

void drawPoint() {

   glBegin(GL_POLYGON);
   glVertex3f(20, 20, 0);
   glVertex3f(80, 20, 0);
   glVertex3f(80, 80, 0);
   glVertex3f(20, 80, 0);

  glEnd();

}


int main(){

    drawPoint();

}

The compiler should run the program, by showing a window with a black square.

But when I run, it doesn't execute anything. I use Eclipse, but I don't think the latter is the problem because I executed an example program this morning and it worked well. Can you help me? :)

genpfault
  • 51,148
  • 11
  • 85
  • 139
  • You are not specifying any colors, textures, etc. and after you draw you immediately exit. Look at this example https://www.badprog.com/c-opengl-hello-world – stark Nov 09 '16 at 18:07
  • 1
    You need a context and a window to draw something in OpenGL. you can't just draw it without. – l'arbre Nov 09 '16 at 18:12

0 Answers0