Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Developing OpenGL Applications Everywhere

I am studing OpenGL and I usually study in the laboratory in my university.

My problem is that the computers in the university don't have the necessary libraries installed for me to study the programs, and I have only user permissions in these computers, so I can't install anything that need administrator permissions.

Usually I develop in a linux environment, but the computers on the lab all got Windows XP or Windows 7 running. I use g++ to compile my programs, freeglut and opengl library. I also use the OpenGL extensions to be able to use vertex array objects for example, and other features to the newers versions of OpenGL.

I am thinking if that is a way to put everything I need in my pendrive and just execute this in every computer I go, without having to install nothing. Maybe something like put all the libraries with cygwin and a notepad++ portable in the pendrive and compile my programs using the cygwin on the pendrive.

But how can I achieve this, what modifications I need to do on my code?

Edit:

To solve my problem I did the following:

Installed MinGW with MSYS in my PC;

Create a batch file (.bat) named startMinGW with the following code inside MinGW folder:

@echo off
mode con:cols=130 lines=50
path=%path%;%CD%\bin
path=%path%;%CD%\lib
path=%path%;%CD%\msys\1.0\bin
title MinGW Compiler
echo Ready!
cmd.exe /K

Execute the batch file to compile the following;

Compile freeglut 2.8.0 with MinGW, going in the root folder of freeglut and executing:

sh configure
make

Compile glew 1.9.0 with MinGW, going in the root folder of freeglut and executing:

make

Copied the .h files localized in the include folders of freeglut and glew, to the include folder of MinGW

Copied the .a, .dll, .la, .lai (I don't know if it's necessary to copy the .la and .lai files) files localized in the lib folders of freeglut and glew, to the lib folder of MinGW

Copied the folder C:\MinGW to my pendrive.

Now to compile an OpenGL program I just need to execute startMinGW from the pendrive and execute

g++ file.cpp -lopeng32 -lglu32 -lglut -lglew
like image 963
user1905910 Avatar asked Nov 12 '22 14:11

user1905910


1 Answers

The glut (or freeglut) lib is cross-platform. Why wouldn't you compile it on Windows ? Use a build generator (like CMake) to easily create your makefile on each platform and you're done.

like image 174
Jelly Avatar answered Dec 18 '22 10:12

Jelly