 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Fri Feb 27, 2004 10:52 pm Post subject: function prototype |
|
|
When I use 1st line in prototypes, compiler fails because SDL_GL_GetProcAddress return (void*)
When I use 2nd line in prototypes, compiler fails in last line because (void*) is not a function prototype.
So, what cast I must use?
Can you rewrite these 3 lines correctly?
With 1st line in prototypes, I used:
glCompressedTexImage2DARB =
(void (*glCompressedTexImage2DARB)
(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void*))
SDL_GL_GetProcAddress("glCompressedTexImage2DARB");
but it does not work
-------------------------------------------------------------------------
//prototypes
void (*glCompressedTexImage2DARB) (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void*);
//void *glCompressedTexImage2DARB;
//load function
glCompressedTexImage2DARB = SDL_GL_GetProcAddress("glCompressedTexImage2DARB");
//use function
glCompressedTexImage2DARB(GL_TEXTURE_2D, z, dxt_f, width, height, 0, size, (byte*) tex + offset);
|
|
| Back to top |
|
 |
red floyd Guest
|
Posted: Fri Feb 27, 2004 11:05 pm Post subject: Re: function prototype |
|
|
<- Chameleon -> wrote:
| Quote: | When I use 1st line in prototypes, compiler fails because SDL_GL_GetProcAddress return (void*)
When I use 2nd line in prototypes, compiler fails in last line because (void*) is not a function prototype.
So, what cast I must use?
Can you rewrite these 3 lines correctly?
With 1st line in prototypes, I used:
glCompressedTexImage2DARB =
(void (*glCompressedTexImage2DARB)
(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void*))
SDL_GL_GetProcAddress("glCompressedTexImage2DARB");
but it does not work
-------------------------------------------------------------------------
//prototypes
void (*glCompressedTexImage2DARB) (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void*);
//void *glCompressedTexImage2DARB;
//load function
glCompressedTexImage2DARB = SDL_GL_GetProcAddress("glCompressedTexImage2DARB");
|
glCompressedTexImage2DARB = reinterpret_cast<void (*)(GLenum ,GLint,
GLenum, Glsizei, const void
*)>(SDL_GL_GetProcAddress("glCompressedTexImage2DARB"));
| Quote: | //use function
glCompressedTexImage2DARB(GL_TEXTURE_2D, z, dxt_f, width, height, 0, size, (byte*) tex + offset);
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|