X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Farb_vertex_shader.cpp;h=b201802e5bb171ed554f769e4e64efa124affc93;hb=a3d248c7db9f04919ed5e4053f6e2a2f776cec47;hp=612c5033fe0fe2fd50c4ecc00ef1b77b705cad67;hpb=b617c5d7b5283ad260a77f01e42e6170cabbc03d;p=libs%2Fgl.git diff --git a/source/arb_vertex_shader.cpp b/source/arb_vertex_shader.cpp index 612c5033..b201802e 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; +PFNGLBINDATTRIBLOCATIONARBPROC glBindAttribLocation = 0; +PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArray = 0; +PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArray = 0; +PFNGLGETACTIVEATTRIBARBPROC glGetActiveAttrib = 0; +PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocation = 0; +PFNGLGETVERTEXATTRIBPOINTERVARBPROC glGetVertexAttribPointerv = 0; +PFNGLGETVERTEXATTRIBDVARBPROC glGetVertexAttribdv = 0; +PFNGLGETVERTEXATTRIBFVARBPROC glGetVertexAttribfv = 0; +PFNGLGETVERTEXATTRIBIVARBPROC glGetVertexAttribiv = 0; +PFNGLVERTEXATTRIB1DARBPROC glVertexAttrib1d = 0; +PFNGLVERTEXATTRIB1DVARBPROC glVertexAttrib1dv = 0; +PFNGLVERTEXATTRIB1FARBPROC glVertexAttrib1f = 0; +PFNGLVERTEXATTRIB1FVARBPROC glVertexAttrib1fv = 0; +PFNGLVERTEXATTRIB1SARBPROC glVertexAttrib1s = 0; +PFNGLVERTEXATTRIB1SVARBPROC glVertexAttrib1sv = 0; +PFNGLVERTEXATTRIB2DARBPROC glVertexAttrib2d = 0; +PFNGLVERTEXATTRIB2DVARBPROC glVertexAttrib2dv = 0; +PFNGLVERTEXATTRIB2FARBPROC glVertexAttrib2f = 0; +PFNGLVERTEXATTRIB2FVARBPROC glVertexAttrib2fv = 0; +PFNGLVERTEXATTRIB2SARBPROC glVertexAttrib2s = 0; +PFNGLVERTEXATTRIB2SVARBPROC glVertexAttrib2sv = 0; +PFNGLVERTEXATTRIB3DARBPROC glVertexAttrib3d = 0; +PFNGLVERTEXATTRIB3DVARBPROC glVertexAttrib3dv = 0; +PFNGLVERTEXATTRIB3FARBPROC glVertexAttrib3f = 0; +PFNGLVERTEXATTRIB3FVARBPROC glVertexAttrib3fv = 0; +PFNGLVERTEXATTRIB3SARBPROC glVertexAttrib3s = 0; +PFNGLVERTEXATTRIB3SVARBPROC glVertexAttrib3sv = 0; +PFNGLVERTEXATTRIB4NBVARBPROC glVertexAttrib4Nbv = 0; +PFNGLVERTEXATTRIB4NIVARBPROC glVertexAttrib4Niv = 0; +PFNGLVERTEXATTRIB4NSVARBPROC glVertexAttrib4Nsv = 0; +PFNGLVERTEXATTRIB4NUBARBPROC glVertexAttrib4Nub = 0; +PFNGLVERTEXATTRIB4NUBVARBPROC glVertexAttrib4Nubv = 0; +PFNGLVERTEXATTRIB4NUIVARBPROC glVertexAttrib4Nuiv = 0; +PFNGLVERTEXATTRIB4NUSVARBPROC glVertexAttrib4Nusv = 0; +PFNGLVERTEXATTRIB4BVARBPROC glVertexAttrib4bv = 0; +PFNGLVERTEXATTRIB4DARBPROC glVertexAttrib4d = 0; +PFNGLVERTEXATTRIB4DVARBPROC glVertexAttrib4dv = 0; +PFNGLVERTEXATTRIB4FARBPROC glVertexAttrib4f = 0; +PFNGLVERTEXATTRIB4FVARBPROC glVertexAttrib4fv = 0; +PFNGLVERTEXATTRIB4IVARBPROC glVertexAttrib4iv = 0; +PFNGLVERTEXATTRIB4SARBPROC glVertexAttrib4s = 0; +PFNGLVERTEXATTRIB4SVARBPROC glVertexAttrib4sv = 0; +PFNGLVERTEXATTRIB4UBVARBPROC glVertexAttrib4ubv = 0; +PFNGLVERTEXATTRIB4UIVARBPROC glVertexAttrib4uiv = 0; +PFNGLVERTEXATTRIB4USVARBPROC glVertexAttrib4usv = 0; +PFNGLVERTEXATTRIBPOINTERARBPROC 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