glGenTextures compiler error

Hello :

I have a question. I want to use textures but my compiler says :
“Call to undefined function ‘glGenTextures’”
“Call to undefined function ‘glBindTexture’”

I tried with
“PROC glGenTextures = wglGetProcAddress( “glGenTextures” );”
But then compiler says “Extra parameter in call.”

Please, ¿Could anybody help me?.My e-mail : ccastro@rslcom.es
Thanks:
Carlos

You are doing everything right, except that you don’t declare glGenTextures as a functionpointer with proper number and types of arguments.

You need to declare glGenTextures, for example, as a pointer to a function that takes first an unsigned integer, and then a pointer to an array of unsigned integers. That is what the function looks like. Same with glBindTextures, but with other types/numbers of arguments.

Here the prototypes for each of the two functions you mention:
void glGenTextures(GLsizei n,GLuint * textures)
void glBindTexture(GLenum target, GLuint texture)

Originally posted by Bob:
You are doing everything right, except that you don’t declare glGenTextures as a functionpointer with proper number and types of arguments.

Thank you Bob, but how can I do that?. The pieze of code :

void (*glGenTextures)(GLsizei n, GLuint * textures);
glGenTextures = wglGetProcAddress( “glGenTextures” );

does not work.

First off, did you include gl.h?
If you are implicitly loading the library you should not need to get the address of any functions except for the extensions.
The only time you would need to get the procedure address is if you are explicitly loading the opengl library dynamically. And then you should use GetProcAddress rather than wglGetProcAddress. Use wglGetProcAddress only to get extension procedure addresses.

Originally posted by DFrey:
First off, did you include gl.h?

Yes :
#include <gl\gl.h>
And compiler says : Call to undefined function ‘glGenTextures’.
(??)

Are you loading the library implicitly or explicitly? That is, are you using LoadLibrary to explicitly load the opengl library? Or are you letting windows link it implicitly?

Originally posted by DFrey:
Are you loading the library implicitly or explicitly? That is, are you using LoadLibrary to explicitly load the opengl library? Or are you letting windows link it implicitly?

I am not using LoadLibrary, these are my includes :

#include <windows.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glaux.h>
#include <vcl.h>
USELIB(" emp\TUTORI~1\COPIAD~1\glaux.lib");

after these lines begin my global variables.
Functions like “glBegin(GL_TRIANGLES);” or “glLoadIdentity()” works fine.
Must I add another include?

Ok if you are linking to the library implicitly, I’m curious then as to why you were trying to get the procedure address for glGenTextures. Did you have to get the procedure address of glBegin before it would work? You shouldn’t have to since glBegin and glGenTextures are both declared in gl.h and then defined by the implicit linkage. Are you adding in the glu32.lib and opengl32.lib?

[This message has been edited by DFrey (edited 11-03-2000).]

Originally posted by DFrey:
Are you adding in the glu32.lib and opengl32.lib?

How may I add in the glu32.lib and opengl32.lib?.
This don’t work :
USELIB(“glu32.lib”);
USELIB(“opengl32.lib”);

Well, in fact I haven’t the file glu32.lib in my computer.
How can I get it?

Well, in fact I haven’t the file glu32.lib in my computer.
How can I get it?

All gl* functions should be “defined” in opengl32.lib, glu* in glu32.lib. Either you are using a very old version of the opengl build, or I don’t know. Are you sure you’ve got Opengl 1.1 libraries? glGenTextures is included, you don’t have to link to it yourself.

Originally posted by Michael Steinberg:
Are you sure you’ve got Opengl 1.1 libraries?.

I don’t know which is my Opengl version. Where can I get the Opengl 1.1 libraries?

I’ve got no ****ing idea where to find them, but I can send them to you, if you’re using VC++ 6

Originally posted by Michael Steinberg:
I’ve got no ****ing idea where to find them, but I can send them to you, if you’re using VC++ 6

I am using Borland C++ Buider…
I tried to open opengl32.lib with notepad and I found the name of all the gl* functions, but the string “glGenTextures” does not appear, so I think the problem was a very old version of opengl after all.
Somebody know where can I download the files for Borland C++ Builder?

You can get Borlands free 5.5 compiler from Borland’s webpage. It comes with those libs, although I don’t know how old they are.

[This message has been edited by DFrey (edited 11-21-2000).]

Thank you all . I will look for those libs (opengl32.lib and glu32.lib) through the web (unless if someone could send me the files via e-mail )

I found a way to get a Borland .lib file from a dll.

In a ms-dos shell type :
impdef opengl32.def opengl32.dll
implib opengl32.lib opengl32.def
del opengl32.def
implib glu32.lib glu32.dll

but I still need an updated version for Borland’s gl.h
I tried to define the new functions in gl.h:
WINGDIAPI void APIENTRY glGenTextures (GLsizei n, GLuint * textures);
WINGDIAPI void APIENTRY glBindTexture (GLenum target, GLuint texture);
but compiler said “unable to open file UUID.lib”

Borlands free 5.5 compiler comes with all the libraries and headers. http://www.borland.com/bcppbuilder/freecompiler/cppc55steps.html