Hi,

I am trying to setup a simple Windows Mobile program which utilizes OpenGL ES and EGL. For some reason, whenever I call eglGetDisplay (with either EGL_DEFAULT_DISPLAY or my windows HDC) I get NULL returned back. I've looked through every thread here that mentions eglGetDisplay and I haven't found anything that seems related to my problem. Without posting my whole program, here is the relevant code:
Code :
#pragma comment(lib, "libGLES_CM.lib")
 
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <aygshell.h>
 
#include <GLES/gl.h>
#include <EGL/egl.h>
 
LRESULT CALLBACK MainWindowProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp);
BOOL OnCreateMainWindow(HWND hwnd);
 
NativeDisplayType	createNativeDisplay(NativeWindowType window);
NativeWindowType	createNativeWindow();
 
//strings
static const TCHAR g_szClassName[] = TEXT("hatfat");
 
//globals
HINSTANCE g_hInstance;
 
const int configAttributes[] =
{
	EGL_RED_SIZE, 8,
	EGL_GREEN_SIZE, 8,
	EGL_BLUE_SIZE, 8,
	EGL_ALPHA_SIZE, 8,
	EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT|EGL_OPENGL_ES_BIT,
	EGL_NONE
};
 
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd)
{
	char *renderer		= (char *)glGetString(GL_RENDERER);
	char *vendor		= (char *)glGetString(GL_VENDOR);
	char *version		= (char *)glGetString(GL_VERSION);
	printf("%s\n%s\n%s\n", renderer, vendor, version);
 
	const char *eglVendor		= eglQueryString(NULL, EGL_VENDOR);
	printf("vendor %s\n", eglVendor); //vendor is null :/
 
	//blah is null :/
	void *blah			= eglGetProcAddress("eglGetDisplay");
 
	EGLDisplay			display;
    EGLConfig			config;
    EGLContext			context;
    EGLSurface			surface;
    EGLint				num_config;
    NativeWindowType	native_window;
	NativeDisplayType	native_display;
 
	/* create a native window */
    native_window = createNativeWindow();
 
	/* get native display */
	native_display = createNativeDisplay(native_window);
 
    /* get an EGL display connection */
    display = eglGetDisplay(native_display);
 
	int error = eglGetError();
	if (error != EGL_SUCCESS)
	{
		printf("error = %x\n", error);
	}
 
    /* initialize the EGL display connection */
    eglInitialize(display, NULL, NULL);
 
	error = eglGetError();
	if (error != EGL_SUCCESS)
	{
		printf("error = %x\n", error);
	}
 
    /* get an appropriate EGL frame buffer configuration */
    eglChooseConfig(display, configAttributes, &config, 1, &num_config);
 
    /* create an EGL rendering context */
    context = eglCreateContext(display, config, EGL_NO_CONTEXT, NULL);
 
 
    /* create an EGL window surface */
    surface = eglCreateWindowSurface(display, config, native_window, NULL);
 
    /* connect the context to the surface */
    eglMakeCurrent(display, surface, surface, context);
 
	/*
    glClearColor(1.0, 1.0, 0.0, 1.0);
    glClear(GL_COLOR_BUFFER_BIT);
    glFlush();
 
    eglSwapBuffers(display, surface);
	*/
 
	Sleep(3000);
 
    return EXIT_SUCCESS;
}
 
NativeDisplayType createNativeDisplay(NativeWindowType window)
{
	return GetWindowDC(window);
}
 
NativeWindowType createNativeWindow()
{
    WNDCLASS wc;
    ATOM     atm;
    HWND     hwnd;
 
    // Set up the window class description
    ZeroMemory(&wc, sizeof(wc));
    wc.lpfnWndProc = MainWindowProc;
    wc.hInstance = g_hInstance;
    wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
    wc.lpszClassName = g_szClassName;
 
	// We want to redraw the window contents anytime we get resized. That way
	// we'll respond appropriately when the user switches between portrait and
	// landscape. If we had any child windows or controls, we'd need to
	// reposition or resize them when we get a WM_SIZE message.
    wc.style = CS_HREDRAW | CS_VREDRAW;
 
    // Register the window class
    atm = RegisterClass(&wc);
    if (atm == 0)
    {
        // Failed!!
        return NULL;
    }
 
    // Create a window using the class we just registered. Note that the
	// initial size and position don't matter, because we're going to make it
	// fullscreen when we get WM_CREATE, before it's ever displayed.
    hwnd = CreateWindow((LPCTSTR)atm, TEXT("hatfat"), WS_OVERLAPPED | WS_SYSMENU,
        CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
		NULL, NULL, g_hInstance, NULL);
    if (hwnd == NULL)
    {
        // Failed!!
        return NULL;
    }
 
    // Make the window visible and paint before returning
    ShowWindow(hwnd, SW_SHOWNORMAL);
    UpdateWindow(hwnd);
    return hwnd;
}
Any ideas? The program compiles correctly and runs. It looks like it is correctly creating the Window's window (I pulled that code out of a Microsoft sample, so I think its correct).

What concerns me is that:
Code :
const char *eglVendor		= eglQueryString(NULL, EGL_VENDOR);
	printf("vendor %s\n", eglVendor); //vendor is null :/
is NULL, and also:
Code :
//blah is null :/
	void *blah			= eglGetProcAddress("eglGetDisplay");
is null.

The OpenGL glGetStrings calls do return valid data though:
Code :
Q3Dimension MSM7500W 01.02.03 0 5.1.2
QUALCOMM, Inc.
OpenGL ES-CM 1.0
I feel like EGL isn't working correctly, but I am not sure what is wrong. Any help is greatly appreciated.