BsGLIndexBuffer.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsGLPrerequisites.h"
  5. #include "BsIndexBuffer.h"
  6. namespace BansheeEngine
  7. {
  8. /**
  9. * @brief OpenGL implementation of an index buffer.
  10. */
  11. class BS_RSGL_EXPORT GLIndexBufferCore : public IndexBufferCore
  12. {
  13. public:
  14. GLIndexBufferCore(IndexType idxType, UINT32 numIndexes, GpuBufferUsage usage);
  15. ~GLIndexBufferCore();
  16. /**
  17. * @copydoc IndexBufferCore::readData
  18. */
  19. void readData(UINT32 offset, UINT32 length, void* pDest);
  20. /**
  21. * @copydoc IndexBufferCore::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. /**
  31. * @copydoc IndexBufferCore::initialize
  32. */
  33. void initialize();
  34. /**
  35. * @copydoc IndexBufferCore::lockImpl
  36. */
  37. void* lockImpl(UINT32 offset, UINT32 length, GpuLockOptions options);
  38. /**
  39. * @copydoc IndexBufferCore::unlockImpl
  40. */
  41. void unlockImpl();
  42. private:
  43. GLuint mBufferId;
  44. bool mZeroLocked;
  45. };
  46. }