Solved

csg objects with projection shadow

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
word search puzzle 2 1,117
Better, easier way to manage animation? 2 243
Any good game free GIF sites? 2 126
old35  java challenge 4 106
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 …
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.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

758 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

21 Experts available now in Live!

Get 1:1 Help Now