Fixed glVertexBuffer
- Fixed glVertexBuffer multiplying count by size of float instead of stride
      * = Fixed TintedTexture for OpenGL
			
			
This commit is contained in:
		
							parent
							
								
									367bce3596
								
							
						
					
					
						commit
						cc41ce24d5
					
				
					 7 changed files with 10 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -13,5 +13,6 @@ out vec2 vso_TexCoord;
 | 
			
		|||
void main()
 | 
			
		||||
{
 | 
			
		||||
	gl_Position = u_ViewProjection * a_Position;
 | 
			
		||||
 | 
			
		||||
	vso_TexCoord = a_TexCoord;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -37,7 +37,7 @@ namespace Light {
 | 
			
		|||
		switch (GraphicsContext::GetGraphicsAPI())
 | 
			
		||||
		{
 | 
			
		||||
		case GraphicsAPI::OpenGL:
 | 
			
		||||
			return CreateRef<glVertexBuffer>(vertices, count);
 | 
			
		||||
			return CreateRef<glVertexBuffer>(vertices, stride, count);
 | 
			
		||||
			
 | 
			
		||||
		case GraphicsAPI::DirectX: LT_WIN(
 | 
			
		||||
			return CreateRef<dxVertexBuffer>(vertices, stride, count, std::static_pointer_cast<dxSharedContext>(sharedContext));)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,7 +22,7 @@ namespace Light {
 | 
			
		|||
	Renderer::Renderer(GLFWwindow* windowHandle, Ref<SharedContext> sharedContext)
 | 
			
		||||
		: m_QuadRenderer(LT_MAX_QUAD_RENDERER_VERTICES, sharedContext),
 | 
			
		||||
		  m_TextureRenderer(LT_MAX_TEXTURE_RENDERER_VERTICES, sharedContext),
 | 
			
		||||
		  m_TintedTextureRenderer(LT_MAX_TEXTURE_RENDERER_VERTICES, sharedContext),
 | 
			
		||||
		  m_TintedTextureRenderer(LT_MAX_TINTED_TEXTURE_RENDERER_VERTICES, sharedContext),
 | 
			
		||||
		  m_ViewProjectionBuffer(nullptr),
 | 
			
		||||
		  m_RenderCommand(nullptr),
 | 
			
		||||
		  m_Blender(nullptr),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,6 +8,7 @@
 | 
			
		|||
 | 
			
		||||
#define LT_MAX_QUAD_RENDERER_VERTICES              1028u * 4u
 | 
			
		||||
#define LT_MAX_TEXTURE_RENDERER_VERTICES           1028u * 4u
 | 
			
		||||
#define LT_MAX_TINTED_TEXTURE_RENDERER_VERTICES    1028u * 4u
 | 
			
		||||
 | 
			
		||||
struct GLFWwindow;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -39,11 +39,11 @@ namespace Light {
 | 
			
		|||
	//==================== CONSTANT_BUFFER ====================//
 | 
			
		||||
 | 
			
		||||
	//==================== VERTEX_BUFFER ====================//
 | 
			
		||||
	glVertexBuffer::glVertexBuffer(float* vertices, unsigned int count)
 | 
			
		||||
	glVertexBuffer::glVertexBuffer(float* vertices, unsigned int stride, unsigned int count)
 | 
			
		||||
		: m_BufferID(NULL)
 | 
			
		||||
	{
 | 
			
		||||
		glCreateBuffers(1, &m_BufferID);
 | 
			
		||||
		glNamedBufferData(m_BufferID, count * sizeof(float), vertices, GL_DYNAMIC_DRAW);
 | 
			
		||||
		glNamedBufferData(m_BufferID, stride * count, vertices, GL_DYNAMIC_DRAW);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	glVertexBuffer::~glVertexBuffer()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,7 +30,7 @@ namespace Light {
 | 
			
		|||
		unsigned int m_BufferID;
 | 
			
		||||
 | 
			
		||||
	public:
 | 
			
		||||
		glVertexBuffer(float* vertices, unsigned int count);
 | 
			
		||||
		glVertexBuffer(float* vertices, unsigned int stride, unsigned int count);
 | 
			
		||||
		~glVertexBuffer();
 | 
			
		||||
 | 
			
		||||
		void Bind() override;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue