Gamp v0.0.8
Gamp: Graphics, Audio, Multimedia and Processing
Loading...
Searching...
No Matches
GLDataArrayHandler.hpp
Go to the documentation of this file.
1/*
2 * Author: Sven Gothel <sgothel@jausoft.com>
3 * Copyright Gothel Software e.K.
4 *
5 * SPDX-License-Identifier: MIT
6 *
7 * This Source Code Form is subject to the terms of the MIT License
8 * If a copy of the MIT was not distributed with this file,
9 * you can obtain one at https://opensource.org/license/mit/.
10 */
11
12#ifndef GAMP_GLDATAARRAYHANDLER_HPP_
13#define GAMP_GLDATAARRAYHANDLER_HPP_
14
15#include <jau/basic_types.hpp>
18
19namespace gamp::render::gl::data::impl {
20 using namespace gamp::render::gl;
21 using namespace gamp::render::gl::data;
22
23 /** \addtogroup Gamp_GLImpl
24 *
25 * @{
26 */
27
28 /**
29 * Used for pure VBO data arrays, i.e. where the buffer data
30 * does not represents a specific array name.
31 */
32 template <typename Value_type>
33 class GLDataArrayHandler : public GLArrayHandler<Value_type> {
34 private:
35 typedef GLArrayHandler<Value_type> glarray_t;
36 using GLArrayHandler<Value_type>::m_ad;
37
38 public:
39 GLDataArrayHandler() noexcept = default;
40
41 void setSubArrayVBOName(GLuint) override {
42 throw jau::UnsupportedOperationException("@GLDataArrayHandler", E_FILE_LINE);
43 }
44
45 void addSubHandler(GLSLSubArrayHandler&&) override {
46 throw jau::UnsupportedOperationException("@GLDataArrayHandler", E_FILE_LINE);
47 }
48
49 void enableState(GL& gl, bool enable, ShaderState*) override {
50 if(enable) {
51 if(!m_ad->isVBO()) {
52 // makes no sense otherwise
53 throw RenderException("GLDataArrayHandler can only handle VBOs.", E_FILE_LINE);
54 }
55 glarray_t::bindBuffer(gl, true);
56 glarray_t::bindBuffer(gl, false);
57 }
58 // no array association
59 }
60 };
61
62 /**@}*/
63}
64
65#endif /* GAMP_GLDATAARRAYHANDLER_HPP_ */
66
#define E_FILE_LINE
uint8_t Value_type