BsGLIndexBuffer.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 GLIndexBuffer : public IndexBuffer
  10. {
  11. public:
  12. ~GLIndexBuffer();
  13. /**
  14. * @copydoc IndexBuffer::readData
  15. */
  16. void readData(UINT32 offset, UINT32 length, void* pDest);
  17. /**
  18. * @copydoc IndexBuffer::writeData
  19. */
  20. void writeData(UINT32 offset, UINT32 length, const void* pSource,
  21. BufferWriteType writeFlags = BufferWriteType::Normal);
  22. /**
  23. * @brief Returns internal OpenGL index buffer handle.
  24. */
  25. GLuint getGLBufferId() const { return mBufferId; }
  26. protected:
  27. friend class GLHardwareBufferManager;
  28. GLIndexBuffer(IndexType idxType, UINT32 numIndexes,
  29. GpuBufferUsage usage);
  30. /**
  31. * @copydoc IndexBuffer::initialize_internal
  32. */
  33. void initialize_internal();
  34. /**
  35. * @copydoc IndexBuffer::destroy_internal
  36. */
  37. void destroy_internal();
  38. /**
  39. * @copydoc IndexBuffer::lockImpl
  40. */
  41. void* lockImpl(UINT32 offset, UINT32 length, GpuLockOptions options);
  42. /**
  43. * @copydoc IndexBuffer::unlockImpl
  44. */
  45. void unlockImpl();
  46. private:
  47. GLuint mBufferId;
  48. bool mZeroLocked;
  49. };
  50. }