BsGLIndexBuffer.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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::lockImpl
  34. */
  35. void* lockImpl(UINT32 offset, UINT32 length, GpuLockOptions options);
  36. /**
  37. * @copydoc IndexBufferCore::unlockImpl
  38. */
  39. void unlockImpl();
  40. private:
  41. GLuint mBufferId;
  42. bool mZeroLocked;
  43. };
  44. }