Solved

csg objects with projection shadow

Posted on 2006-12-01
1
316 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
A short film showing how OnPage and Connectwise integration works.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

914 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now