]> git.tdb.fi Git - libs/gl.git/commitdiff
Completely hide OpenGL from the public headers
authorMikko Rasa <tdb@tdb.fi>
Thu, 30 Sep 2021 13:19:48 +0000 (16:19 +0300)
committerMikko Rasa <tdb@tdb.fi>
Thu, 30 Sep 2021 13:29:12 +0000 (16:29 +0300)
27 files changed:
source/core/batch.h
source/core/blend.cpp
source/core/blend.h
source/core/buffer.h
source/core/datatype.h
source/core/framebuffer.cpp
source/core/framebuffer.h
source/core/frameformat.cpp
source/core/frameformat.h
source/core/matrix.h
source/core/module.h
source/core/pipelinestate.cpp
source/core/pixelformat.cpp
source/core/pixelformat.h
source/core/predicate.cpp
source/core/predicate.h
source/core/primitivetype.cpp
source/core/primitivetype.h
source/core/program.h
source/core/sampler.cpp
source/core/sampler.h
source/core/stenciltest.cpp
source/core/stenciltest.h
source/core/texture.cpp
source/core/texture.h
source/core/texturecube.cpp
source/core/texturecube.h

index 6f7e43d61be4e0ca0078e37c2032ab4c006de5b6..41dac24a1a57b8bef3abb4a657ee9e88572c9001 100644 (file)
@@ -33,9 +33,9 @@ public:
 
 private:
        PrimitiveType prim_type;
-       GLenum gl_prim_type;
+       unsigned gl_prim_type;
        DataType index_type;
-       GLenum gl_index_type;
+       unsigned gl_index_type;
        std::vector<std::uint8_t> data;
        unsigned max_index;
 
@@ -44,10 +44,10 @@ public:
        ~Batch();
 
        PrimitiveType get_type() const { return prim_type; }
-       GLenum get_gl_primitive_type() const { return gl_prim_type; }
+       unsigned get_gl_primitive_type() const { return gl_prim_type; }
        void set_index_type(DataType);
        DataType get_index_type() const { return index_type; }
-       GLenum get_gl_index_type() const { return gl_index_type; }
+       unsigned get_gl_index_type() const { return gl_index_type; }
 
        Batch &append(unsigned);
        Batch &append(const std::vector<unsigned> &);
index a5e8f44d2917ffc8c7fc2e48cb784b28b3ec01fd..324440d32e9362ad39c33c3e7afafeb878aed37b 100644 (file)
@@ -60,7 +60,7 @@ void Blend::Loader::factors(BlendFactor sf, BlendFactor df)
 }
 
 
-GLenum get_gl_blend_equation(BlendEquation eq)
+unsigned get_gl_blend_equation(BlendEquation eq)
 {
        switch(eq)
        {
@@ -73,7 +73,7 @@ GLenum get_gl_blend_equation(BlendEquation eq)
        }
 }
 
-GLenum get_gl_blend_factor(BlendFactor factor)
+unsigned get_gl_blend_factor(BlendFactor factor)
 {
        switch(factor)
        {
index 986844c0e6a7e1f2caa15249a8c7d8531bd4bf09..ad7ba241bd1b1028e7e1bea45b5477f6b66245f6 100644 (file)
@@ -4,7 +4,6 @@
 #include <msp/datafile/objectloader.h>
 #include <msp/strings/lexicalcast.h>
 #include "color.h"
-#include "gl.h"
 
 namespace Msp {
 namespace GL {
@@ -63,8 +62,8 @@ struct Blend
        Blend(BlendEquation, BlendFactor, BlendFactor);
 };
 
-GLenum get_gl_blend_equation(BlendEquation);
-GLenum get_gl_blend_factor(BlendFactor);
+unsigned get_gl_blend_equation(BlendEquation);
+unsigned get_gl_blend_factor(BlendFactor);
 
 void operator>>(const LexicalConverter &, BlendEquation &);
 void operator<<(LexicalConverter &, BlendEquation);
index 0fb2cde18d68f9ca29859d6db578396ff7e5d125..0e1836888dfbdd083ce47fe4c9af5dbfe6bfa3a5 100644 (file)
@@ -4,7 +4,6 @@
 #include <stdexcept>
 #include <string>
 #include <vector>
-#include "gl.h"
 
 namespace Msp {
 namespace GL {
index 7188cb5a9c847b37a8f455d682ad660189e131f5..1620dc58933d7fe1b5f9ae130ab7bff7fa104c11 100644 (file)
@@ -3,7 +3,6 @@
 
 #include <msp/linal/matrix.h>
 #include <msp/linal/vector.h>
-#include "gl.h"
 
 namespace Msp {
 namespace GL {
@@ -133,8 +132,8 @@ struct TypeTraits<LinAl::Matrix<T, N, M>>
        static const DataType type = static_cast<DataType>((TypeTraits<T>::type&0xF00) | ((TypeTraits<T>::type&0xFF)*N*M) | ((N-1)<<12) | ((M-1)<<14));
 };
 
-GLenum get_gl_type(DataType);
-DataType from_gl_type(GLenum);
+unsigned get_gl_type(DataType);
+DataType from_gl_type(unsigned);
 
 void require_type(DataType);
 
index 576552057fda35df9e954d0cebce32b8107f0c86..53234cc74696478a630acc11b7fcdcfbfe4e11c9 100644 (file)
@@ -1,5 +1,6 @@
 #include <msp/gl/extensions/arb_draw_buffers.h>
 #include <msp/gl/extensions/arb_direct_state_access.h>
+#include <msp/gl/extensions/arb_geometry_shader4.h>
 #include <msp/gl/extensions/arb_internalformat_query.h>
 #include <msp/gl/extensions/arb_internalformat_query2.h>
 #include <msp/gl/extensions/ext_framebuffer_object.h>
index a58d31d890927f0a59261169748554b24c49c29b..89407e8ba69b270bcc4f707eed89dc81a6b52028 100644 (file)
@@ -5,10 +5,6 @@
 #include "color.h"
 #include "frameformat.h"
 #include "texturecube.h"
-#include <msp/gl/extensions/arb_geometry_shader4.h>
-#include <msp/gl/extensions/ext_framebuffer_multisample.h>
-#include <msp/gl/extensions/ext_framebuffer_object.h>
-#include <msp/gl/extensions/nv_fbo_color_attachments.h>
 
 namespace Msp {
 namespace GL {
index f56d13a68b27db15bd98c9fb97fa5e187bd23fe6..3568dffa4b11ee7d29e0fe01c94e23e9fc8c1cb6 100644 (file)
@@ -1,6 +1,7 @@
 #include "deviceinfo.h"
 #include "error.h"
 #include "frameformat.h"
+#include "gl.h"
 
 using namespace std;
 
@@ -123,7 +124,7 @@ PixelFormat get_attachment_pixelformat(FrameAttachment fa)
        return make_pixelformat(comp, type);
 }
 
-GLenum get_gl_attachment(FrameAttachment fa)
+unsigned get_gl_attachment(FrameAttachment fa)
 {
        if(get_attach_point(fa)==get_attach_point(DEPTH_ATTACHMENT))
                return GL_DEPTH_ATTACHMENT;
@@ -133,9 +134,9 @@ GLenum get_gl_attachment(FrameAttachment fa)
                return GL_COLOR_ATTACHMENT0+get_attach_point(fa);
 }
 
-GLenum get_gl_buffer_bits(const FrameFormat &format)
+unsigned get_gl_buffer_bits(const FrameFormat &format)
 {
-       GLenum bits = 0;
+       unsigned bits = 0;
        for(FrameAttachment a: format)
        {
                if(get_attach_point(a)==get_attach_point(DEPTH_ATTACHMENT))
index a78985f38583fa5227c7683bfa9716ca300f3849..c3f6eae7d510c988c748d4a5f493eb73db59f392 100644 (file)
@@ -76,8 +76,8 @@ inline unsigned get_attach_point(FrameAttachment fa)
 
 PixelFormat get_attachment_pixelformat(FrameAttachment);
 
-GLenum get_gl_attachment(FrameAttachment);
-GLenum get_gl_buffer_bits(const FrameFormat &);
+unsigned get_gl_attachment(FrameAttachment);
+unsigned get_gl_buffer_bits(const FrameFormat &);
 
 } // namespace GL
 } // namespace Msp
index cb61e292f0eaad46a195995f6c92a5bbf7c1afe8..e2f1ada0cc527cf30210874b1a4cfc4a69f98f4d 100644 (file)
@@ -4,7 +4,6 @@
 #include <vector>
 #include <msp/geometry/angle.h>
 #include <msp/linal/squarematrix.h>
-#include "gl.h"
 #include "vector.h"
 
 namespace Msp {
index 5ea0149d2074e498e11e58ec97cfdd072b1ab642..14a57fe84436e5d93e707e6f635a608a222f47f1 100644 (file)
@@ -4,7 +4,6 @@
 #include <string>
 #include <msp/io/base.h>
 #include "datatype.h"
-#include "gl.h"
 #include "glsl/compiler.h"
 #include "glsl/sourcemap.h"
 
index 871336bb76b25b43b6928aa41b7384e7f0410f5b..d99a387857ae9c9a2efd63221a2ab6f4374c7f62 100644 (file)
@@ -5,6 +5,7 @@
 #include <msp/gl/extensions/arb_shader_objects.h>
 #include <msp/gl/extensions/arb_uniform_buffer_object.h>
 #include <msp/gl/extensions/arb_vertex_array_object.h>
+#include <msp/gl/extensions/ext_framebuffer_object.h>
 #include <msp/gl/extensions/msp_primitive_restart.h>
 #include "blend.h"
 #include "buffer.h"
index 1ee0cd09dcf0458fe5d010e61aca1c2d6c8a8813..6be6d7c97b36e00882022eae4b28ad314e3fc593 100644 (file)
@@ -169,7 +169,7 @@ void require_pixelformat(PixelFormat pf)
        }
 }
 
-GLenum get_gl_components(PixelComponents comp)
+unsigned get_gl_components(PixelComponents comp)
 {
        switch(comp)
        {
@@ -183,7 +183,7 @@ GLenum get_gl_components(PixelComponents comp)
        }
 }
 
-GLenum get_gl_pixelformat(PixelFormat pf)
+unsigned get_gl_pixelformat(PixelFormat pf)
 {
        switch(pf)
        {
index 75651a8f872edfb93c6ab4849b54455f5867063f..65331c99901fcd5aefee7b78e1fef5727579af9e 100644 (file)
@@ -3,7 +3,6 @@
 
 #include <msp/graphics/image.h>
 #include <msp/strings/lexicalcast.h>
-#include "gl.h"
 #include "datatype.h"
 
 namespace Msp {
@@ -99,8 +98,8 @@ inline unsigned get_pixel_size(PixelFormat f) { return get_component_count(f)*ge
 
 void require_pixelformat(PixelFormat);
 
-GLenum get_gl_components(PixelComponents);
-GLenum get_gl_pixelformat(PixelFormat);
+unsigned get_gl_components(PixelComponents);
+unsigned get_gl_pixelformat(PixelFormat);
 
 } // namespace GL
 } // namespace Msp
index 4afc6c0343ca89166283c6f3268c1bc9880c9d4f..7b0c0587f845766dfc73c9f186e0b35501923903 100644 (file)
@@ -1,4 +1,5 @@
 #include <msp/strings/format.h>
+#include "gl.h"
 #include "predicate.h"
 
 using namespace std;
@@ -6,7 +7,7 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-GLenum get_gl_predicate(Predicate pred)
+unsigned get_gl_predicate(Predicate pred)
 {
        switch(pred)
        {
index c7e5991ea03c2c205b8b07a7fa310b2c1927c7f7..079ef63e3daa0fb493d965ed389b74f37ebf254a 100644 (file)
@@ -2,7 +2,6 @@
 #define MSP_GL_PREDICATE_H_
 
 #include <msp/strings/lexicalcast.h>
-#include "gl.h"
 
 namespace Msp {
 namespace GL {
@@ -19,7 +18,7 @@ enum Predicate
        NOTEQUAL
 };
 
-GLenum get_gl_predicate(Predicate);
+unsigned get_gl_predicate(Predicate);
 
 void operator>>(const LexicalConverter &, Predicate &);
 void operator<<(LexicalConverter &, Predicate);
index 848da8000d786ee26d05d8007453e90437bdac7b..416ebae2bff1b7d9fdd02ec64cb2a97c69c1780c 100644 (file)
@@ -1,4 +1,5 @@
 #include <msp/strings/format.h>
+#include "gl.h"
 #include "primitivetype.h"
 
 using namespace std;
@@ -6,7 +7,7 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-GLenum get_gl_primitive_type(PrimitiveType pt)
+unsigned get_gl_primitive_type(PrimitiveType pt)
 {
        switch(pt)
        {
index b0854331423d2aa12748e57d603a0ac9061de6b8..cbcb187c942739a6958db9f179e42b90573395bc 100644 (file)
@@ -2,7 +2,6 @@
 #define MSP_GL_PRIMITIVETYPE_H_
 
 #include <msp/strings/lexicalcast.h>
-#include "gl.h"
 
 namespace Msp {
 namespace GL {
@@ -18,7 +17,7 @@ enum PrimitiveType
        TRIANGLE_FAN
 };
 
-GLenum get_gl_primitive_type(PrimitiveType);
+unsigned get_gl_primitive_type(PrimitiveType);
 
 void operator>>(const LexicalConverter &, PrimitiveType &);
 
index b384defe90fa0d7904133a37bd3f66429c1f88fa..fb7fdddef91c735cd50cf3375923b8613d417635 100644 (file)
@@ -4,7 +4,6 @@
 #include <string>
 #include <vector>
 #include <msp/datafile/objectloader.h>
-#include "gl.h"
 #include "module.h"
 #include "reflectdata.h"
 #include "vertexformat.h"
index 45db298064bce9ade85a978f52ed8bebd70d743a..c36e9852c264418a50ac618a4c84cb4fd184043a 100644 (file)
@@ -218,7 +218,7 @@ bool is_mipmapped(TextureFilter filter)
                filter==LINEAR_MIPMAP_NEAREST || filter==LINEAR_MIPMAP_LINEAR);
 }
 
-GLenum get_gl_filter(TextureFilter filter)
+unsigned get_gl_filter(TextureFilter filter)
 {
        switch(filter)
        {
@@ -232,7 +232,7 @@ GLenum get_gl_filter(TextureFilter filter)
        }
 }
 
-GLenum get_gl_wrap(TextureWrap wrap)
+unsigned get_gl_wrap(TextureWrap wrap)
 {
        switch(wrap)
        {
index 852c971003359bb7d0f0341dd97becef7242017d..b2011d3bed3db8dc7631fc3224c37c6011d39c3f 100644 (file)
@@ -3,7 +3,6 @@
 
 #include <msp/datafile/objectloader.h>
 #include "color.h"
-#include "gl.h"
 #include "predicate.h"
 
 namespace Msp {
@@ -159,8 +158,8 @@ public:
 
 
 bool is_mipmapped(TextureFilter);
-GLenum get_gl_filter(TextureFilter);
-GLenum get_gl_wrap(TextureWrap);
+unsigned get_gl_filter(TextureFilter);
+unsigned get_gl_wrap(TextureWrap);
 
 void operator>>(const LexicalConverter &, TextureFilter &);
 void operator>>(const LexicalConverter &, TextureWrap &);
index 7076f4d72dd205aec28341bee9ea01b92012dd36..57a191cfad95f83620b5ac1f35487adf9d49cc2f 100644 (file)
@@ -1,5 +1,6 @@
 #include <stdexcept>
 #include <msp/strings/format.h>
+#include "gl.h"
 #include "stenciltest.h"
 
 using namespace std;
@@ -39,7 +40,7 @@ void StencilTest::Loader::actions(StencilOp sf, StencilOp df, StencilOp dp)
 }
 
 
-GLenum get_gl_stencil_op(StencilOp op)
+unsigned get_gl_stencil_op(StencilOp op)
 {
        switch(op)
        {
index cdc613886e4e3adc9002d99f787340e093e50e12..e33882dfc566570c38da5b4e3dbb4c581a10d92c 100644 (file)
@@ -47,7 +47,7 @@ struct StencilTest
        StencilTest();
 };
 
-GLenum get_gl_stencil_op(StencilOp);
+unsigned get_gl_stencil_op(StencilOp);
 
 void operator>>(const LexicalConverter &, StencilOp &);
 void operator<<(LexicalConverter &, StencilOp);
index 877e4d10c38f6ab60d64fd7166e4e56d5d1f2674..ef8b7eef48584db1b9680338cf67b9df1d31f452 100644 (file)
@@ -125,7 +125,7 @@ void Texture::apply_swizzle()
        }
 }
 
-void Texture::set_parameter_i(GLenum param, int value) const
+void Texture::set_parameter_i(unsigned param, int value) const
 {
        if(ARB_direct_state_access)
                glTextureParameteri(id, param, value);
index 6d474b8864ec392375041e47821ca29016d66006..47b2f2696efd35bd07b0c8c52811cc46359d2d63 100644 (file)
@@ -3,7 +3,6 @@
 
 #include <msp/datafile/objectloader.h>
 #include <msp/graphics/image.h>
-#include "gl.h"
 #include "pixelformat.h"
 #include "resource.h"
 
@@ -58,7 +57,7 @@ protected:
        };
 
        unsigned id;
-       GLenum target;
+       unsigned target;
        PixelFormat format;
        PixelFormat storage_fmt;
        FormatSwizzle swizzle;
@@ -69,7 +68,7 @@ protected:
        static const int swizzle_orders[];
        static Texture *scratch_binding;
 
-       Texture(GLenum, ResourceManager * = 0);
+       Texture(unsigned, ResourceManager * = 0);
        Texture(const Texture &);
        Texture &operator=(const Texture &);
 public:
@@ -79,7 +78,7 @@ protected:
        void generate_id();
        void set_format(PixelFormat);
        void apply_swizzle();
-       void set_parameter_i(GLenum, int) const;
+       void set_parameter_i(unsigned, int) const;
 
 public:
        PixelFormat get_format() const { return format; }
index 3f8eabb3ed8a31b86d2ad236d34cf1095ce285f4..6239688cb304d66a381298d8057d4c9d3330a046 100644 (file)
@@ -248,7 +248,7 @@ void TextureCube::Loader::storage_levels(PixelFormat fmt, unsigned s, unsigned l
 }
 
 
-GLenum get_gl_cube_face(TextureCubeFace face)
+unsigned get_gl_cube_face(TextureCubeFace face)
 {
        switch(face)
        {
index 5818458618de4e32df8c4d846fdf978e49bc1737..8bb5cf43131f101fb5089b7913d091a510ada681 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef MSP_GL_TEXTURECUBE_H_
 #define MSP_GL_TEXTURECUBE_H_
 
-#include <msp/gl/extensions/arb_texture_cube_map.h>
 #include <msp/graphics/image.h>
 #include "texture.h"
 #include "vector.h"
@@ -104,7 +103,7 @@ public:
        virtual void unload() { }
 };
 
-GLenum get_gl_cube_face(TextureCubeFace);
+unsigned get_gl_cube_face(TextureCubeFace);
 
 void operator>>(const LexicalConverter &, TextureCubeFace &);