MCPcopy Create free account
hub / github.com/arrayfire/forge / AbstractRenderable

Class AbstractRenderable

src/backend/opengl/common.hpp:192–306  ·  view source on GitHub ↗

Basic renderable class * * Any object that is renderable to a window should inherit from this * class. */

Source from the content-addressed store, hash-verified

190 * class.
191 */
192class AbstractRenderable {
193 protected:
194 /* OpenGL buffer objects */
195 gl::GLuint mVBO;
196 gl::GLuint mCBO;
197 gl::GLuint mABO;
198 size_t mVBOSize;
199 size_t mCBOSize;
200 size_t mABOSize;
201 gl::GLfloat mColor[4];
202 gl::GLfloat mRange[6];
203 std::string mLegend;
204 bool mIsPVCOn;
205 bool mIsPVAOn;
206
207 AbstractRenderable():
208 mVBO(0), mCBO(0), mABO(0),
209 mVBOSize(0), mCBOSize(0), mABOSize(0),
210 mIsPVCOn(0), mIsPVAOn(0)
211 {
212 mColor[0] = 0;
213 mColor[1] = 0;
214 mColor[2] = 0;
215 mColor[3] = 0;
216
217 mRange[0] = 0;
218 mRange[1] = 0;
219 mRange[2] = 0;
220 mRange[3] = 0;
221 mRange[4] = 0;
222 mRange[5] = 0;
223 }
224
225 public:
226 /* Getter functions for OpenGL buffer objects
227 * identifiers and their size in bytes
228 *
229 * vbo is for vertices
230 * cbo is for colors of those vertices
231 * abo is for alpha values for those vertices
232 */
233 gl::GLuint vbo() const { return mVBO; }
234 gl::GLuint cbo() { mIsPVCOn = true; return mCBO; }
235 gl::GLuint abo() { mIsPVAOn = true; return mABO; }
236 size_t vboSize() const { return mVBOSize; }
237 size_t cboSize() const { return mCBOSize; }
238 size_t aboSize() const { return mABOSize; }
239
240 /* Set color for rendering
241 */
242 void setColor(const float pRed, const float pGreen,
243 const float pBlue, const float pAlpha) {
244 mColor[0] = clampTo01(pRed);
245 mColor[1] = clampTo01(pGreen);
246 mColor[2] = clampTo01(pBlue);
247 mColor[3] = clampTo01(pAlpha);
248 }
249

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected