New OpenGL Versions

I have a couple questions before I begin programming in OpenGL.

I havn’t “updated” any OpenGL files or anything since the new version 2.1 and I’ve been searching for one. Do I have to upgrade my DLL or is the new version simply from the programming side of things? If so, then I assume I have to download some new OpenGL libraries if I want to program in it.

Also, when OpenGL 3.0 is released will it work on older hardware too? I have an IGP ATI card on a laptop.

Just to prevent an extra post, I’ll take the time to ask this other question here too. Is GLUT the best thing to use when making a OpenGL program? or is it/will it ever become obsolete? If so, what is the best utility (if there is one) to use?

Use GLEW to ease access to new OpenGL features, provided by your (up to date) video driver.
The opengl32.dll itself does not change.

It was said that GL3 will support older cards, I would guess everything that currently support GL2 with GLSL would be ok. It will depend on the driver updates done by the vendor however.

The “best thing” depends on the context. It is pretty good for quick demos, with a basic menu and events. Use FreeGLUT if you can, it is a more modern port, compatible with the original.

For something like a game or realtime effects with fullscreen etc, I prefer GLFW. A bit lower level, still easy to use, you get more control over screen refresh, vsync, keyboard and joystick events, etc. And some useful helper classes for loading textures or multithreading.

Is GLFW similar to GLUT.
In the sense that, say I learned glut first, would it be easy and fast to later switch to GLFW, or are they different by a lot?

Because, I am planning on using it for 3D apps so GLFW sounds good, but I found some excellent OpenGL tutorials at http://www.zeuscmd.com

glfw is pretty self-explanatory. no need to learn sth here :slight_smile:

so glfw is definitely faster than glut then? Because I don’t mind lower level, I just want as much speed on full-screen apps as possible.

and if it is I think I’ll just start with glfw then found some tutorials for it :slight_smile:

so glfw is definitely faster than glut then?

Sorry no offense but this line is so naive, I have to laugh … LOL ! thanks.
In fact you will not notice a difference in speed. The difference can come from a different graphic card, not really from which lib you use.

It is more a question of control, and the purpose of the lib. for example, glut in fullscreen force you to use the desktop resolution, so in your case GLFW is indeed more suitable because you can choose exaclty the resolution you want/need.

Look at the documentation provided with GLFW, there are 2 good PDF and a bunch of interesting samples from which you can develop whatever you need. The part specific to glut or glfw is not very important, so you can easily adapt tutorials.

happy coding :slight_smile:

I’m sorry if I am becoming annoying, but I just need to ask 1 more question.

Why is this code not working? It generates a black window and that’s it, it’s supposed to display a white triangle in the middle.

#include <GL/glfw.h>

void draw(){
	int width, height;
	double t;
	t = glfwGetTime();
	glfwGetWindowSize(&width, &height);
	height = height < 1 ? 1 : height;
	glViewport(0, 0, width, height);
	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluPerspective(65.0, (double)width / (double)height, 1.0, 100.0);
	
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	gluLookAt(
		0.0, 0.0, 0.0,
		0.0, 0.0, 0.0,
		0.0, 1.0, 0.0);
		
      glBegin( GL_TRIANGLES );
		glVertex3f( -5.0f, -4.0f, 0.0f );
		glVertex3f(  5.0f, -4.0f, 0.0f );
		glVertex3f(  0.0f,  4.5f, 0.0f );
      glEnd();
}

int main(int argc, char** argv){
	int ok, running;
	
	glfwInit();
	
	ok = glfwOpenWindow(
		640, 480,
		8, 8, 8, 8,
		24,
		0,
		GLFW_WINDOW);
	
	if(!ok){
		glfwTerminate();
		return 0;
	}
	
	glfwSetWindowTitle("window");
	glfwEnable(GLFW_STICKY_KEYS);
	
	do{
		draw();
		glfwSwapBuffers();
		running = !glfwGetKey(GLFW_KEY_ESC) && glfwGetWindowParam(GLFW_OPENED);
	}while(running);
	glfwTerminate();
	
return 0;
}

If anyone can help I’d really appreciate it, thanx

No problem, you are not annoying, I was just amused by your sentence above, don’t worry :slight_smile:

About your problem, I guess it is simply that you set the visible part between near plane 1.0 and far plane 100.0 (with gluPerspective) : so your vertices with z=0.0 can not be seen. Try with a z = 10 or more, to push them farther from the camera.

PS: And set a distinct color before drawing, such as glColor3f(1.0,0.5,0.2); as I don’t remember if it defaults to black, or to white.

Read this section of OpenGL FAQ about blank window.

I added a color and I changed the z coordinate of the vertices to 15.0 but I still see nothing.

remove the glulookat, try glDisable(GL_CULL_FACE) maybe your triangle is considered backfacing : it depends if edges are specified clockwise or counter-clockwise, check the documentation for default values of glFrontFace etc :

http://www.opengl.org/sdk/docs/man/

By the way, your gluLookat call is ill defined. By setting the eye and object center to the same values you are causing a divide by zero. See here.

N.

I know there are a few things in that code that I don’t agree with however, It is the exact code taken off of a website:
http://glfw.sourceforge.net/

bet even so, I can’t figure out why it wouldn’t display anything…
Does the code work for anyone else?

No it’s not. Like I said, the code from the site has:

gluLookAt(                        // Set camera position and orientation
        0.0, 0.0, 10.0,               // Camera position (x,y,z)
        0.0, 0.0, 0.0,                // View point (x,y,z)
        0.0, 1.0, 0.0                 // Up-vector (x,y,z)
    );

while you have:

gluLookAt(                        // Set camera position and orientation
        0.0, 0.0, 0.0,               // Camera position (x,y,z)
        0.0, 0.0, 0.0,                // View point (x,y,z)
        0.0, 1.0, 0.0                 // Up-vector (x,y,z)
    );

N.

oh, lol
That did it.

Thanks for all of your help.