# OpenGL Comparing opengl libraries like glut and others

This topic is 4253 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Well since i havent worked in some time in opengl or coding for any sort i was researching most stuff over again to get myself up to speed, so i was going to ask the community what are the common things now, i mean normaly i know most ppl use or used GLUT for easy opengl development but with all the lastest developments in hardware and such does GLUT has gone a bit outdated or is still good to use in big projects or complicated stuffs like new terrain rendering, images, effects and such? is there anything new to use beside the new shading language opengl got out, or still using the opengl library with part of the glsl and such is the best way to go?

##### Share on other sites
For the most part, people seem to have stopped using GLUT due to that fact that is outdated, no longer supported, and still hasn't been open-sourced by the developer.

##### Share on other sites
SDL is probably your best bet for an easy way to get back into opengl programming.

##### Share on other sites
GLUT-like Windowing, GUI, and Media Control toolkits

Quote:
 Original post by swordfish..., and still hasn't been open-sourced by the developer.

GLUT is open source, you can download the sorce code from here:http://www.opengl.org/resources/libraries/glut/

##### Share on other sites
That very page you link to contains the notice that

Quote:
 GLUT is not open source. Mark Kilgard maintains the the copyright. There are a number of newer and open source alternatives.

The source is available, but depending on what you define "open source" to be, this may or may not qualify. The source code itself prominently displays the notice:

Quote:
 /* This program is freely distributable without licensing fees and is provided without guarantee or warrantee expressed or implied. This program is -not- in the public domain. */

A cursory glance over the source distribution did not reveal more specific licensing information (its not under the GPL or LGPL, for example). Not being a lawyer or particularly familiar with licensing issues, I can only assume this means that, while you can look at, and recompile, the GLUT library, you aren't really allowed to change it and redistribute it or call it your own.

##### Share on other sites
GLFW is an alternative to SDL that might be worth looking into. Drew Benton did a a comparison between the two which seems to be down now. Here is the google cache.

##### Share on other sites
ty for all the inputs they are really helpfull, but in this case what about not using a library at all, just using the opengl and thats all

##### Share on other sites
in that case you will have to come up with the window interface and input system yourself.

To be honest, unless you have a specific reason for wanting todo that and all the work it requires I'd not bother and stick with one of the ones named above <pimp>or even take a look at my own window framework, which I admit is only Win32 compatible right now due to a lack of a linux box...</pimp>

##### Share on other sites
great ty i will see into one of this in any case any more inputs are welcome

##### Share on other sites
I run on a Mac, so comparissons come out slightly different.

First off, GLUT is an imediate down, it is antique at this point, and requiring you to hand control of your program to a never-returning main loop is just plain nasty.

SDL is quite nice, but window initialisation is very verbose, and I never use most of the other features (2D graphics, audio, etc.). It also lets you poll for input, and has full keyboard support (including international keyboards, and other mappings).

GLFW is almost perfect as a windowing enviroment, except for one small flaw: it doesn't let you prevent the window from being resized by the user when in windowed mode (or even constrain the resize to a fixed aspect ratio). This is a real pain, as none of my projects let the user randomly mess with the aspect ratio).

##### Share on other sites
umm nice, i wanted to know if i use sdl or other, would it be simple to port for different things, like mac, linux and others, i use windows so i know it will be usable in win, but what about the others?

##### Share on other sites
I'll have to collect my thoughts before responding this thread (as well as think about why I haven't updated my article yet), but -

Quote:
 Original post by swiftcoderGLFW is almost perfect as a windowing enviroment, except for one small flaw: it doesn't let you prevent the window from being resized by the user when in windowed mode (or even constrain the resize to a fixed aspect ratio). This is a real pain, as none of my projects let the user randomly mess with the aspect ratio).

Luckily this little flaw can be easily fixed (Win32):

1. Line 773 of win32_window.c contains the line: dwstyle |= WS_OVERLAPPEDWINDOW;

2. All you need to do is change it to use a window style that does not allow resizing. I used: dwstyle |= (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX);

If you want the new project, here it is. (The binary is in the _BIN folder, I used the 'nmake win32-msvc' command to build it, but there is also a VC7.1 project file if you need to compile it though VS and not via CL)

Here is a test project:
#include <stdlib.h>#include "glfw.h"#pragma comment ( lib, "Opengl32.lib" )#pragma comment ( lib, "glu32.lib" )#pragma comment ( lib, "GLFW.lib" )int main(int argc, char* argv[]){	if(glfwInit() != GL_TRUE)	{		return -1;	}	if(glfwOpenWindow(640, 480, 0, 0, 0, 0, 0, 0, GLFW_WINDOW) != GL_TRUE )	{		glfwTerminate();		return -1;	}	glMatrixMode(GL_PROJECTION);	glLoadIdentity();	glFrustum(.5, -.5, -.5 * ((float)480.0f) / 640.0f, .5 * ((float)480.0f) / 640.0f, 1, 50);	glMatrixMode(GL_MODELVIEW);	while(glfwGetWindowParam(GLFW_OPENED) && !glfwGetKey(GLFW_KEY_ESC))	{		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);		glLoadIdentity();		/****************************************/		glTranslatef(0, 0, -5);		glColor3f(0.5f, 0.5f, 1.0f);		glBegin(GL_QUADS);			glVertex3f(-1.0f, 1.0f, 0.0f);			glVertex3f( 1.0f, 1.0f, 0.0f);			glVertex3f( 1.0f,-1.0f, 0.0f);			glVertex3f(-1.0f,-1.0f, 0.0f);		glEnd();		/****************************************/		glfwSwapBuffers();	}	glfwTerminate();	return 0;}

And a screenshot, which shows how there is no resize window style any more (or maximize either)

##### Share on other sites
Quote:
Original post by Drew_Benton
Quote:
 Original post by swiftcoderGLFW is almost perfect as a windowing enviroment, except for one small flaw: it doesn't let you prevent the window from being resized by the user when in windowed mode (or even constrain the resize to a fixed aspect ratio). This is a real pain, as none of my projects let the user randomly mess with the aspect ratio).

Luckily this little flaw can be easily fixed (Win32):

Thanks for that, but I really don't wan't to mod someone elses source for each platform.

##### Share on other sites
thank you so much everyone for all the post

##### Share on other sites
Quote:
 Original post by Odin1985Well since i havent worked in some time in opengl or coding for any sort i was researching most stuff over again to get myself up to speed, so i was going to ask the community what are the common things now, i mean normaly i know most ppl use or used GLUT for easy opengl development but with all the lastest developments in hardware and such does GLUT has gone a bit outdated or is still good to use in big projects or complicated stuffs like new terrain rendering, images, effects and such? is there anything new to use beside the new shading language opengl got out, or still using the opengl library with part of the glsl and such is the best way to go?

I use SDL. GLUT is terribly outdated and a bit rubbish anyway. About the only thing it has over SDL is that it can display multiple windows. Its keyboard handling totally sucks, though, and renders it effectively useless for games, as far as I'm concerned. Freeglut is a little better in this regard, but still won't report the use of interesting keys like control or shift (there's glutGetModifiers, but that can only be used when you're pressing another key or mouse button -- you can't simply respond to the user tapping the control key).
Quote:
Original post by Kambiz
Quote:
 Original post by swordfish..., and still hasn't been open-sourced by the developer.

GLUT is open source, you can download the sorce code from here:http://www.opengl.org/resources/libraries/glut/

From that very page:
Quote:
 GLUT is not open source. Mark Kilgard maintains the the copyright. There are a number of newer and open source alternatives.

• ### Similar Content

• By xhcao
Does sync be needed to read texture content after access texture image in compute shader?
My simple code is as below,
glUseProgram(program.get());
glBindImageTexture(0, texture[0], 0, GL_FALSE, 3, GL_READ_ONLY, GL_R32UI);
glBindImageTexture(1, texture[1], 0, GL_FALSE, 4, GL_WRITE_ONLY, GL_R32UI);
glDispatchCompute(1, 1, 1);
// Does sync be needed here?
glUseProgram(0);
GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, texture[1], 0);
glReadPixels(0, 0, kWidth, kHeight, GL_RED_INTEGER, GL_UNSIGNED_INT, outputValues);

Compute shader is very simple, imageLoad content from texture[0], and imageStore content to texture[1]. Does need to sync after dispatchCompute?

• My question: is it possible to transform multiple angular velocities so that they can be reinserted as one? My research is below:

• I have this code below in both my vertex and fragment shader, however when I request glGetUniformLocation("Lights[0].diffuse") or "Lights[0].attenuation", it returns -1. It will only give me a valid uniform location if I actually use the diffuse/attenuation variables in the VERTEX shader. Because I use position in the vertex shader, it always returns a valid uniform location. I've read that I can share uniforms across both vertex and fragment, but I'm confused what this is even compiling to if this is the case.

#define NUM_LIGHTS 2
struct Light
{
vec3 position;
vec3 diffuse;
float attenuation;
};
uniform Light Lights[NUM_LIGHTS];

• By pr033r
Hello,
I have a Bachelor project on topic "Implenet 3D Boid's algorithm in OpenGL". All OpenGL issues works fine for me, all rendering etc. But when I started implement the boid's algorithm it was getting worse and worse. I read article (http://natureofcode.com/book/chapter-6-autonomous-agents/) inspirate from another code (here: https://github.com/jyanar/Boids/tree/master/src) but it still doesn't work like in tutorials and videos. For example the main problem: when I apply Cohesion (one of three main laws of boids) it makes some "cycling knot". Second, when some flock touch to another it scary change the coordination or respawn in origin (x: 0, y:0. z:0). Just some streng things.
I followed many tutorials, change a try everything but it isn't so smooth, without lags like in another videos. I really need your help.
My code (optimalizing branch): https://github.com/pr033r/BachelorProject/tree/Optimalizing
Exe file (if you want to look) and models folder (for those who will download the sources):
http://leteckaposta.cz/367190436
Thanks for any help...

• By Andrija
I am currently trying to implement shadow mapping into my project , but although i can render my depth map to the screen and it looks okay , when i sample it with shadowCoords there is no shadow.
Here is my light space matrix calculation
mat4x4 lightViewMatrix; vec3 sun_pos = {SUN_OFFSET * the_sun->direction[0], SUN_OFFSET * the_sun->direction[1], SUN_OFFSET * the_sun->direction[2]}; mat4x4_look_at(lightViewMatrix,sun_pos,player->pos,up); mat4x4_mul(lightSpaceMatrix,lightProjMatrix,lightViewMatrix); I will tweak the values for the size and frustum of the shadow map, but for now i just want to draw shadows around the player position
the_sun->direction is a normalized vector so i multiply it by a constant to get the position.
player->pos is the camera position in world space
the light projection matrix is calculated like this:
uniform mat4 light_space_matrix; void main() { gl_Position = light_space_matrix * transfMatrix * vec4(position, 1.0f); } Shadow fragment shader:
out float fragDepth; void main() { fragDepth = gl_FragCoord.z; } I am using deferred rendering so i have all my world positions in the g_positions buffer