PDA

View Full Version : glGenTextures compiler error



nuudoo
11-03-2000, 02:59 AM
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

Bob
11-03-2000, 03:54 AM
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)

nuudoo
11-03-2000, 06:07 AM
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.

DFrey
11-03-2000, 06:38 AM
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.

nuudoo
11-03-2000, 06:45 AM
Originally posted by DFrey:
First off, did you include gl.h?


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

DFrey
11-03-2000, 07:52 AM
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?

nuudoo
11-03-2000, 08:00 AM
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("\temp\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? http://www.opengl.org/discussion_boards/ubb/confused.gif

DFrey
11-03-2000, 08:09 AM
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).]

nuudoo
11-20-2000, 06:06 AM
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");

nuudoo
11-20-2000, 06:13 AM
Well, in fact I haven't the file glu32.lib in my computer.
How can I get it?

nuudoo
11-20-2000, 06:16 AM
Well, in fact I haven't the file glu32.lib in my computer.
How can I get it?

Michael Steinberg
11-20-2000, 06:19 AM
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.

nuudoo
11-20-2000, 06:40 AM
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?

Michael Steinberg
11-20-2000, 06:53 AM
I've got no ****ing idea where to find them, but I can send them to you, if you're using VC++ 6

nuudoo
11-20-2000, 07:11 AM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif 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?

DFrey
11-20-2000, 07:39 AM
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).]

nuudoo
11-20-2000, 07:56 AM
Thank you all http://www.opengl.org/discussion_boards/ubb/smile.gif. 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 http://www.opengl.org/discussion_boards/ubb/biggrin.gif)

nuudoo
11-21-2000, 02:29 AM
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" http://www.opengl.org/discussion_boards/ubb/frown.gif

DFrey
11-21-2000, 03:54 AM
Borlands free 5.5 compiler comes with all the libraries and headers. http://www.borland.com/bcppbuilder/freecompiler/cppc55steps.html