改量opengl ext,,,但考虑将这部分代码移到GLEWCore工程中去

This commit is contained in:
hyzboy 2019-03-23 10:28:07 +08:00
parent ad03777a7a
commit 7ee3352524
5 changed files with 24 additions and 61 deletions

View File

@ -23,7 +23,9 @@ namespace hgl
protected: 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); BufferObject(GLuint index,GLenum type);

View File

@ -5,6 +5,14 @@
namespace hgl namespace hgl
{ {
namespace graph
{
namespace gl
{
void InitOpenGLExt();
}
}
RenderWindow *CreateRenderWindowGLFW(GLFWwindow *,bool is_fullscreen); RenderWindow *CreateRenderWindowGLFW(GLFWwindow *,bool is_fullscreen);
namespace namespace
@ -195,6 +203,7 @@ namespace hgl
glfwMakeContextCurrent(win); glfwMakeContextCurrent(win);
InitGLEWCore(); InitGLEWCore();
graph::gl::InitOpenGLExt();
return(CreateRenderWindowGLFW(win,false)); return(CreateRenderWindowGLFW(win,false));
} }
@ -218,6 +227,7 @@ namespace hgl
glfwMakeContextCurrent(win); glfwMakeContextCurrent(win);
InitGLEWCore(); InitGLEWCore();
graph::gl::InitOpenGLExt();
return(CreateRenderWindowGLFW(win,true)); return(CreateRenderWindowGLFW(win,true));
} }

View File

@ -124,8 +124,8 @@ namespace hgl
if(!buf_data)return(false); if(!buf_data)return(false);
buffer_data=buf_data; buffer_data=buf_data;
const void * data=buf_data->GetData(); void * data=buf_data->GetData();
const GLsizeiptr size=buf_data->GetTotalBytes(); GLsizeiptr size=buf_data->GetTotalBytes();
if(!data||size<=0)return(false); if(!data||size<=0)return(false);

View File

@ -5,9 +5,9 @@ SET(GRAPH_SRC_FILES OpenGLDebug.cpp
Shader.cpp Shader.cpp
BufferData.cpp BufferData.cpp
BufferObject.cpp BufferObject.cpp
VertexArray.cpp # VertexArray.cpp
VertexBuffer.cpp # VertexBuffer.cpp
VertexBufferObject.cpp # VertexBufferObject.cpp
TextureFormat.cpp TextureFormat.cpp
Texture1D.cpp Texture1D.cpp
Texture1DDSA.cpp Texture1DDSA.cpp

View File

@ -4,63 +4,14 @@ namespace hgl
{ {
namespace graph namespace graph
{ {
namespace namespace gl
{ {
enum GLAPI_SUPPORT void InitBufferObjectAPI();
void InitOpenGLExt()
{ {
gasNoSupport=-1, InitBufferObjectAPI();
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);
} }
}//namespace gl
support_dsa=gasNoSupport;
return(false);
}
} }
}//namespace hgl }//namespace hgl