From cbd88dcfcea8300e0f93f2050601acd210470154 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Tue, 27 Nov 2018 20:59:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0opengl=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=88=B0=20RenderSetup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/hgl/render/device/RenderDevice.h | 16 ++++++++-------- src/RenderDevice/GLFW/RenderDeviceGLFW.cpp | 20 ++++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/inc/hgl/render/device/RenderDevice.h b/inc/hgl/render/device/RenderDevice.h index 3ea06829..1d2cdcfb 100644 --- a/inc/hgl/render/device/RenderDevice.h +++ b/inc/hgl/render/device/RenderDevice.h @@ -90,17 +90,17 @@ namespace hgl float lod_bias; ///<默认纹理LOD Bias(默认0) float max_anistropy; ///<纹理最大各向异性过滤值比例(使用0.0-1.0,默认1) }texture; - }; - struct OpenGLRenderSetup:public RenderSetup - { - bool debug=true; + struct + { + bool debug=true; - bool es=false; - bool egl=false; + bool es=false; + bool egl=false; - uint major=3; - uint minor=3; + uint major=3; + uint minor=3; + }opengl; }; class RenderWindow; diff --git a/src/RenderDevice/GLFW/RenderDeviceGLFW.cpp b/src/RenderDevice/GLFW/RenderDeviceGLFW.cpp index 180273a1..6b95b89b 100644 --- a/src/RenderDevice/GLFW/RenderDeviceGLFW.cpp +++ b/src/RenderDevice/GLFW/RenderDeviceGLFW.cpp @@ -78,22 +78,22 @@ namespace hgl { glfwWindowHint(GLFW_SAMPLES, gs->msaa); -// glfwWindowHint(GLFW_CLIENT_API, gs->es?GLFW_OPENGL_ES_API:GLFW_OPENGL_API); -// -// glfwWindowHint(GLFW_CONTEXT_CREATION_API, gs->egl?GLFW_EGL_CONTEXT_API:GLFW_NATIVE_CONTEXT_API); + glfwWindowHint(GLFW_CLIENT_API, gs->opengl.es?GLFW_OPENGL_ES_API:GLFW_OPENGL_API); -// if(gs->es) -// { -// } -// else + glfwWindowHint(GLFW_CONTEXT_CREATION_API, gs->opengl.egl?GLFW_EGL_CONTEXT_API:GLFW_NATIVE_CONTEXT_API); + + if(gs->opengl.es) + { + } + else { glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); //核心模式 glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, true); //向前兼容模式(无旧特性) } -// glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, gs->debug); //调试模式 -// glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, gs->major); -// glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, gs->minor); + glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, gs->opengl.debug); //调试模式 + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, gs->opengl.major); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, gs->opengl.minor); glfwWindowHint(GLFW_VISIBLE, true); //是否显示