Hello,
I am trying to make a game using OpenGL and Box2D. However, I am having trouble trying to use Box2D as the physics engine with my OpenGL application, I dunno how to port it to OpenGL.. Hope somebody could tell me how to do it.. Thanks in advance..
You don't really have to port it to OpenGL. You simply have to setup Box2D working normally, then use information from the bodies (such as vertices, GetPosition, GetAngle, etc) to draw it to the screen using OpenGL. The information you need to draw it may vary based on the type of shape you want to draw (shapes may be more complex to draw than squares, for example).
yea.. but i have no idea how to map texture onto the physics objects... usually i use the testbed to do the physic but now i am going to do it without the testbed.. so i have no idea how to do it.. I would really appreciate it if someone could help..
You don't apply textures to physics objects. Your physics world and the items that you are drawing are separate. When you build your physics world, each body in the world will have a position in the world. You can draw your sprites with opengl, and then every frame move them to the correct position based on where the corresponding physics body exists in the box2d world.
hi, I've just looked at this thread, however I have found that although eveything you've said makes sense it have been extremely difficult for me to actually use this in c++ could anybody give any advice/source code to help begin using opengl with box2d
please?
thanks