Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef BUFFER_H
- #define BUFFER_H
- #include "GL/gl.h"
- #include "GL/glext.h"
- template <class T>
- class Buffer {
- public:
- virtual void init() = 0;
- virtual T* getPointer() = 0;
- void releasePointer() = 0;
- };
- #endif
- #ifndef PBO_H
- #define PBO_H
- #include "Buffer.h"
- template <typename T>
- class Pbo : public Buffer<T> {
- public:
- virtual void init();
- virtual T* getPointer();
- private:
- GLuint pbo;
- };
- #endif
- #include "Pbo.h"
- using namespace std;
- template <typename T>
- void Pbo<T>::init() {
- GLuint local[1];
- glGenBuffersARB(1, local);
- *pbo = local[0];
- cerr << "glGenBuffersARB: " << glGetError() << endl;
- glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, local[0]);
- cerr << glGetError() << endl;
- // // reserve memory
- glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, bufferSize, NULL, GL_DYNAMIC_DRAW);
- cerr << glGetError() << endl;
- glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
- }
- template <typename T>
- T* Pbo<T>::getPointer() {
- return NULL;
- }
- src/Pbo.cpp: In member function 'virtual void Pbo<T>::init()':
- src/Pbo.cpp:8: error: there are no arguments to 'glGenBuffersARB' that depend on a template paramete
- r, so a declaration of 'glGenBuffersARB' must be available
- src/Pbo.cpp:8: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of
- an undeclared name is deprecated)
- src/Pbo.cpp:9: error: invalid type argument of 'unary *'
- src/Pbo.cpp:10: error: 'cerr' was not declared in this scope
- src/Pbo.cpp:10: error: 'endl' was not declared in this scope
- src/Pbo.cpp:11: error: 'GL_PIXEL_UNPACK_BUFFER_ARB' was not declared in this scope
- src/Pbo.cpp:11: error: there are no arguments to 'glBindBufferARB' that depend on a template paramet
- er, so a declaration of 'glBindBufferARB' must be available
- src/Pbo.cpp:15: error: 'bufferSize' was not declared in this scope
- src/Pbo.cpp:15: error: 'NULL' was not declared in this scope
- src/Pbo.cpp:15: error: 'GL_DYNAMIC_DRAW' was not declared in this scope
- src/Pbo.cpp:15: error: there are no arguments to 'glBufferDataARB' that depend on a template paramet
- er, so a declaration of 'glBufferDataARB' must be available
- src/Pbo.cpp:18: error: there are no arguments to 'glBindBufferARB' that depend on a template paramet
- er, so a declaration of 'glBindBufferARB' must be available
- src/Pbo.cpp: In member function 'virtual T* Pbo<T>::getPointer()':
- src/Pbo.cpp:23: error: 'NULL' was not declared in this scope
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement