Replace %WXWIN% with your path to wxWidgets source.
The below should build wxWidgets with support for OpenGL, I have no idea what you need to change in your C++ code to use wxWidgets with OpenGL. I suggest looking at samples/opengl folder.
Tim S
set PATH=C:\MinGW\bin;%PATH%
cd %WXWIN%\build\msw
mingw32-make -f makefile.gcc clean
mingw32-make -f makefile.gcc USE_XRC=1 MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=debug USE_OPENGL=1
mingw32-make -f makefile.gcc USE_XRC=1 MONOLITHIC=1 SHARED=1 UNICODE=1 BUILD=release USE_OPENGL=1