How to create a dll for an opengl window?

Started by
4 comments, last by wyanh 14 years ago
I have wrote an application with an openGL window, for some reason, I need to change it completely to a dll, how to begin my program?
Advertisement
Wow. You've given us exactly enough information to... Ask for more information!

Why do you need a dll? The only reason I can think of is that you are trying to hook into another process' WndProc, and that begs further questions.

No, I am not a professional programmer. I'm just a hobbyist having fun...

Quote:Original post by wyanh
[...] for some reason, [...]

I guess if he tells us he will have to kill us.

So, wyanh, I'm assuming that you are using C++.

The header should look like this:
#ifndef __MAIN_H__#define __MAIN_H__//add normal includes here, like#include <windows.h>/*  To use this exported function of dll, include this header *  in your project. */#ifdef BUILD_DLL    #define DLL_EXPORT __declspec(dllexport)#else    #define DLL_EXPORT __declspec(dllimport)#endif#ifdef __cplusplusextern "C"{#endifint DLL_EXPORT SomeFunction (it's parameters);#ifdef __cplusplus}#endif#endif // __MAIN_H__

and the cpp file:
#include "that header.h"int DLL_EXPORT SomeFunction (it's parameters){	//implementation}


Then in the compile settings you should find what you are compiling, like in MSVC you go to project's properties and under "General" there is a field named "Configuration Type" where you can select a dll.
I use mfc build the opengl window, my team need to put the window into the C# window forme, like a ActiveX, just give the ActiveX several parametres. but the Activex program I built before build failed on the leader's window7 system, (I build it on windows xp system),so,the leader ask me do a dll,with the functions same to an ActiveX.
You should probably ask on the general programming questions since your question is about how to make a dll. Of course, the best thing to do is to search on the internet and then if you are having problems, ask a more specific question.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);
thanks to all.

This topic is closed to new replies.

Advertisement