Click here to Skip to main content
15,868,164 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have downloaded a 3D model of the planet Jupiter from the NASA website, in the form of a glb file. When I try to display it using the header only library cgltf, I get a huge white blob. When I look at the vertices in the debugger, I see a range of values from -300 to +300. I thought local coordinates were in the range -1 to +1. Am I supposed to be doing something to convert these vertices to Normalized Device Coordinates?

What I have tried:

When I import the file into blender, it more than fills the entire window. But if I set the x, y and z scaling parameters to 0.01, then I get a sphere taking up about half the client area. The 3D viewer app that comes with Windows 10 displays it perfectly.
Posted
Comments
Richard MacCutchan 24-Oct-21 4:04am    
You need to do the same thing. Normalise the coordinates so that they are aligned at 0,0. That should give you the width and height of the image. Now adjust those values based on the width and height of the rectangle in which you will display the image. See How do I get the barcode images to scale properly?[^].
djc2032 24-Oct-21 10:25am    
Thanks, I had found this function: XMVector3Normalize, but I didn't realize this would distort the image. Looks like I still have some work to do.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900