diff --git a/3rdpty/dl_glew.sh b/3rdpty/dl_glew.sh deleted file mode 100644 index 9325bbd9..00000000 --- a/3rdpty/dl_glew.sh +++ /dev/null @@ -1 +0,0 @@ -git clone https://github.com/nigels-com/glew.git glew diff --git a/3rdpty/dl_glewcore.sh b/3rdpty/dl_glewcore.sh new file mode 100755 index 00000000..469919cb --- /dev/null +++ b/3rdpty/dl_glewcore.sh @@ -0,0 +1 @@ +git clone https://github.com/hyzboy/GLEWCore.git GLEWCore diff --git a/CMakeLists.txt b/CMakeLists.txt index 248dfee0..69a5295f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,14 +15,17 @@ set_compiler_param() set_output_directory() include_directories(3rdpty/MathGeoLib/src) +include_directories(3rdpty/GLEWCore/inc) include_directories(inc) add_subdirectory(3rdpty/MathGeoLib) +add_subdirectory(3rdpty/GLEWCore) add_subdirectory(src) SET(ULRE ULRE.RenderDevice ULRE.RenderDriver MathGeoLib + GLEWCore glfw GL) diff --git a/example/DirectGLRender/main.cpp b/example/DirectGLRender/main.cpp index 3f06c69a..cca14813 100644 --- a/example/DirectGLRender/main.cpp +++ b/example/DirectGLRender/main.cpp @@ -1,17 +1,24 @@ #include #include #include -#include -#include +#include using namespace hgl; +constexpr GLfloat clear_color[4]= +{ + 77.f/255.f, + 78.f/255.f, + 83.f/255.f, + 1.f +}; +constexpr GLfloat clear_depth=1.0f; void draw() { - glClearColor(0,0,0,1); //设置清屏颜色 - glClear(GL_COLOR_BUFFER_BIT); //清屏 + glClearBufferfv(GL_COLOR,0,clear_color); + glClearBufferfv(GL_DEPTH,0,&clear_depth); } int main(void) @@ -32,7 +39,7 @@ int main(void) WindowSetup ws; - ws.Name=U8_TEXT("Direct OpenGL Render"); + ws.Name=U8_TEXT("Direct use \"OpenGL Core API\" Render"); RenderSetup rs; diff --git a/example/OutputGLInfo/main.cpp b/example/OutputGLInfo/main.cpp index a0e96155..e5c3128d 100644 --- a/example/OutputGLInfo/main.cpp +++ b/example/OutputGLInfo/main.cpp @@ -2,8 +2,7 @@ #include #include #include -#include -#include +#include using namespace hgl; @@ -19,8 +18,6 @@ void output_ogl_info() std::cout<<"Renderer: "< +#include #include #include @@ -8,8 +9,21 @@ namespace hgl namespace { + static bool init_glew=false; static RenderDevice *render_device_glfw=nullptr; + void InitGLEWCore() + { + if(!init_glew) + init_glew=glewInit(); + } + + void CloseGLEWCore() + { + glewTerminate(); + init_glew=false; + } + void glfw_error_callback(int err,const char *desc) { std::cerr<<"glfw return error["<