PDA

View Full Version : errors at compilation



airseb
05-25-2005, 02:19 PM
Hi,
i have written this :

hvs = CreateShader(VERTEX_SHADER);

and my errors are :
error C2065: 'CreateShader' : undeclared identifier
error C2065: 'VERTEX_SHADER' : undeclared identifier

I have the latest drivers for my ATI card (it works perfectly with render monkey), i don't understand because i have read this in the opengl 2.0 specs
can you help me ?

Humus
05-25-2005, 02:29 PM
Try glCreateShader and GL_VERTEX_SHADER. And of course, make sure you have setup all function pointers and so on.
Personally, I never understood the point of excluding the GL_ and gl from all names and enums in the spec.

airseb
05-25-2005, 02:37 PM
it works for GL_VERTEX_SHADER but not with glCreateShader. :-(
what do you mean by "setup all function pointers and so on" ?

sqrt[-1]
05-25-2005, 02:37 PM
Try glCreateShader and GL_VERTEX_SHADER

You sure you have the latest headers and are using someting like GLee/Glew?

airseb
05-25-2005, 02:39 PM
about the headers, i just use glext.h

Overmind
05-26-2005, 02:44 AM
Anything above OpenGL 1.1 should be accessed with the extension loading mechanism. On Windows you don't have a choice, and on Linux it is still better not to statically link to the functions.

On Windows the extension loading works like this:

PFNGLCREATESHADERPROC glCreateShader;
glCreateShader = wglGetProcAddress("glCreateShader");Be sure to check the version string for OpenGL 2.0 support before you do this.

Alternatively you could use glew or a similar extension loading library...

airseb
05-26-2005, 04:49 AM
ok, thanks guys

Sunray
05-26-2005, 02:48 PM
Hi, you may also check out GLEW, glew.sourceforge.net. It does a wonderful job of loading extensions.

diegor
05-27-2005, 02:47 AM
Hi,
Another possibility much better (I think) than the glGetProcAddress(...) and the glew library, is to use the static library of ATI (which work also for other vendor hardware, unless you use ATI extensions).
You can dowload them on the ATI web side (just downloading a "sample project")

you have just to link
extsetup.lib
to your project

and write
#include "extsetup.h"
in your source

It is better than glGetProcAddress because it's very painful to write this "linkage" section for each extensions.
In my opinion is also better than the glew because is released by an official OpenGL vendor and it is straightforward to use (of course you can think different).

At the Setup phase, in your source, you have just to write

SetupGL1_4();

or another version.
To load specific extensions:

SetupARBExtensions();
SetupEXTExtensions();
SetupATIExtensions();

Diego

airseb
05-27-2005, 04:06 AM
ok thanks for your tips :D