diff options
author | reduz <juan@okamstudio.com> | 2016-12-21 02:29:58 -0300 |
---|---|---|
committer | reduz <juan@okamstudio.com> | 2016-12-21 02:29:58 -0300 |
commit | 72b844c34999d8615450798ed1f27ef24a72d8ce (patch) | |
tree | cc51d63b1725459d0da37fd807301d8e3540a395 | |
parent | 075fde7f26d6c3b02df5108065d1a9f979437bb8 (diff) |
Godot works on Windows again..
-rw-r--r-- | drivers/gles3/rasterizer_canvas_gles3.cpp | 8 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_gles3.cpp | 2 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_scene_gles3.cpp | 4 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_scene_gles3.h | 2 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_storage_gles3.cpp | 2 | ||||
-rw-r--r-- | platform/windows/context_gl_win.cpp | 10 | ||||
-rw-r--r-- | platform/windows/detect.py | 4 | ||||
-rw-r--r-- | platform/windows/os_windows.cpp | 27 | ||||
-rw-r--r-- | platform/windows/os_windows.h | 2 | ||||
-rw-r--r-- | platform/windows/platform_config.h | 4 | ||||
-rw-r--r-- | servers/visual/visual_server_scene.h | 2 |
11 files changed, 36 insertions, 31 deletions
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index 3c6094a41d..6bd440eec1 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -1257,16 +1257,16 @@ void RasterizerCanvasGLES3::canvas_light_shadow_buffer_update(RID p_buffer, cons CameraMatrix projection; { real_t fov = 90; - real_t near = p_near; - real_t far = p_far; + real_t nearp = p_near; + real_t farp = p_far; real_t aspect = 1.0; - real_t ymax = near * Math::tan( Math::deg2rad( fov * 0.5 ) ); + real_t ymax = nearp * Math::tan( Math::deg2rad( fov * 0.5 ) ); real_t ymin = - ymax; real_t xmin = ymin * aspect; real_t xmax = ymax * aspect; - projection.set_frustum( xmin, xmax, ymin, ymax, near, far ); + projection.set_frustum( xmin, xmax, ymin, ymax, nearp, farp ); } Vector3 cam_target=Matrix3(Vector3(0,0,Math_PI*2*(i/4.0))).xform(Vector3(0,1,0)); diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index 3924ffb75f..110436b9d5 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -131,7 +131,7 @@ void RasterizerGLES3::initialize() { } glEnable(_EXT_DEBUG_OUTPUT_SYNCHRONOUS_ARB); - glDebugMessageCallbackARB(_gl_debug_print, NULL); +// glDebugMessageCallbackARB(_gl_debug_print, NULL); glEnable(_EXT_DEBUG_OUTPUT); #endif diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 524e683738..65591de56e 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -996,7 +996,7 @@ void RasterizerSceneGLES3::light_instance_set_shadow_transform(RID p_light_insta light_instance->shadow_transform[p_pass].camera=p_projection; light_instance->shadow_transform[p_pass].transform=p_transform; - light_instance->shadow_transform[p_pass].far=p_far; + light_instance->shadow_transform[p_pass].farplane=p_far; light_instance->shadow_transform[p_pass].split=p_split; } @@ -4443,7 +4443,7 @@ static _FORCE_INLINE_ Vector3 ImportanceSampleGGX(Vector2 Xi, float Roughness, V float a = Roughness * Roughness; // DISNEY'S ROUGHNESS [see Burley'12 siggraph] // Compute distribution direction - float Phi = 2.0f * M_PI * Xi.x; + float Phi = 2.0f * Math_PI * Xi.x; float CosTheta = Math::sqrt((1.0f - Xi.y) / (1.0f + (a*a - 1.0f) * Xi.y)); float SinTheta = Math::sqrt((float)Math::abs(1.0f - CosTheta * CosTheta)); diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 5eb2be1cc2..ef1b7b8d38 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -482,7 +482,7 @@ public: CameraMatrix camera; Transform transform; - float far; + float farplane; float split; }; diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 8262487f9d..eca916854a 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -133,7 +133,7 @@ Image RasterizerStorageGLES3::_get_gl_image_and_format(const Image& p_image, Ima } break; case Image::FORMAT_RGB565: { -#warning TODO: Convert tod 555 if 565 is not supported (GLES3.3-) +//#warning TODO: Convert tod 555 if 565 is not supported (GLES3.3-) r_gl_internal_format=GL_RGB5; //r_gl_internal_format=GL_RGB565; r_gl_format=GL_RGB; diff --git a/platform/windows/context_gl_win.cpp b/platform/windows/context_gl_win.cpp index fd9e895370..57950d33ca 100644 --- a/platform/windows/context_gl_win.cpp +++ b/platform/windows/context_gl_win.cpp @@ -162,8 +162,8 @@ Error ContextGL_Win::initialize() { if (opengl_3_context) { int attribs[] = { - WGL_CONTEXT_MAJOR_VERSION_ARB, 3,//we want a 3.1 context - WGL_CONTEXT_MINOR_VERSION_ARB, 2, + WGL_CONTEXT_MAJOR_VERSION_ARB, 3,//we want a 3.3 context + WGL_CONTEXT_MINOR_VERSION_ARB, 3, //and it shall be forward compatible so that we can only use up to date functionality WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB, 0}; //zero indicates the end of the array @@ -182,7 +182,7 @@ Error ContextGL_Win::initialize() { if (!(new_hRC=wglCreateContextAttribsARB(hDC,0, attribs))) { wglDeleteContext(hRC); - MessageBox(NULL,"Can't Create An OpenGL 3.1 Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); + MessageBox(NULL,"Can't Create An OpenGL 3.3 Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return ERR_CANT_CREATE; // Return false } wglMakeCurrent(hDC,NULL); @@ -191,11 +191,11 @@ Error ContextGL_Win::initialize() { if (!wglMakeCurrent(hDC,hRC)) // Try To Activate The Rendering Context { - MessageBox(NULL,"Can't Activate The GL 3.1 Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); + MessageBox(NULL,"Can't Activate The GL 3.3 Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION); return ERR_CANT_CREATE; // Return FALSE } - printf("Activated GL 3.1 context"); + printf("Activated GL 3.3 context"); } wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC) wglGetProcAddress ("wglSwapIntervalEXT"); diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 12ea5a93ee..286e6cb78c 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -244,7 +244,7 @@ def configure(env): env.Append(CCFLAGS=['/DWIN32']) env.Append(CCFLAGS=['/DTYPED_METHOD_BIND']) - env.Append(CCFLAGS=['/DGLES2_ENABLED']) + env.Append(CCFLAGS=['/DOPENGL_ENABLED']) LIBS=['winmm','opengl32','dsound','kernel32','ole32','oleaut32','user32','gdi32', 'IPHLPAPI','Shlwapi', 'wsock32','Ws2_32', 'shell32','advapi32','dinput8','dxguid'] env.Append(LINKFLAGS=[p+env["LIBSUFFIX"] for p in LIBS]) @@ -372,7 +372,7 @@ def configure(env): env.Append(CCFLAGS=['-DWINDOWS_ENABLED','-mwindows']) env.Append(CPPFLAGS=['-DRTAUDIO_ENABLED']) - env.Append(CCFLAGS=['-DGLES2_ENABLED']) + env.Append(CCFLAGS=['-DOPENGL_ENABLED']) env.Append(LIBS=['mingw32','opengl32', 'dsound', 'ole32', 'd3d9','winmm','gdi32','iphlpapi','shlwapi','wsock32','ws2_32','kernel32', 'oleaut32', 'dinput8', 'dxguid']) # if (env["bits"]=="32"): diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 92359892a8..7321f5d1b1 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -26,9 +26,11 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "drivers/gles2/rasterizer_gles2.h" + #include "os_windows.h" +#include "drivers/gles3/rasterizer_gles3.h" + #include "drivers/nedmalloc/memory_pool_static_nedmalloc.h" #include "drivers/unix/memory_pool_static_malloc.h" #include "os/memory_pool_dynamic_static.h" @@ -42,7 +44,7 @@ #include "servers/visual/visual_server_raster.h" #include "servers/audio/audio_server_sw.h" -#include "servers/visual/visual_server_wrap_mt.h" +//#include "servers/visual/visual_server_wrap_mt.h" #include "tcp_server_winsock.h" #include "packet_peer_udp_winsock.h" @@ -1079,21 +1081,24 @@ void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_ }; -#if defined(OPENGL_ENABLED) || defined(GLES2_ENABLED) || defined(LEGACYGL_ENABLED) - gl_context = memnew( ContextGL_Win(hWnd,false) ); +#if defined(OPENGL_ENABLED) + gl_context = memnew( ContextGL_Win(hWnd,true) ); gl_context->initialize(); - rasterizer = memnew( RasterizerGLES2 ); + + RasterizerGLES3::register_config(); + + RasterizerGLES3::make_current(); #else #ifdef DX9_ENABLED rasterizer = memnew( RasterizerDX9(hWnd) ); #endif #endif - visual_server = memnew( VisualServerRaster(rasterizer) ); - if (get_render_thread_mode()!=RENDER_THREAD_UNSAFE) { - - visual_server =memnew(VisualServerWrapMT(visual_server,get_render_thread_mode()==RENDER_SEPARATE_THREAD)); - } + visual_server = memnew( VisualServerRaster ); + //if (get_render_thread_mode()!=RENDER_THREAD_UNSAFE) { +// +// visual_server =memnew(VisualServerWrapMT(visual_server,get_render_thread_mode()==RENDER_SEPARATE_THREAD)); +// } // physics_server = memnew( PhysicsServerSW ); @@ -1758,7 +1763,7 @@ void OS_Windows::print_error(const char* p_function, const char* p_file, int p_l case ERR_ERROR: print("ERROR: "); break; case ERR_WARNING: print("WARNING: "); break; case ERR_SCRIPT: print("SCRIPT ERROR: "); break; - case ERR_SCRIPT: print("SHADER ERROR: "); break; + case ERR_SHADER: print("SHADER ERROR: "); break; } SetConsoleTextAttribute(hCon, current_fg | current_bg | FOREGROUND_INTENSITY); diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 70ef694957..bbacdb1a91 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -92,7 +92,7 @@ class OS_Windows : public OS { int old_x,old_y; Point2i center; unsigned int last_id; -#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED) || defined(GLES2_ENABLED) +#if defined(OPENGL_ENABLED) ContextGL_Win *gl_context; #endif VisualServer *visual_server; diff --git a/platform/windows/platform_config.h b/platform/windows/platform_config.h index 296a778ac8..fbcf0f74d2 100644 --- a/platform/windows/platform_config.h +++ b/platform/windows/platform_config.h @@ -30,7 +30,7 @@ //#else //#include <alloca.h> //#endif -#define GLES2_INCLUDE_H "gl_context/GL/glew.h" -#define GLES3_INCLUDE_H "gl_context/GL/glew.h" +//#define GLES2_INCLUDE_H "gl_context/GL/glew.h" +#define GLES3_INCLUDE_H "gl_context/glad/glad.h" diff --git a/servers/visual/visual_server_scene.h b/servers/visual/visual_server_scene.h index 63cb1fd2b8..894d3529af 100644 --- a/servers/visual/visual_server_scene.h +++ b/servers/visual/visual_server_scene.h @@ -9,7 +9,7 @@ #include "self_list.h" #include "os/thread.h" #include "os/semaphore.h" -#include "semaphore.h" +#include "os/semaphore.h" class VisualServerScene { public: |