Solved

csg objects with projection shadow

Posted on 2006-12-01
1
321 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
game engine recommendation 3 729
Ruby, Python, Perl, nodeJS, JavaScript, AJAX, Jscript 2 228
Java3D Add Line to existing scene 1 210
PDF: Display my cards game? 8 137
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…
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

726 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