Solved

csg objects with projection shadow

Posted on 2006-12-01
1
318 Views
Last Modified: 2013-12-06
Hi everyone,
i am trying to make a csg objects with projection shadow
and i got some little problem


it say that the followin line is

glutAddMenuEntry("CSG_A_AND_B", and(cone, sphere));


warning C4047: 'function' : 'void (__cdecl *)(void)' differs in levels of indirection from 'GLUquadricObj *'
cwarning C4047: 'function' : 'void (__cdecl *)(void)' differs in levels of indirection from 'GLUquadricObj *'
error C2095: 'glutAddMenuEntry' : actual parameter has type 'void' : parameter 2
 error C2198: 'glutAddMenuEntry' : too few arguments for call through pointer-to-function

"and" is definded like that:

/* "and" two objects together */
void
and(void (*a) (void), void (*b) (void))
{
  firstInsideSecond(a, b, GL_BACK, GL_NOTEQUAL);

  fixDepth(b);

  firstInsideSecond(b, a, GL_BACK, GL_NOTEQUAL);

  glDisable(GL_STENCIL_TEST);  /* reset things */
}


so that is the problem?

regards,
kimos


0
Comment
Question by:kimos123
1 Comment
 
LVL 22

Accepted Solution

by:
NovaDenizen earned 100 total points
ID: 18055681
From looking at the glutAddMenuEntry docs  ( http://www.opengl.org/resources/libraries/glut/spec3/node39.html ), you're supposed to pass an integer code as the second parameter.  Instead, you're calling a void function and trying to pass the void value into glutAddMenuEntry's second parameter.  That's a valid construct in certain functional languages, but not in C.

The code should instead look something like this:

#define MY_A_AND_B_CODE 1234
....
void myMenuCallbackFunction(int);
glutCreateMenu(myMenuCallbackFunction);
glutAddMenuEntry("CSG_A_AND_B", MY_A_AND_B_CODE);
....


void myMenuCallbackFunction(int menucode) {
    switch(menucode) {
       ....
        case MY_A_AND_B_CODE:
            and(cone, sphere);
            break;
       ....
    }
}
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question