I was just wondering whether there is a way to apply bullet physics to opengl drawn objects (created using glVertex3f or triangle mesh with glVertexAttribPointer). I am currently using jogl and jbullet to apply physics to my 3D objects. Specifically if I give a buffer of vertices for a triangle mesh shape for the 3d object. I need Bullet to create a CollisionShape based on the triangle mesh shape, and apply the physics to it, which at the same time apply physics to the drawn opengl objects. At the moment, the physical collision shape may move (in bullet), but the drawn opengl shape is not.
Otherwise, can I create a collision shape, get the vertices of the collision shape after the physics has been applied after each simulation step, and then draw the object based on the location of the vertices. I have looked at the Hello world example for bullet but it only help me apply physics on the position of the opengl object (based on the z,y,x axis_ and not cool things like for example a corner of the cube hitting a plane starts rolling and spinning.
It would be great if someone can give me some code or demo that can do this. Or give me some hints as to how I can make this work. I already looked at this tutorial on bullet: http://www.raywenderlich.com/53077/bullet-physics-tutorial-getting-started. But I can't seem to find the information to how bullet is applied to opengl objects.
After you downloaded Bullet Physics SDK, look the file GL_ShapeDrawer.cpp,you will find some interresting functions such like drawSphere, drawCylinder,drawOpenGl.. the last one i mentionned lets you draw any type of suported shape :
Each type of shape from shape->getShapeType() has its own dedicated function for rendering with opengl
But my method involves to
Personnaly, i'm using Irrlicht because Irrlicht is the "write less,do more" solution of opengl :p