c++ - Creating and using AABB for collision detection 3d (OpenGL) -


suppose have square have created in following way:

glbegin(gl_quads); glcolor3f(0.0f,1.0f,0.0f);   glvertex3f( 1.0f, 1.0f,-1.0f);   glvertex3f(-1.0f, 1.0f,-1.0f);   glvertex3f(-1.0f, 1.0f, 1.0f);   glvertex3f( 1.0f, 1.0f, 1.0f);    glcolor3f(1.0f,0.5f,0.0f);   glvertex3f( 1.0f,-1.0f, 1.0f);   glvertex3f(-1.0f,-1.0f, 1.0f);   glvertex3f(-1.0f,-1.0f,-1.0f);   glvertex3f( 1.0f,-1.0f,-1.0f);    glcolor3f(1.0f,1.0f,0.0f);   glvertex3f( 1.0f,-1.0f,-1.0f);   glvertex3f(-1.0f,-1.0f,-1.0f);   glvertex3f(-1.0f, 1.0f,-1.0f);   glvertex3f( 1.0f, 1.0f,-1.0f);    glcolor3f(0.0f,0.0f,1.0f);   glvertex3f(-1.0f, 1.0f, 1.0f);   glvertex3f(-1.0f, 1.0f,-1.0f);   glvertex3f(-1.0f,-1.0f,-1.0f);   glvertex3f(-1.0f,-1.0f, 1.0f);    glcolor3f(1.0f,0.0f,1.0f);   glvertex3f( 1.0f, 1.0f,-1.0f);   glvertex3f( 1.0f, 1.0f, 1.0f);   glvertex3f( 1.0f,-1.0f, 1.0f);   glvertex3f( 1.0f,-1.0f,-1.0f);   glend();     

now suppose want use aabb structure detect when sphere collides sides of cube (not top nor bottom of cube) , prevent going through cube? ideas on how go doing this?

also able use aabb structure if had implemented cube using glutsolidcube?

also there easier of detecting collision without having use aabb? maybe testing intersection or that?

opengl rendering system. has no notion of collision detection or objects beyond basic rendering primitives (points/lines/triangles). opengl not going collision detection. need use physics or collision library that.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -