X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Farb_vertex_shader.cpp;h=918c131607bdd017829ce031c4e943614fce6a70;hp=612c5033fe0fe2fd50c4ecc00ef1b77b705cad67;hb=6afbace895a7bbcf216ab8e48280ea0303ab5892;hpb=485315ca65cb40f33253008a79b0933997bd74f5 diff --git a/source/arb_vertex_shader.cpp b/source/arb_vertex_shader.cpp index 612c5033..918c1316 100644 --- a/source/arb_vertex_shader.cpp +++ b/source/arb_vertex_shader.cpp @@ -1,19 +1,161 @@ -#include "extension.h" #include "arb_vertex_shader.h" namespace Msp { namespace GL { -PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocationARB = 0; -PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttribARB = 0; -PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARB = 0; +PFNGLBINDATTRIBLOCATIONPROC glBindAttribLocation = 0; +PFNGLDISABLEVERTEXATTRIBARRAYPROC glDisableVertexAttribArray = 0; +PFNGLENABLEVERTEXATTRIBARRAYPROC glEnableVertexAttribArray = 0; +PFNGLGETACTIVEATTRIBPROC glGetActiveAttrib = 0; +PFNGLGETATTRIBLOCATIONPROC glGetAttribLocation = 0; +PFNGLGETVERTEXATTRIBPOINTERVPROC glGetVertexAttribPointerv = 0; +PFNGLGETVERTEXATTRIBDVPROC glGetVertexAttribdv = 0; +PFNGLGETVERTEXATTRIBFVPROC glGetVertexAttribfv = 0; +PFNGLGETVERTEXATTRIBIVPROC glGetVertexAttribiv = 0; +PFNGLVERTEXATTRIB1DPROC glVertexAttrib1d = 0; +PFNGLVERTEXATTRIB1DVPROC glVertexAttrib1dv = 0; +PFNGLVERTEXATTRIB1FPROC glVertexAttrib1f = 0; +PFNGLVERTEXATTRIB1FVPROC glVertexAttrib1fv = 0; +PFNGLVERTEXATTRIB1SPROC glVertexAttrib1s = 0; +PFNGLVERTEXATTRIB1SVPROC glVertexAttrib1sv = 0; +PFNGLVERTEXATTRIB2DPROC glVertexAttrib2d = 0; +PFNGLVERTEXATTRIB2DVPROC glVertexAttrib2dv = 0; +PFNGLVERTEXATTRIB2FPROC glVertexAttrib2f = 0; +PFNGLVERTEXATTRIB2FVPROC glVertexAttrib2fv = 0; +PFNGLVERTEXATTRIB2SPROC glVertexAttrib2s = 0; +PFNGLVERTEXATTRIB2SVPROC glVertexAttrib2sv = 0; +PFNGLVERTEXATTRIB3DPROC glVertexAttrib3d = 0; +PFNGLVERTEXATTRIB3DVPROC glVertexAttrib3dv = 0; +PFNGLVERTEXATTRIB3FPROC glVertexAttrib3f = 0; +PFNGLVERTEXATTRIB3FVPROC glVertexAttrib3fv = 0; +PFNGLVERTEXATTRIB3SPROC glVertexAttrib3s = 0; +PFNGLVERTEXATTRIB3SVPROC glVertexAttrib3sv = 0; +PFNGLVERTEXATTRIB4NBVPROC glVertexAttrib4Nbv = 0; +PFNGLVERTEXATTRIB4NIVPROC glVertexAttrib4Niv = 0; +PFNGLVERTEXATTRIB4NSVPROC glVertexAttrib4Nsv = 0; +PFNGLVERTEXATTRIB4NUBPROC glVertexAttrib4Nub = 0; +PFNGLVERTEXATTRIB4NUBVPROC glVertexAttrib4Nubv = 0; +PFNGLVERTEXATTRIB4NUIVPROC glVertexAttrib4Nuiv = 0; +PFNGLVERTEXATTRIB4NUSVPROC glVertexAttrib4Nusv = 0; +PFNGLVERTEXATTRIB4BVPROC glVertexAttrib4bv = 0; +PFNGLVERTEXATTRIB4DPROC glVertexAttrib4d = 0; +PFNGLVERTEXATTRIB4DVPROC glVertexAttrib4dv = 0; +PFNGLVERTEXATTRIB4FPROC glVertexAttrib4f = 0; +PFNGLVERTEXATTRIB4FVPROC glVertexAttrib4fv = 0; +PFNGLVERTEXATTRIB4IVPROC glVertexAttrib4iv = 0; +PFNGLVERTEXATTRIB4SPROC glVertexAttrib4s = 0; +PFNGLVERTEXATTRIB4SVPROC glVertexAttrib4sv = 0; +PFNGLVERTEXATTRIB4UBVPROC glVertexAttrib4ubv = 0; +PFNGLVERTEXATTRIB4UIVPROC glVertexAttrib4uiv = 0; +PFNGLVERTEXATTRIB4USVPROC glVertexAttrib4usv = 0; +PFNGLVERTEXATTRIBPOINTERPROC glVertexAttribPointer = 0; -void init_arb_vertex_shader() +Extension::SupportLevel init_arb_vertex_shader() { - glBindAttribLocationARB = reinterpret_cast(get_proc_address("glBindAttribLocationARB")); - glGetActiveAttribARB = reinterpret_cast(get_proc_address("glGetActiveAttribARB")); - glGetAttribLocationARB = reinterpret_cast(get_proc_address("glGetAttribLocationARB")); + if(is_version_at_least(2, 0)) + { + glBindAttribLocation = reinterpret_cast(get_proc_address("glBindAttribLocation")); + glDisableVertexAttribArray = reinterpret_cast(get_proc_address("glDisableVertexAttribArray")); + glEnableVertexAttribArray = reinterpret_cast(get_proc_address("glEnableVertexAttribArray")); + glGetActiveAttrib = reinterpret_cast(get_proc_address("glGetActiveAttrib")); + glGetAttribLocation = reinterpret_cast(get_proc_address("glGetAttribLocation")); + glGetVertexAttribPointerv = reinterpret_cast(get_proc_address("glGetVertexAttribPointerv")); + glGetVertexAttribdv = reinterpret_cast(get_proc_address("glGetVertexAttribdv")); + glGetVertexAttribfv = reinterpret_cast(get_proc_address("glGetVertexAttribfv")); + glGetVertexAttribiv = reinterpret_cast(get_proc_address("glGetVertexAttribiv")); + glVertexAttrib1d = reinterpret_cast(get_proc_address("glVertexAttrib1d")); + glVertexAttrib1dv = reinterpret_cast(get_proc_address("glVertexAttrib1dv")); + glVertexAttrib1f = reinterpret_cast(get_proc_address("glVertexAttrib1f")); + glVertexAttrib1fv = reinterpret_cast(get_proc_address("glVertexAttrib1fv")); + glVertexAttrib1s = reinterpret_cast(get_proc_address("glVertexAttrib1s")); + glVertexAttrib1sv = reinterpret_cast(get_proc_address("glVertexAttrib1sv")); + glVertexAttrib2d = reinterpret_cast(get_proc_address("glVertexAttrib2d")); + glVertexAttrib2dv = reinterpret_cast(get_proc_address("glVertexAttrib2dv")); + glVertexAttrib2f = reinterpret_cast(get_proc_address("glVertexAttrib2f")); + glVertexAttrib2fv = reinterpret_cast(get_proc_address("glVertexAttrib2fv")); + glVertexAttrib2s = reinterpret_cast(get_proc_address("glVertexAttrib2s")); + glVertexAttrib2sv = reinterpret_cast(get_proc_address("glVertexAttrib2sv")); + glVertexAttrib3d = reinterpret_cast(get_proc_address("glVertexAttrib3d")); + glVertexAttrib3dv = reinterpret_cast(get_proc_address("glVertexAttrib3dv")); + glVertexAttrib3f = reinterpret_cast(get_proc_address("glVertexAttrib3f")); + glVertexAttrib3fv = reinterpret_cast(get_proc_address("glVertexAttrib3fv")); + glVertexAttrib3s = reinterpret_cast(get_proc_address("glVertexAttrib3s")); + glVertexAttrib3sv = reinterpret_cast(get_proc_address("glVertexAttrib3sv")); + glVertexAttrib4Nbv = reinterpret_cast(get_proc_address("glVertexAttrib4Nbv")); + glVertexAttrib4Niv = reinterpret_cast(get_proc_address("glVertexAttrib4Niv")); + glVertexAttrib4Nsv = reinterpret_cast(get_proc_address("glVertexAttrib4Nsv")); + glVertexAttrib4Nub = reinterpret_cast(get_proc_address("glVertexAttrib4Nub")); + glVertexAttrib4Nubv = reinterpret_cast(get_proc_address("glVertexAttrib4Nubv")); + glVertexAttrib4Nuiv = reinterpret_cast(get_proc_address("glVertexAttrib4Nuiv")); + glVertexAttrib4Nusv = reinterpret_cast(get_proc_address("glVertexAttrib4Nusv")); + glVertexAttrib4bv = reinterpret_cast(get_proc_address("glVertexAttrib4bv")); + glVertexAttrib4d = reinterpret_cast(get_proc_address("glVertexAttrib4d")); + glVertexAttrib4dv = reinterpret_cast(get_proc_address("glVertexAttrib4dv")); + glVertexAttrib4f = reinterpret_cast(get_proc_address("glVertexAttrib4f")); + glVertexAttrib4fv = reinterpret_cast(get_proc_address("glVertexAttrib4fv")); + glVertexAttrib4iv = reinterpret_cast(get_proc_address("glVertexAttrib4iv")); + glVertexAttrib4s = reinterpret_cast(get_proc_address("glVertexAttrib4s")); + glVertexAttrib4sv = reinterpret_cast(get_proc_address("glVertexAttrib4sv")); + glVertexAttrib4ubv = reinterpret_cast(get_proc_address("glVertexAttrib4ubv")); + glVertexAttrib4uiv = reinterpret_cast(get_proc_address("glVertexAttrib4uiv")); + glVertexAttrib4usv = reinterpret_cast(get_proc_address("glVertexAttrib4usv")); + glVertexAttribPointer = reinterpret_cast(get_proc_address("glVertexAttribPointer")); + return Extension::CORE; + } + if(is_supported("GL_ARB_vertex_shader")) + { + glBindAttribLocation = reinterpret_cast(get_proc_address("glBindAttribLocationARB")); + glDisableVertexAttribArray = reinterpret_cast(get_proc_address("glDisableVertexAttribArrayARB")); + glEnableVertexAttribArray = reinterpret_cast(get_proc_address("glEnableVertexAttribArrayARB")); + glGetActiveAttrib = reinterpret_cast(get_proc_address("glGetActiveAttribARB")); + glGetAttribLocation = reinterpret_cast(get_proc_address("glGetAttribLocationARB")); + glGetVertexAttribPointerv = reinterpret_cast(get_proc_address("glGetVertexAttribPointervARB")); + glGetVertexAttribdv = reinterpret_cast(get_proc_address("glGetVertexAttribdvARB")); + glGetVertexAttribfv = reinterpret_cast(get_proc_address("glGetVertexAttribfvARB")); + glGetVertexAttribiv = reinterpret_cast(get_proc_address("glGetVertexAttribivARB")); + glVertexAttrib1d = reinterpret_cast(get_proc_address("glVertexAttrib1dARB")); + glVertexAttrib1dv = reinterpret_cast(get_proc_address("glVertexAttrib1dvARB")); + glVertexAttrib1f = reinterpret_cast(get_proc_address("glVertexAttrib1fARB")); + glVertexAttrib1fv = reinterpret_cast(get_proc_address("glVertexAttrib1fvARB")); + glVertexAttrib1s = reinterpret_cast(get_proc_address("glVertexAttrib1sARB")); + glVertexAttrib1sv = reinterpret_cast(get_proc_address("glVertexAttrib1svARB")); + glVertexAttrib2d = reinterpret_cast(get_proc_address("glVertexAttrib2dARB")); + glVertexAttrib2dv = reinterpret_cast(get_proc_address("glVertexAttrib2dvARB")); + glVertexAttrib2f = reinterpret_cast(get_proc_address("glVertexAttrib2fARB")); + glVertexAttrib2fv = reinterpret_cast(get_proc_address("glVertexAttrib2fvARB")); + glVertexAttrib2s = reinterpret_cast(get_proc_address("glVertexAttrib2sARB")); + glVertexAttrib2sv = reinterpret_cast(get_proc_address("glVertexAttrib2svARB")); + glVertexAttrib3d = reinterpret_cast(get_proc_address("glVertexAttrib3dARB")); + glVertexAttrib3dv = reinterpret_cast(get_proc_address("glVertexAttrib3dvARB")); + glVertexAttrib3f = reinterpret_cast(get_proc_address("glVertexAttrib3fARB")); + glVertexAttrib3fv = reinterpret_cast(get_proc_address("glVertexAttrib3fvARB")); + glVertexAttrib3s = reinterpret_cast(get_proc_address("glVertexAttrib3sARB")); + glVertexAttrib3sv = reinterpret_cast(get_proc_address("glVertexAttrib3svARB")); + glVertexAttrib4Nbv = reinterpret_cast(get_proc_address("glVertexAttrib4NbvARB")); + glVertexAttrib4Niv = reinterpret_cast(get_proc_address("glVertexAttrib4NivARB")); + glVertexAttrib4Nsv = reinterpret_cast(get_proc_address("glVertexAttrib4NsvARB")); + glVertexAttrib4Nub = reinterpret_cast(get_proc_address("glVertexAttrib4NubARB")); + glVertexAttrib4Nubv = reinterpret_cast(get_proc_address("glVertexAttrib4NubvARB")); + glVertexAttrib4Nuiv = reinterpret_cast(get_proc_address("glVertexAttrib4NuivARB")); + glVertexAttrib4Nusv = reinterpret_cast(get_proc_address("glVertexAttrib4NusvARB")); + glVertexAttrib4bv = reinterpret_cast(get_proc_address("glVertexAttrib4bvARB")); + glVertexAttrib4d = reinterpret_cast(get_proc_address("glVertexAttrib4dARB")); + glVertexAttrib4dv = reinterpret_cast(get_proc_address("glVertexAttrib4dvARB")); + glVertexAttrib4f = reinterpret_cast(get_proc_address("glVertexAttrib4fARB")); + glVertexAttrib4fv = reinterpret_cast(get_proc_address("glVertexAttrib4fvARB")); + glVertexAttrib4iv = reinterpret_cast(get_proc_address("glVertexAttrib4ivARB")); + glVertexAttrib4s = reinterpret_cast(get_proc_address("glVertexAttrib4sARB")); + glVertexAttrib4sv = reinterpret_cast(get_proc_address("glVertexAttrib4svARB")); + glVertexAttrib4ubv = reinterpret_cast(get_proc_address("glVertexAttrib4ubvARB")); + glVertexAttrib4uiv = reinterpret_cast(get_proc_address("glVertexAttrib4uivARB")); + glVertexAttrib4usv = reinterpret_cast(get_proc_address("glVertexAttrib4usvARB")); + glVertexAttribPointer = reinterpret_cast(get_proc_address("glVertexAttribPointerARB")); + return Extension::EXTENSION; + } + return Extension::UNSUPPORTED; } +Extension ARB_vertex_shader("GL_ARB_vertex_shader", init_arb_vertex_shader); + } // namespace GL } // namespace Msp