From 7ee33525249ecc3bc195942c0d6fce0b00c36f40 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Sat, 23 Mar 2019 10:28:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E9=87=8Fopengl=20ext=EF=BC=8C?= =?UTF-8?q?=EF=BC=8C=EF=BC=8C=E4=BD=86=E8=80=83=E8=99=91=E5=B0=86=E8=BF=99?= =?UTF-8?q?=E9=83=A8=E5=88=86=E4=BB=A3=E7=A0=81=E7=A7=BB=E5=88=B0GLEWCore?= =?UTF-8?q?=E5=B7=A5=E7=A8=8B=E4=B8=AD=E5=8E=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/hgl/graph/BufferObject.h | 4 +- src/RenderDevice/GLFW/RenderDeviceGLFW.cpp | 10 ++++ src/RenderDriver/BufferObject.cpp | 4 +- src/RenderDriver/CMakeLists.txt | 6 +-- src/RenderDriver/OpenGLExt.cpp | 61 +++------------------- 5 files changed, 24 insertions(+), 61 deletions(-) diff --git a/inc/hgl/graph/BufferObject.h b/inc/hgl/graph/BufferObject.h index 5200f14e..c4610f1b 100644 --- a/inc/hgl/graph/BufferObject.h +++ b/inc/hgl/graph/BufferObject.h @@ -23,7 +23,9 @@ namespace hgl protected: - friend BufferObject *CreateBuffer(GLenum type,GLenum user_pattern,BufferData *buf); + friend BufferObject *CreateBufferObject(GLenum,GLenum,BufferData *buf); + friend BufferObject *CreateBufferObject(const GLenum &,const GLenum &,const GLsizeiptr &); + friend BufferObject *CreateBufferObject(const GLenum &,const GLenum &,const GLsizeiptr &,void *); BufferObject(GLuint index,GLenum type); diff --git a/src/RenderDevice/GLFW/RenderDeviceGLFW.cpp b/src/RenderDevice/GLFW/RenderDeviceGLFW.cpp index cd2cd0a2..4f762d52 100644 --- a/src/RenderDevice/GLFW/RenderDeviceGLFW.cpp +++ b/src/RenderDevice/GLFW/RenderDeviceGLFW.cpp @@ -5,6 +5,14 @@ namespace hgl { + namespace graph + { + namespace gl + { + void InitOpenGLExt(); + } + } + RenderWindow *CreateRenderWindowGLFW(GLFWwindow *,bool is_fullscreen); namespace @@ -195,6 +203,7 @@ namespace hgl glfwMakeContextCurrent(win); InitGLEWCore(); + graph::gl::InitOpenGLExt(); return(CreateRenderWindowGLFW(win,false)); } @@ -218,6 +227,7 @@ namespace hgl glfwMakeContextCurrent(win); InitGLEWCore(); + graph::gl::InitOpenGLExt(); return(CreateRenderWindowGLFW(win,true)); } diff --git a/src/RenderDriver/BufferObject.cpp b/src/RenderDriver/BufferObject.cpp index 214952e5..0d1869c8 100644 --- a/src/RenderDriver/BufferObject.cpp +++ b/src/RenderDriver/BufferObject.cpp @@ -124,8 +124,8 @@ namespace hgl if(!buf_data)return(false); buffer_data=buf_data; - const void * data=buf_data->GetData(); - const GLsizeiptr size=buf_data->GetTotalBytes(); + void * data=buf_data->GetData(); + GLsizeiptr size=buf_data->GetTotalBytes(); if(!data||size<=0)return(false); diff --git a/src/RenderDriver/CMakeLists.txt b/src/RenderDriver/CMakeLists.txt index 793faa36..765e30af 100644 --- a/src/RenderDriver/CMakeLists.txt +++ b/src/RenderDriver/CMakeLists.txt @@ -5,9 +5,9 @@ SET(GRAPH_SRC_FILES OpenGLDebug.cpp Shader.cpp BufferData.cpp BufferObject.cpp - VertexArray.cpp - VertexBuffer.cpp - VertexBufferObject.cpp +# VertexArray.cpp +# VertexBuffer.cpp +# VertexBufferObject.cpp TextureFormat.cpp Texture1D.cpp Texture1DDSA.cpp diff --git a/src/RenderDriver/OpenGLExt.cpp b/src/RenderDriver/OpenGLExt.cpp index df659075..55be7890 100644 --- a/src/RenderDriver/OpenGLExt.cpp +++ b/src/RenderDriver/OpenGLExt.cpp @@ -4,63 +4,14 @@ namespace hgl { namespace graph { - namespace + namespace gl { - enum GLAPI_SUPPORT + void InitBufferObjectAPI(); + + void InitOpenGLExt() { - gasNoSupport=-1, - gasNoCheck=0, - gasSupport=1 - }; - - static GLAPI_SUPPORT support_dsa=gasNoCheck; - } - - bool IsSupportDSA() - { - if(support_dsa==gasSupport)return(true); - - //texture api - if(glCreateTextures - &&glGenerateTextureMipmap - &&glGetTextureLevelParameteriv - &&glGetTextureParameteriv - &&glGetCompressedTextureImage - &&glGetTextureImage - &&glBindTextureUnit - &&glCompressedTextureSubImage1D - &&glCompressedTextureSubImage2D - &&glTextureSubImage1D - &&glTextureSubImage2D - - //sampler object - &&glGenSamplers - &&glBindSampler - &&glSamplerParameteri - &&glSamplerParameterfv - - //vbo - &&glCreateBuffers - &&glNamedBufferData - &&glNamedBufferSubData - - //vao - &&glCreateVertexArrays - &&glDeleteVertexArrays - &&glVertexArrayAttribBinding - &&glVertexArrayAttribFormat - &&glVertexArrayAttribIFormat - &&glVertexArrayAttribLFormat - &&glEnableVertexArrayAttrib - &&glVertexArrayVertexBuffer - ) - { - support_dsa=gasSupport; - return(true); + InitBufferObjectAPI(); } - - support_dsa=gasNoSupport; - return(false); - } + }//namespace gl } }//namespace hgl