Hi!
I have used the wglGetProcAddress returned by GetProcAddress (after
using LoadLibrary to get a handle to the dll) in the NeHe Lesson1
program, just to see what addresses I would get. I have pasted the code
from that function below. When I do this, I get different addresses for
each function that I try to retrieve the address for. The address
returned by GetProcAddress for wglGetProcAddress is the same in that
test example as it is in the 1.3 CVS. However the addresses returned by
wglGetProcAddress are different in the two cases. In the case of the
modified Lesson1, I get the following: (I know these addresses may not
be right on every machine, but this is just for illustration)
wglGetExtensionsStringARB = 0x69615050
wglChoosePixelFormatARB = 0x69615340
wglGetPixelFormatAttribivARB = 0x696152a0
wglCreatePbufferARB = 0x69615090
wglGetPbufferDCARB = 0x696150e0
wglReleasePbufferDCARB = 0x69615120
wglDestroyPbufferARB = 0x69615160
wglQueryPbufferARB = 0x696151a0
If I put a break point at the end of the function
Init_WGL_ARB_extensions in the file sdl_wingl.c, i get the following
addresses in this->gl_data
wglGetExtensionsStringARB = 0x69615050
wglChoosePixelFormatARB = 0x69615340
wglGetPixelFormatAttribivARB = 0x696152a0
wglCreatePbufferARB = 0x69615340
wglGetPbufferDCARB = 0x69615340
wglReleasePbufferDCARB = 0x69615340
wglDestroyPbufferARB = 0x69615340
wglQueryPbufferARB = 0x69615340
The function address returned by GetProcAddress for wglGetProcAddress is
the same (0x5ed19777) either way.
Pardon the long email, but I wanted to make sure it was clear what I had
done.
Jay
Here is the code I put into Lesson1. (the code in sdl_wingl.c has not
changed)
void Init_WGL_ARB_Extensions(PIXELFORMATDESCRIPTOR* pfd)
{
HWND hwnd;
HDC hdc;
HGLRC hglrc;
int pformat;
HMODULE handle;
// PIXELFORMATDESCRIPTOR pfd;
void * (WINAPI *wglGetProcAddress)(const char *proc);
const char * (WINAPI *wglGetExtensionsStringARB)(HDC);
BOOL (WINAPI *wglChoosePixelFormatARB)(HDC hdc, const int
*piAttribIList,
const FLOAT *pfAttribFList,
UINT nMaxFormats, int
*piFormats,
UINT *nNumFormats);
BOOL (WINAPI *wglGetPixelFormatAttribivARB)(HDC hdc, int
iPixelFormat,
int iLayerPlane,
UINT nAttributes,
const int *piAttributes,
int *piValues);
HPBUFFERARB (WINAPI *wglCreatePbufferARB)(HDC hDC, int iPixelFormat,
int iWidth, int iHeight, const int *piAttribList);
HDC (WINAPI *wglGetPbufferDCARB) (HPBUFFERARB hPbuffer);
int (WINAPI *wglReleasePbufferDCARB)(HPBUFFERARB hPbuffer, HDC hDC);
BOOL (WINAPI *wglDestroyPbufferARB)(HPBUFFERARB hPbuffer);
BOOL (WINAPI *wglQueryPbufferARB)(HPBUFFERARB hPbuffer, int
iAttribute, int *piValue);
BOOL (WINAPI *wglBindTexImageARB)(HPBUFFERARB hPbuffer, int
iBuffer);
BOOL (WINAPI *wglReleaseTexImageARB)(HPBUFFERARB hPbuffer, int
iBuffer);
hwnd = CreateWindow("Test Window", "Test Window", WS_POPUP |
WS_DISABLED,
0, 0, 10, 10,
NULL, NULL, hInstance, NULL);
hdc = GetDC(hwnd);
// pfd = pfd_array;
pformat = ChoosePixelFormat(hdc, pfd);
SetPixelFormat(hdc, pformat, pfd);
hglrc = wglCreateContext(hdc);
if(hglrc)
{
wglMakeCurrent(hdc, hglrc);
}
handle = LoadLibrary("OpenGL32.dll");
wglGetProcAddress = (void * (WINAPI *)(const char
*))GetProcAddress(handle, “wglGetProcAddress”);
wglGetExtensionsStringARB = (const char * (WINAPI
*)(HDC))wglGetProcAddress(“wglGetExtensionsStringARB”);
wglChoosePixelFormatARB = (BOOL (WINAPI *)(HDC, const int *,
const FLOAT *, UINT, int *, UINT *))
wglGetProcAddress(“wglChoosePixelFormatARB”);
wglGetPixelFormatAttribivARB = (BOOL (WINAPI *)(HDC, int, int,
UINT, const int *, int
*))wglGetProcAddress(“wglGetPixelFormatAttribivARB”);
wglCreatePbufferARB = (HPBUFFERARB (WINAPI *)(HDC hDC, int
iPixelFormat, int iWidth, int iHeight, const int
*piAttribList))wglGetProcAddress(“wglCreatePbufferARB”);
wglGetPbufferDCARB = (HDC (WINAPI *) (HPBUFFERARB
hPbuffer))wglGetProcAddress(“wglGetPbufferDCARB”);
wglReleasePbufferDCARB = (int (WINAPI *)(HPBUFFERARB hPbuffer,
HDC hDC))wglGetProcAddress(“wglReleasePbufferDCARB”);
wglDestroyPbufferARB = (BOOL (WINAPI *)(HPBUFFERARB
hPbuffer))wglGetProcAddress(“wglDestroyPbufferARB”);
wglQueryPbufferARB =(BOOL (WINAPI *)(HPBUFFERARB hPbuffer, int
iAttribute, int *piValue))wglGetProcAddress(“wglQueryPbufferARB”);
if ( hglrc ) {
wglMakeCurrent(NULL, NULL);
wglDeleteContext(hglrc);
}
ReleaseDC(hwnd, hdc);
DestroyWindow(hwnd);
}