Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.42 KB | None | 0 0
  1. #ifndef BUFFER_H
  2. #define BUFFER_H
  3.  
  4. #include "GL/gl.h"
  5. #include "GL/glext.h"
  6.  
  7. template <class T>
  8. class Buffer {
  9.  
  10. public:
  11.     virtual void init() = 0;
  12.     virtual T* getPointer() = 0;
  13.     void releasePointer() = 0;
  14. };
  15.  
  16. #endif
  17.  
  18.  
  19. #ifndef PBO_H
  20. #define PBO_H
  21.  
  22. #include "Buffer.h"
  23.  
  24. template <typename T>
  25. class Pbo : public Buffer<T> {
  26. public:
  27.     virtual void init();
  28.     virtual T* getPointer();
  29. private:
  30.     GLuint pbo;
  31. };
  32.  
  33. #endif
  34.  
  35.  
  36.  
  37. #include "Pbo.h"
  38.  
  39. using namespace std;
  40.  
  41. template <typename T>
  42. void Pbo<T>::init() {
  43.     GLuint local[1];
  44.     glGenBuffersARB(1, local);
  45.     *pbo = local[0];
  46.     cerr <<  "glGenBuffersARB: " << glGetError() << endl;
  47.     glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, local[0]);
  48.     cerr <<  glGetError() << endl;
  49.  
  50.     // // reserve memory   
  51.     glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, bufferSize, NULL, GL_DYNAMIC_DRAW);
  52.     cerr <<  glGetError() << endl;
  53.  
  54.     glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
  55. }
  56.  
  57. template <typename T>
  58. T* Pbo<T>::getPointer() {
  59.     return NULL;
  60. }
  61.  
  62.  
  63.  
  64.  
  65.  
  66. src/Pbo.cpp: In member function 'virtual void Pbo<T>::init()':
  67. src/Pbo.cpp:8: error: there are no arguments to 'glGenBuffersARB' that depend on a template paramete
  68. r, so a declaration of 'glGenBuffersARB' must be available
  69. src/Pbo.cpp:8: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of
  70. an undeclared name is deprecated)
  71. src/Pbo.cpp:9: error: invalid type argument of 'unary *'
  72. src/Pbo.cpp:10: error: 'cerr' was not declared in this scope
  73. src/Pbo.cpp:10: error: 'endl' was not declared in this scope
  74. src/Pbo.cpp:11: error: 'GL_PIXEL_UNPACK_BUFFER_ARB' was not declared in this scope
  75. src/Pbo.cpp:11: error: there are no arguments to 'glBindBufferARB' that depend on a template paramet
  76. er, so a declaration of 'glBindBufferARB' must be available
  77. src/Pbo.cpp:15: error: 'bufferSize' was not declared in this scope
  78. src/Pbo.cpp:15: error: 'NULL' was not declared in this scope
  79. src/Pbo.cpp:15: error: 'GL_DYNAMIC_DRAW' was not declared in this scope
  80. src/Pbo.cpp:15: error: there are no arguments to 'glBufferDataARB' that depend on a template paramet
  81. er, so a declaration of 'glBufferDataARB' must be available
  82. src/Pbo.cpp:18: error: there are no arguments to 'glBindBufferARB' that depend on a template paramet
  83. er, so a declaration of 'glBindBufferARB' must be available
  84. src/Pbo.cpp: In member function 'virtual T* Pbo<T>::getPointer()':
  85. src/Pbo.cpp:23: error: 'NULL' was not declared in this scope
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement