I’m trying to implement a project in which , I have a window and a model and a button .
The model is a 3D stl file which i want to load into the window and then , by clicking the button we will have ( as an example ) 8 snapshots ( with high resolution ) from already specified angles and view points of the 3D object , and then receive the 2D snapshots as a series or file . ( it can be downloadable , or I can define the project as an API , in which i can get send the 3d image , and get a series of 2d images )
First of all ,(beside the engineering point of view) is it possible to implement such a program using OpenGL ?
If yes , Can someone give me some insight how to do it and where do start from .
ps. i have studied the OpenGl more or less and it does not seem that hard to set up an environment to demonstrate a 3D object .
Start by learning OpenGL. In particular, read about framebuffer objects (these require OpenGL 3.0 or the ARB_framebuffer_object extension). These allow you to render into off-screen surfaces (renderbuffers or textures), so the rendered image isn’t constrained to the size of the screen.
Although the standard only requires support for 1024×1024 renderbuffers, typical implementation limits are much higher (e.g. the limit on my 7 year old Radeon HD 7800 is 16384×16384). If you need a larger resolution than the implementation’s maximum renderbuffer size, you can split the image into tiles by rendering multiple times, manipulating the projection matrix (apply a scale and translation prior to the perspective transformation) prior to each step.
A quick look at what stl-files is, kind of suggest that the only opengl thing you need is ordering the draw-calls for each triangle of the model, to make sure that the front ones are drawn last. If you can setup your own calculation of which triangles are closest to the ‘camera’, you can fix it in excll - you even seem to have unite normals which can be used as a first discard (if the model is a solid). If this depth-calculation involves partly intersecting triangles that needs clipping and reconstruction into new triangles, you have a problem.
You’ll need insight into 4x4 matrix-usage, but there are easy-to-use libraries for that.