wglGetProcAddress()?

BlitzMax Forums/OpenGL Module/wglGetProcAddress()?

JoshK(Posted 2006) [#1]
I tried adding this to the end of opengl.bmx. No luck.


Function glVertex4sv(v_:Short Ptr)
Function glVertexPointer(size_:Int,type_:Int,stride_:Int,pointer_:Byte Ptr)
Function glViewport(x_:Int,y_:Int,width_:Int,height_:Int)

Function wglGetProcAddress(lpszProc:string)

End Extern



Chris C(Posted 2006) [#2]
you can use getprocddress from win32 if you get a pointer from opengl.dll, have a look at my opengl logger on my site


JoshK(Posted 2006) [#3]
I don't want to open another instance of the library.

According to the docs, this function is found in openg32.dll.


skidracer(Posted 2006) [#4]
try:

Function wglGetProcAddress:byte ptr(lpszProc$z)

$z automatically creates an ascii version of a BlitzMax string and frees it up once the function has been called and byte ptr is like void * in C and should be able to be cast to a function pointer in max although I'm not 100% on that...

you should also be adding the declaration to win32.mod/gdi32.bmx after wglMakeCurrent as an extern "win32" block dictate the functions use stdcall calling conventions and there are already some wgl declarations present in this file.

If you're not into remaking modules I would also suggest just sticking the declaration at the top of your source in an extern "win32" block as external function don't have to be declared in modules.


JoshK(Posted 2006) [#5]
This causes an "unrecognized calling convention" error:

Extern "OpenGL"
Function wglGetProcAddress:Byte Ptr(lpszProc$z)
EndExtern


Also tried "opengl32", same result.


REDi(Posted 2006) [#6]
You just need to change it to "Win32" and your away! its a calling convention, not what dll to use.


JoshK(Posted 2006) [#7]
Cool! Thanks for the help.

wglprocaddress() returns an address for OpenGL extension commands. Now I need to figure out how to make BMax call the process address as a function?!


Chris C(Posted 2006) [#8]

I don't want to open another instance of the library.

According to the docs, this function is found in openg32.dll.


Global vstModule:Int
vstModule=LoadLibraryA( vstdllname )

Global testmod:Int
testmod=LoadLibraryA( vstdllname )

Print "vst Module "+vstModule
Print "2nd Module "+testmod

dlls only get mapped into process space once only
Just thought I'd mention it because its important...