opengl renderer: windows runtime fix

Need to initialize networking by calling WSAStartup
in the renderer process.
diff --git a/tools/emulator/opengl/host/renderer/Android.mk b/tools/emulator/opengl/host/renderer/Android.mk
index 5535250..7354eda 100644
--- a/tools/emulator/opengl/host/renderer/Android.mk
+++ b/tools/emulator/opengl/host/renderer/Android.mk
@@ -21,6 +21,10 @@
                     $(emulatorOpengl)/shared/OpenglCodecCommon \
                     $(emulatorOpengl)/host/libs/libOpenglRender
 
+ifeq ($(HOST_OS),windows)
+LOCAL_LDLIBS += -lws2_32
+endif
+
 LOCAL_SHARED_LIBRARIES := libOpenglRender \
         libGLESv1_dec \
         libGLESv2_dec \
diff --git a/tools/emulator/opengl/host/renderer/main.cpp b/tools/emulator/opengl/host/renderer/main.cpp
index 73efe59..128f96d 100644
--- a/tools/emulator/opengl/host/renderer/main.cpp
+++ b/tools/emulator/opengl/host/renderer/main.cpp
@@ -22,6 +22,9 @@
 #include <sys/types.h>
 #include <unistd.h>
 #include <codec_defs.h>
+#ifdef _WIN32
+#include <winsock2.h>
+#endif
 
 
 static void printUsage(const char *progName)
@@ -92,6 +95,13 @@
     printf("renderer pid %d , press any key to continue...\n", getpid());
     getchar();
 
+#ifdef _WIN32
+    WSADATA  wsaData;
+    int      rc = WSAStartup( MAKEWORD(2,2), &wsaData);
+    if (rc != 0) {
+            printf( "could not initialize Winsock\n" );
+    }
+#endif
     //
     // initialize Framebuffer
     //
diff --git a/tools/emulator/opengl/tests/emulator_test_renderer/Android.mk b/tools/emulator/opengl/tests/emulator_test_renderer/Android.mk
index 8ec1b9f..7f5d4f5 100644
--- a/tools/emulator/opengl/tests/emulator_test_renderer/Android.mk
+++ b/tools/emulator/opengl/tests/emulator_test_renderer/Android.mk
@@ -16,6 +16,10 @@
 LOCAL_CFLAGS += $(SDL_CFLAGS) -g -O0
 LOCAL_LDLIBS += $(SDL_LDLIBS)
 
+ifeq ($(HOST_OS),windows)
+LOCAL_LDLIBS += -lws2_32
+endif
+
 LOCAL_STATIC_LIBRARIES += libSDL libSDLmain
 
 $(call emugl-end-module)
diff --git a/tools/emulator/opengl/tests/emulator_test_renderer/main.cpp b/tools/emulator/opengl/tests/emulator_test_renderer/main.cpp
index 898cbd7..b0e49cd 100644
--- a/tools/emulator/opengl/tests/emulator_test_renderer/main.cpp
+++ b/tools/emulator/opengl/tests/emulator_test_renderer/main.cpp
@@ -21,6 +21,7 @@
 #include "libOpenglRender/render_api.h"
 
 #ifdef _WIN32
+#include <winsock2.h>
 int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
 #else
 int main(int argc, char *argv[])
@@ -50,8 +51,15 @@
     SDL_GetWMInfo(&wminfo);
 #ifdef _WIN32
     windowId = wminfo.window;
-#else
+    WSADATA  wsaData;
+    int      rc = WSAStartup( MAKEWORD(2,2), &wsaData);
+    if (rc != 0) {
+            printf( "could not initialize Winsock\n" );
+    }
+#elif __linux__
     windowId = wminfo.info.x11.window;
+#elif __APPLE__
+    windowId = wminfo.nsWindowPtr;
 #endif
 
     printf("initializing renderer process\n");