Jump to content
  • Advertisement
Sign in to follow this  
Wing_Zero

Newbie Help - Glut Render Call Back Function

This topic is 3119 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
Advertisement
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 :(

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!