Reputation: 157
I'm trying to use a different 3D object in Qt for this example: https://doc.qt.io/qt-5/qtdatavisualization-rotations-example.html I've tried to download obj files or to generate new ones using Blender. The example works with any other object present in the other Qt example, but not with Wavefront objects generate by Blender. I also tried a simple cube:
# Blender v2.78 (sub 0) OBJ File: ''
# www.blender.org
mtllib untitled.mtl
o Cube
v 0.910983 -0.851291 -0.981756
v 0.910983 -0.851291 1.018244
v -1.089017 -0.851291 1.018244
v -1.089016 -0.851291 -0.981756
v 0.910984 1.148709 -0.981755
v 0.910983 1.148709 1.018245
v -1.089017 1.148709 1.018244
v -1.089017 1.148709 -0.981756
vn 0.0000 -1.0000 0.0000
vn 0.0000 1.0000 -0.0000
vn 1.0000 -0.0000 0.0000
vn 0.0000 -0.0000 1.0000
vn -1.0000 -0.0000 -0.0000
vn 0.0000 0.0000 -1.0000
usemtl Material
s off
f 2//1 4//1 1//1
f 8//2 6//2 5//2
f 5//3 2//3 1//3
f 6//4 3//4 2//4
f 7//5 4//5 3//5
f 1//6 8//6 5//6
f 2//1 3//1 4//1
f 8//2 7//2 6//2
f 5//3 6//3 2//3
f 6//4 7//4 3//4
f 7//5 8//5 4//5
f 1//6 4//6 8//6
but even the cube is not working. I got the following error in the debug console:
> Debugging starts [07:22:56:07:900][ 1352] IGIESW
> c:\qt\examples\qt-5.9.1\datavisualization\build-rotations-desktop_qt_5_9_1_mingw_32bit-debug\debug\rotations.exe
> found in whitelist: NO [07:22:56:07:957][ 1352] IGIWHW Game
> c:\qt\examples\qt-5.9.1\datavisualization\build-rotations-desktop_qt_5_9_1_mingw_32bit-debug\debug\rotations.exe
> found in whitelist: NO OpenGL version: 4.5.0 NVIDIA 382.05 GLSL
> version: 4.50 NVIDIA ASSERT failure in QVector<T>::operator[]: "index
> out of range", file c:\Users\qt\work\install\include/QtCore/qvector.h,
> line 438 Debugging has finished
anyone knows how to correctly generate obj for Qt? Thanks
Upvotes: 0
Views: 252
Reputation: 7079
The lines at the end of your sample, which start with f
are listing the face data. I expect the missing number between the two slashes are the cause of the "index out of range error". As that is probably handled by Qt code you could suggest a bug fix to better handle that situation as it seems to be valid to have two out of three numbers there.
The second number in the face data is for uv coordinates. I expect unwrapping or at least creating a default uvmap will solve your issue.
Upvotes: 2