Open Asset Import Library(assimp) 를 이용해서 blender를 읽어오고 openGL로 그릴수 있는 것으로 보인다.
Features
|
[링크 : https://sourceforge.net/projects/assimp/]
Assimp::Importer importer; const aiScene *scene = importer.ReadFile(filename,aiProcessPreset_TargetRealtime_Fast); aiMesh *mesh = scene->mMeshes[0]; //assuming you only want the first mesh float *vertexArray; float *normalArray; float *uvArray; int numVerts; next extract the data numVerts = mesh->mNumFaces*3; vertexArray = new float[mesh->mNumFaces*3*3]; normalArray = new float[mesh->mNumFaces*3*3]; uvArray = new float[mesh->mNumFaces*3*2]; for(unsigned int i=0;i<mesh->mNumFaces;i++) { const aiFace& face = mesh->mFaces[i]; for(int j=0;j<3;j++) { aiVector3D uv = mesh->mTextureCoords[0][face.mIndices[j]]; memcpy(uvArray,&uv,sizeof(float)*2); uvArray+=2; aiVector3D normal = mesh->mNormals[face.mIndices[j]]; memcpy(normalArray,&normal,sizeof(float)*3); normalArray+=3; aiVector3D pos = mesh->mVertices[face.mIndices[j]]; memcpy(vertexArray,&pos,sizeof(float)*3); vertexArray+=3; } } uvArray-=mesh->mNumFaces*3*2; normalArray-=mesh->mNumFaces*3*3; vertexArray-=mesh->mNumFaces*3*3; |
[링크 : https://nickthecoder.wordpress.com/2013/01/20/mesh-loading-with-assimp/]
[링크 : https://stackoverflow.com/questions/35111681/make-a-model-in-blender-and-load-in-opengl]
'Programming > openGL' 카테고리의 다른 글
opengl glortho gluperspective (0) | 2023.08.28 |
---|---|
glReadPixels() 와 glUseProgram() (0) | 2022.11.17 |
openCV + openGL (0) | 2022.02.08 |
glMatrixMode() (0) | 2020.04.14 |
opengl superbible 3rd 리눅스 빌드 패키지 (0) | 2020.04.08 |