BsGLIndexBuffer.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #pragma once
  2. #include "BsGLPrerequisites.h"
  3. #include "BsIndexBuffer.h"
  4. namespace BansheeEngine
  5. {
  6. /**
  7. * @brief OpenGL implementation of an index buffer.
  8. */
  9. class BS_RSGL_EXPORT GLIndexBufferCore : public IndexBufferCore
  10. {
  11. public:
  12. GLIndexBufferCore(IndexType idxType, UINT32 numIndexes, GpuBufferUsage usage);
  13. ~GLIndexBufferCore() { }
  14. /**
  15. * @copydoc IndexBufferCore::readData
  16. */
  17. void readData(UINT32 offset, UINT32 length, void* pDest);
  18. /**
  19. * @copydoc IndexBufferCore::writeData
  20. */
  21. void writeData(UINT32 offset, UINT32 length, const void* pSource,
  22. BufferWriteType writeFlags = BufferWriteType::Normal);
  23. /**
  24. * @brief Returns internal OpenGL index buffer handle.
  25. */
  26. GLuint getGLBufferId() const { return mBufferId; }
  27. protected:
  28. /**
  29. * @copydoc IndexBufferCore::initialize
  30. */
  31. void initialize();
  32. /**
  33. * @copydoc IndexBufferCore::destroy
  34. */
  35. void destroy();
  36. /**
  37. * @copydoc IndexBufferCore::lockImpl
  38. */
  39. void* lockImpl(UINT32 offset, UINT32 length, GpuLockOptions options);
  40. /**
  41. * @copydoc IndexBufferCore::unlockImpl
  42. */
  43. void unlockImpl();
  44. private:
  45. GLuint mBufferId;
  46. bool mZeroLocked;
  47. };
  48. }