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); 1 2905
<- Chameleon -> wrote: 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("glCompressedTexImage2DA RB"));
//use function glCompressedTexImage2DARB(GL_TEXTURE_2D, z, dxt_f, width, height, 0, size, (byte*) tex + offset);
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Rob Somers |
last post by:
Hey people,
I read a good thread on here regarding the reason why we use function
prototypes, and it answered most of my questions, but I wanted to
double check on a couple of things, as I am...
|
by: Telmo Costa |
last post by:
Hi. I have the following code:
--------------------------------------
function Tunnel() {
//arguments(???);
}
function Sum() {
var sum = 0;
for (i=0; i<arguments.length; i++) sum +=...
|
by: Matt Kruse |
last post by:
Perl's map() function is a powerful shortcut to accomplish many "loop over
an array and do X" operations.
Below is a quick hack to simulate similar functionality.
I've used it a few times and find...
|
by: Beta What |
last post by:
Hello,
I have a question about casting a function pointer. Say I want to make
a generic module (say some ADT implementation) that requires a function
pointer from the 'actual/other modules'...
|
by: Jeff Stewart |
last post by:
I've been working with the JavaScript Shell in Firefox on a
mad-scientist problem I've had in my head. Assume a function named
'object' that is designed to create an object based on a prototype...
| |
by: Christian Christmann |
last post by:
Hi,
in a benchmark I've found an uncommon use of a function.
This is the simplified form:
1 int foo( int f )
2 {
3 return f;
4 }
5
|
by: Larax |
last post by:
Best explanation of my question will be an example, look below at this
simple function:
function SetEventHandler(element)
{
// some operations on element
element.onclick =
function(event)
{
|
by: Daz |
last post by:
Hi everyone.
My query is very straight forward (I think).
What's the difference between
someFunc.blah = function(){ ; }
and
|
by: wkerplunk |
last post by:
Below is what I have build with several different languages. It works great but I need help, I am stuck.
When you click on an item in the dropdown autocomplete div it does a mousedown function...
|
by: hzgt9b |
last post by:
I know how to overwrite a function. Normally this is what I would do:
function someFunction() { /* orig definition here */ }
//later in the execution stream I would do...
someFunction = function...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |