BsGLIndexBuffer.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //__________________________ Banshee Project - A modern game development toolkit _________________________________//
  2. //_____________________________________ www.banshee-project.com __________________________________________________//
  3. //________________________ Copyright (c) 2014 Marko Pintera. All rights reserved. ________________________________//
  4. #pragma once
  5. #include "BsGLPrerequisites.h"
  6. #include "BsIndexBuffer.h"
  7. namespace BansheeEngine
  8. {
  9. /**
  10. * @brief OpenGL implementation of an index buffer.
  11. */
  12. class BS_RSGL_EXPORT GLIndexBuffer : public IndexBuffer
  13. {
  14. public:
  15. ~GLIndexBuffer();
  16. /**
  17. * @copydoc IndexBuffer::readData
  18. */
  19. void readData(UINT32 offset, UINT32 length, void* pDest);
  20. /**
  21. * @copydoc IndexBuffer::writeData
  22. */
  23. void writeData(UINT32 offset, UINT32 length, const void* pSource,
  24. BufferWriteType writeFlags = BufferWriteType::Normal);
  25. /**
  26. * @brief Returns internal OpenGL index buffer handle.
  27. */
  28. GLuint getGLBufferId() const { return mBufferId; }
  29. protected:
  30. friend class GLHardwareBufferManager;
  31. GLIndexBuffer(IndexType idxType, UINT32 numIndexes,
  32. GpuBufferUsage usage);
  33. /**
  34. * @copydoc IndexBuffer::initialize_internal
  35. */
  36. void initialize_internal();
  37. /**
  38. * @copydoc IndexBuffer::destroy_internal
  39. */
  40. void destroy_internal();
  41. /**
  42. * @copydoc IndexBuffer::lockImpl
  43. */
  44. void* lockImpl(UINT32 offset, UINT32 length, GpuLockOptions options);
  45. /**
  46. * @copydoc IndexBuffer::unlockImpl
  47. */
  48. void unlockImpl();
  49. private:
  50. GLuint mBufferId;
  51. };
  52. }