Cube::Cube(dWorldID world, dSpaceID space, dReal width, dReal height, dReal depth, dReal mass) { body = dBodyCreate(world); geom = dCreateBox(space, width, height, depth); dMass m; dMassSetBox(&m, 1.0f, width, height, depth); dMassAdjust(&m, mass); dBodySetMass(body, &m); dGeomSetBody(geom, body); } ... ... Cube *cube = new Cube(world, space, 0.3, 0.3, 0.3, 1);
glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D,m_uiTexture); GLfloat afVertices[]= //todo...vertex arrays glVertexAttribPointer(vertexAttr2, 3, GL_FLOAT, GL_FALSE, 0, afVertices); glEnableVertexAttribArray(vertexAttr2); GLfloat afTexCoord[]=//todo...coordinates arrays glVertexAttribPointer(texCoordAttr2, 3, GL_FLOAT, GL_FALSE, 0, afTexCoord); glEnableVertexAttribArray(texCoordAttr2); GLfloat afNormals[]=//todo...normal arrays glVertexAttribPointer(normalAttr2, 3, GL_FLOAT, GL_FALSE, 0, afNormals); glEnableVertexAttribArray(normalAttr2); glUniform1i(textureUniform2, 0); //use texture unit 0 glDrawArrays(GL_TRIANGLES, 0, 36); glDisableVertexAttribArray(vertexAttr2); glDisableVertexAttribArray(normalAttr2); glDisableVertexAttribArray(texCoordAttr2);