Newbie Help - Glut Render Call Back Function

Started by
3 comments, last by Wing_Zero 14 years, 4 months ago
I am currently trying to create a few simple simulations in C++ and PhysX for a project i'm working on, and whilst the simulations run perfectly fine at the moment, I am creating an additional box, that sits at the origin and that other boxes just seem to pass through. Any ideas why I'm getting an extra rendered box that doesn't obey the collision laws that i placed upon the other boxes? Sample code for the render actors within RenderCallBack is below: ..... // Render all actors int nbActors = gScene->getNbActors(); NxActor** actors = gScene->getActors(); while(nbActors--) { NxActor* actor = *actors++; // Render actor glPushMatrix(); float glMat[16]; actor->getGlobalPose().getColumnMajor44(glMat); glMultMatrixf(glMat); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glScalef (0.5,4.0,1.0); glutSolidCube(1.0); glPopMatrix(); } ....... Thanks!
Advertisement
Obvious question, perhaps: in your callback function, is nbActors the number you expect?

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Yeah, I understand where you might think that it's an obvious question, and to be honest I'm not sure if the number of Actors is correct.

When I run the simulation, which is expected to create a row of 10 boxes and drop them, the counter always indicates that there are 11 actors present.

Now the NxActors, does that include the ground plane? Because if not then i suppose I would just need to reduce the creation of actors by one count. I have tried that as well, but I still create that random box, and just produce one less box of the ones i want to create :(
I'm not familiar with PhysX (unfortunately). Can you access information about the actor from the actor pointer? That is, can you test if the actor is a box or a plane? Most collision systems have some method to set and get the category or type of a collision object.

If so, do that test in your render loop and skip the renders you don't want.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Hmmm...i'm not sure if you can do that test, i have posted the same question on a PhysX forum, so I may get an answer from them about that.

Thank you

This topic is closed to new replies.

Advertisement