Draw in OpenGL

Print Friendly, PDF & Email

How to compile a program written in OpenGL

g++ -Wall -O my-program.cpp -lglut -o my-program
In which:

  • -Wall: is a way of saying the compiler that it should output all the warnings
  • -O: says the compiler to use some optimization techniques
  • -l is a linker option stating to include the library followed the -l. Here is glut.

    There is a little extra advantage when using GLUT, if you were developing an OpenGL application you should include the header files gl.h and glu.h (glu is the OpenGL Utility Library) but when you are including glut.h, glut.h guarantees the inclusion of gl.h and glu.h. So when we start and OpenGL application we start by writing:


  • -o: says the compiler that it should produce a binary file whose name is my-program

An Efficient Way to Draw Approximate Circles in OpenGL
An introduction of GLUT (Understand easily)

Draw Text
Faster Text in OpenGL
Drawing Text

One thought on “Draw in OpenGL

Leave a Reply

Your email address will not be published. Required fields are marked *



This site uses Akismet to reduce spam. Learn how your comment data is processed.