Advertisement

ogl and code in a dll

Started by October 05, 2002 01:39 AM
4 comments, last by _Z 22 years, 4 months ago
situation is: i have a script parser in a dll working, which builds an ui for/using ogl; the question is, if i call ogl functions from the dll to create textures & stuff, will they work? and: if anyone knows a link to dll related stuff, i''d appreciate if you dropped it here
0x600
1) yes you can use GL in a dll
2) go to www.flipcode.com and search around, they have a tutorial or something like it about creating/using DLL''s
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
Advertisement
Ahoi Tartu - muuseas su koduka link ei tööta

Anyways - calling functions that are in a dll is pretty much the same as calling those that are stored in the executable, only with a little bit of extra hassle. If you''ve got problems using dll''s I once worked out a plugin system - so I can post some code. Just be a wee bit more specific. Are having trouble with calling the functions in, or creating the dll? Here''s an article - haven''t read it myself, though, so I can''t be sure as to how good it is. Found the link here on GameDev, btw...

Crispy
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
creating a dll and calling the functions is not a problem;
problem is (maybe) that you may need to have an active gl context to call gl funcs...but dll doesn't have one...
damn...i feel n00bish :|

btw: tänud märkuse kohta


[edited by - _Z on October 5, 2002 9:16:15 AM]
0x600
Example: to use a DLL plugin to draw stuff you need to follow the below rules:

main program:
*check if the DLL is present
*load the DLL
*aquire the function pointers in the DLL using GetProcAddress
*create the RC and windowing stuff + make the RC current (wglMakeCurrent() if I remember correctly)
*set up the OpenGL environment
[*call the drawing function within the main program (usually calls glClear() and stuff first)]
*[in the drawing fuction] call the aquired function from the DLL through its pointer in the main program.

The RC that you have already set up should work in this case - no need to have a different one for each module (right?). If it still doesn''t work, try passing the RC to the DLL and making it current there.

Above and beyond - could you be more specific about the problem?

Terv,
Crispy
"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared
yes, i could, but only in estonian
my english is a bit weak

and i think, that these suggestions are enough..if gl calls woun't work from inside the dll, ill move them to the main program

[edited by - _Z on October 6, 2002 5:35:12 AM]
0x600

This topic is closed to new replies.

Advertisement