I have implemented a simple opengl win32 - Relase console application which simply , loads a 3D model , and inside the while loop, make it turn around the Z axis and then takes some snapshots from the specific angles , and save them inside a folder at project location .
now i want to make this project into a dll in which i can call it from another .net based app , giving it a 3D model and getting back a list of 2D images .
as you can imagine , in the opengl app , when i run the project , the console application starts , and a while loop starts until i pres esc . meanwhile the snapshots are taken .
#1 FIRST : How to change the opengl project into a lib in the first place .
as you can imagine the methods you call from you DLL are basically called from the header file . which then for each method there gonna be an implementation
My question is how should i manipulate and change the opengl main function , in order to make it callable like a method when dynamically linked in another app ?
#2 : should i follow the same procedure specified in MSDN for making the dll ? a new project with the dll type ? in which you have tried , you will see the order of the files is exactly the same as a console app . ( i was thinking maybe i should re-implement the opengl app , inside the dll project )
#3 How should handle all the other dlls that i imported into the opengl project in the beggiing ? ( GLEW - GLFW , ASSIMP , etc etc )
#4 how should i handle the snapshot functionality ? i use glreadpixel method which takes a snapshot from the window .
if i am just going to have the snapshot mechanism without demonstration or window , in the other application , how should i manage it ?
I just don’t know where to start from .
thanks in advanced
This question is not much more about OpenGL than your original one. Once you deal with all of the non-OpenGL parts of it, most of the OpenGL-related problems tend to have obvious solutions.
For example, you want to create a DLL that can be called from .NET. OK: do that. Forget about OpenGL and all that; just get to the point where you can have a DLL function that .NET can effectively access. Once you know how to do that, you will have a pretty good idea how to work out an interface for displaying a window and so forth between .NET and your DLL.
You want to create a DLL that can link to some libraries. OK: do that. How to handle that when those libraries happen to be “OpenGL libraries” is really no different.
The only part of this question that is specifically OpenGL related is “snapshot” functionality. If you want to produce an image of some rendering process, you would just redraw the scene and read the pixel data afterwards.
Headless OpenGL (rendering without having a window) is a more difficult concept, because OpenGL doesn’t really work without a window. You can minimize or hide the window, but even when rendering to an FBO, you need a window in order to have a functioning OpenGL context (note: there are extensions to avoid this, but they’re complex to use and are vendor-specific).
thanks for your reply
2 questions :
- How can i hide the window ?
- i have to ask another time , i don’t know how to change the opengl project into a method that can be called with a return . Call_method( 3d model ) -> return ( list of 2D )
How should i achieve this functionality as a callable method from a dll ?
plus , i don’t know how to handle all the other related libs
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.