Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

csg objects with projection shadow

Posted on 2006-12-01
1
Medium Priority
?
327 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 200 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

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 …
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…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

773 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