12 #include <OpenGL/gl.h>
78 void drawRect(GLfloat tx, GLfloat ty, GLfloat twidth, GLfloat theight,
79 GLint x, GLint y, GLint width, GLint height);
96 void resize(GLsizei width, GLsizei height);
117 GLsizei width, GLsizei height,
127 : bufferId(other.bufferId)
132 std::swap(bufferId, other.bufferId);
175 void setImage(GLuint width, GLuint height);
231 template <
typename T>
234 #ifdef GL_VERSION_1_5
236 GLEW_ARB_pixel_buffer_object) {
237 glGenBuffers(1, &bufferId);
246 template <
typename T>
248 : allocated(std::move(other.allocated))
249 , bufferId(other.bufferId)
251 , height(other.height)
256 template <
typename T>
259 std::swap(allocated, other.allocated);
260 std::swap(bufferId, other.bufferId);
261 std::swap(width, other.width);
262 std::swap(height, other.height);
266 template <
typename T>
269 #ifdef GL_VERSION_1_5
271 glDeleteBuffers(1, &bufferId);
276 template <
typename T>
279 return bufferId != 0;
282 template <
typename T>
286 this->height = height;
287 #ifdef GL_VERSION_1_5
291 glBufferData(GL_PIXEL_UNPACK_BUFFER_ARB,
299 allocated.resize(width * height);
303 template <
typename T>
306 #ifdef GL_VERSION_1_5
308 glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, bufferId);
313 template <
typename T>
316 #ifdef GL_VERSION_1_5
318 glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
323 template <
typename T>
328 unsigned offset = x + width * y;
329 #ifdef GL_VERSION_1_5
331 return static_cast<T*
>(
nullptr) + offset;
334 return &allocated[
offset];
337 template <
typename T>
340 #ifdef GL_VERSION_1_5
342 return reinterpret_cast<T*
>(glMapBuffer(
343 GL_PIXEL_UNPACK_BUFFER_ARB, GL_WRITE_ONLY));
346 return allocated.data();
349 template <
typename T>
352 #ifdef GL_VERSION_1_5
354 glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER_ARB);
376 Shader(GLenum type,
const std::string& filename);
377 Shader(GLenum type,
const std::string& header,
378 const std::string& filename);
382 void init(GLenum type,
const std::string& header,
383 const std::string& filename);
400 VertexShader(
const std::string& header,
const std::string& filename);
413 FragmentShader(
const std::string& header,
const std::string& filename);
462 #endif // COMPONENT_GL