Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Handling the graphics inside a DLL

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2004
    Posts
    5

    Handling the graphics inside a DLL

    Im currently writing a 3D-engine and i want it to be Graphics API-independent
    so i want to put all the code for graphics-drawning in a DLL. I try to
    CreateWindow() inside the DLL (i pass pointer to HWND, WndProc etc.) but i get
    alot of invalid conversion errors. I don't have my code with me (ill post it
    tommorow) but are there any good tutorials on the topic? There are alot of
    information about OpenGL, Windows GDI etc. but i havent seen any on how to
    do it inside a DLL.

    Futhermore i found a great tutorial on flipcode.org
    on how to load objects without .def-files so now i can load entire objects and
    not just plain C-stuff .
    this->life = GLvoid; // :P

  2. #2
    Advanced Member Frequent Contributor plasmonster's Avatar
    Join Date
    Mar 2004
    Posts
    750

    Re: Handling the graphics inside a DLL

    If you're trying to create a window in a dll, then you need to make sure you're using the instance sent to DllMain(...) to create the window. For example:

    HINSTANCE myInstance;
    INT WINAPI DllMain( HINSTANCE hInst, DWORD dwReason, void* pReserved ){
    myInstance = hInst;
    return 1;
    }

    then you would use myInstance when registering your window class, and creating your window. But remember, the window is still owned by the application, not the dll.

    If you would like some good reading on this subject, I would recommend anything by Charles Petzold.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •