0

To give you an idea of what I am really trying to do. My goal is to create a c++ program in Visual Studio and using OpenGl display a blackscreen and a white dot in the middle of the screen.

Before I can even get to the coding part though, I have to include the OpenGL library somehow.

Looking at OpenGL documentation they say that it's already installed, I just need to initialize it.

I'd rather not have to do all the initialization work as it's already been done several times, such as FreeGLUT, but I have 2 real problems that I currently just do not understand.

1) How do I compile FreeGlut? I've downloaded the source code for FreeGLUT here http://prdownloads.sourceforge.net/freeglut/freeglut-3.0.0.tar.gz?download

I configured it with CMAKE into a visual studio 2013 compatible project. but once I open it with Visual Studio and try to compile it, I get a bunch of errors saying:

Error C1083: Cannot open include file: 'EGL/egl.h': No such file or directory   c:\freeglut-3.0.0\include\gl\freeglut_std.h 136 1   One_static

2) Once I get it compiled, how do I link it to my c++ project so that I can do

#include<FreeGLUT.h>

or

#include <GL/glut.h>

?

Jeff Davenport
  • 2,624
  • 2
  • 13
  • 19

1 Answers1

1

Most likely CMake did configure it wrong; EGL is used in embedded systems (think Android, set-top boxes, and such) not Windows. Double check that CMake does something sensible there.

After you've built FreeGLUT copy it somewhere convenient (do not copy it into the Visual Studio installation directory) and add the directories where you placed FreeGLUT to your own OpenGL project's compiler and linker search paths (reachable in the Visual Studio Build configuration).

Personally I place customly built libraries at

C:\local\include\ (the header files)

and

C:\local\lib (the .lib, .a and .dll files)

I also tend to give libraries an architecture infix like x86_32 or x86_64. e.g. freeglut-x86_64.dll. It's unlikely Windows will ever get some kind of "fat binary" in which the code for several architectures can be merged.

For convenience put the DLL path into the system search path for DLLs. When deploying your program copy the required DLLs into the same directory as the EXE files.

datenwolf
  • 159,371
  • 13
  • 185
  • 298
  • I was able to compile the binaries for FreeGLUT without errors, but now I am stuck, I don't really know what to do next. I can't find any .dll .lib or .a files in any of the files there were output. So let me back up. I downloaded FreeGLUT, extracted it to C:\freeglut-3.0.0\ Then I open that path in CMake and built the binaries to C\local\GLUT Then after that I opened the file C\local\GLUT\freeglut.sln in Visual Studio and compiled it. Now I am left with a ton of files and no .dll, .a or .lib files. Where do I get those? And once I get them how do I link them in my OpenGL project? – Jeff Davenport Apr 07 '15 at 23:28
  • @JeffDavenport: What you did sounds right. But if the result is missing there should have been error messages. The output files should be in a directory `Release` or `Debug` depending on the build configuration selected. – datenwolf Apr 08 '15 at 00:10
  • @datenwoolf: I was able to find them, they were in the ./lib folder and ./bin folder with tons of other pointless files, haha Thanks! – Jeff Davenport Apr 08 '15 at 22:28
  • @JeffDavenport: Well, those "pointless files" would be the intermediary outputs of the compilation. And it's not pointless for them to stick around: In a programming project consisting of multiple source files, when editing a source file only that single source has to be recompiled. So you can use all the other intermediaries from a previous compilation run and save lots of time building the program. – datenwolf Apr 08 '15 at 23:29