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