PDA

View Full Version : Stl file



ailuig
01-15-2018, 06:49 AM
Hi,

i need to work on stl file using opengl
i dont understand how to load and view a stl file
and secondly there are function to pick a piece of an image? for example in my stl file there are 3 semiphere how can i select only one of them ?

Dark Photon
01-16-2018, 05:57 AM
You need to figure out which file format that .stl file follows. A few possibilities:

https://fileinfo.com/extension/stl
https://en.wikipedia.org/wiki/STL_(file_format)

From context, you probably have a pretty good idea which one you're dealing even before looking at its content.

For picking, you can use some CPU-based ray intersection capability, or you can render your model to an off-screen framebuffer with unique colors per object (w/o MSAA) and then test the color at specific pixels to see which object you're dealing with. The advantage to the former is it doesn't require a GPU readback.