Does My Graphics Card Support OpenGL 4.0?

Hello and thank you all! I'm trying to create applications using openGL 4.0, but a certain line in my code is giving me trouble:
 
glutInitContextVersion(4, 0);

I could not for the life of me figure this out.
I have an ATI Radeon HD 4200 series.
I already updated my drivers, but to no avail.
Do I also need to somehow download and install openGL 4.0?
Last edited on
http://www.opengl.org/discussion_boards/showthread.php/181568-I-need-help-upgrading-OpenGl

If you've upgraded your drivers and your card still doesn't support openGL 4.0 then all you can do is buy a new graphics card.

and according to AMD your card only has
OpenGL 3.2 support

http://www.amd.com/us/products/desktop/graphics/ati-radeon-hd-4000/ati-radeon-hd-4200/Pages/ati-radeon-hd-4200-specificatications.aspx
Last edited on
Thanks a lot. I wonder why I can use 3.3 though. Either way, I have a more pressing question.
Correct me if I am wrong in any of the below.
As I understand it, openGL is a low-level, abstract API (list of methods) used to communicate with the graphics hardware. Basically, it is an interface. And it is implemented by the vendors who create the hardware. And it is very basic. As a result, there are libraries that implement the basic methods of the openGL API to create more complex graphics. Examples include freeglut and glew.
Now, I am following this tutorial: http://openglbook.com/the-book/chapter-1-getting-started/
My question is basic. We never import openGL. Like, #include <openGL.h>
What is going on?
Yep, the scheme looks like:

You -> OpenGL -> Vendor Drivers -> Hardware

For the question:
It's either:
1. You link in the project options
2. The libraries you use ALREADY link to opengl
or
3. You're using visual studio and sone include file is #pragma lib'ing it for you

EDIT: Sorry, for import I thought link.

About inclusions, it's the point 2:

The libraries you're using may be including opengl.h (They should, as they require opengl.h to work!)
Last edited on
I'm using MSVS, but I don't completely understand

"include file is #pragma lib'ing it for you"

I'm also experiencing a strange problem. Here is my full program:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include <GL\glew.h>
#include <GL\freeglut.h>
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <string.h>

#define WINDOW_TITLE_PREFIX "Chapter 1"

using namespace std;

int CurrentWidth = 800,
	CurrentHeight = 600,
	WindowHandle = 0;

void Initialize(int, char*[]);
void InitWindow(int, char*[]);
void ResizeFunction(int, int);
void RenderFunction(void);

int main(int argc, char* argv[])
{
	Initialize(argc, argv);
	char ch;
	cin >> ch;
	exit(2);
}

void Initialize(int argc, char* argv[])
{
	InitWindow(argc, argv);

	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

	fprintf(
		stdout,
		"INFO: OpenGL Version: %s\n",
		glGetString(GL_VERSION)
	);

}

void InitWindow(int argc, char* argv[])
{
	glutInit(&argc, argv);

	glutInitContextVersion(3, 2);
	glutInitContextFlags(GLUT_FORWARD_COMPATIBLE);
	glutInitContextProfile(GLUT_CORE_PROFILE);

	glutSetOption(
		GLUT_ACTION_ON_WINDOW_CLOSE,
		GLUT_ACTION_GLUTMAINLOOP_RETURNS
	);

	glutInitWindowSize(CurrentWidth, CurrentHeight);

	glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);

	WindowHandle = glutCreateWindow(WINDOW_TITLE_PREFIX);

	if(WindowHandle < 1){
		cout << "Error";
		exit(3);
	}

	glutReshapeFunc(ResizeFunction);
	glutDisplayFunc(RenderFunction);
}

void ResizeFunction (int Width, int Height)
{
	CurrentWidth = Width;
	CurrentHeight = Height;
	glViewport(0, 0, CurrentWidth, CurrentHeight);
}

void RenderFunction(void)
{
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	glutSwapBuffers();
	glutPostRedisplay();
}


The window opens but when I put my cursor over it (including the control bar) I get the loaded icon for my cursor. Additionally, the page is white.
Can someone see if this code works for them? Or is that what its suppose to do?
Last edited on
Well it makes sense that your page is white, your void RenderFunction(void) function is just clearing the colour and depth buffers, you're not actually rendering anything.
Try adding
1
2
3
4
5
6
7
	glBegin(GL_QUADS);
	glColor3f(0,0.2,0.6);
	glVertex3f(0,0,0);
	glVertex3f(0,1,0);
	glVertex3f(1,1,0);
	glVertex3f(1,0,0); 
	glEnd();

right after glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
and see if you get anything.
//EDIT: Changed the verticies around so that the square was actually shaped like a square :P
Last edited on
Just giving you a hint, it seems only AMD HD5xxx begin to support OpenGL4.0.
I'm pretty lucky that, even when I didn't know this, I switched from my 4350 to my 5450 last year.
So... you ARE getting the same white page? Good.
I got worried because the sample image here: http://openglbook.com/the-book/chapter-1-getting-started/ shows a black page.
And in the code, we do some funky background stuff 0.0f, 0.0f, 0.0f, which means black. But I guess somehow we are overwriting that.
Would anyone who is experienced mind quickly skimming through this guide I linked above and tell me if it is good or bad? I'd really appreciate it.
EDIT: You're missing glutMainLoop, after Initialize(argc, argv), in function main.

Your code:
1
2
3
4
5
6
7
int main(int argc, char* argv[])
{
	Initialize(argc, argv);
	char ch;
	cin >> ch;
	exit(2);
}


On the website:
1
2
3
4
5
6
int main(int argc, char* argv[])
{
    Initialize(argc, argv);
    glutMainLoop();
    exit(EXIT_SUCCESS);
}


glutMainLoop is what will make your rendering actions begin.
Otherwise, glut will only be initialized and not used in your program.
Last edited on
Ahh, thanks so much and sorry for the late reply!
My face is red... sorry.
I'd still appreciate if someone could tell me if the guide is good. Rather, if someone reads this, I have a question.
Where is openGL located on my computer? So that I can include the folders myself?
I have OCD about this stuff and it kills me not to know what is going on under the hood. I mean, I don't remember downloading openGL library and I can't find any openGL library in the glew and openGLUT folders.
The guide didn't make this mistake :d

Most of times the OpenGL library/include directories are already setup, but if you insist, you should obviously search for opengl.h, because it depends on the compiler you are using.

About glew and glut, you should create a folder where you will store all used libraries and put them inside.

The default set-up includes:

A. Include files
B. Library files
C. (Optional) DLL Files
D. (Optional) Source Code

If you don't have the B, you need the D (pun intended?) and you also need to compile it by yourself (not your case tho).

Once you have A and B (and C?), in your project/compiler settings you must set up a new include path, pointing to folder A, and set up a new library path, pointing to folder B.

If you have the C, you need to put them where your program will run, also when you redistribute it you will need to distribute the DLL's too (and the license files).

Done this you only need to link to GLUT (as your guide may say/explain) and begin programming.

This is one-time or per-project setting, depending on your IDE.

Anymore infos?
Post another reply, and specify which IDE you're using, that will make things easy.
Topic archived. No new replies allowed.