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()
|
void main()
|
||||||
{
|
{
|
||||||
gl_Position = u_ViewProjection * a_Position;
|
gl_Position = u_ViewProjection * a_Position;
|
||||||
|
|
||||||
vso_TexCoord = a_TexCoord;
|
vso_TexCoord = a_TexCoord;
|
||||||
}
|
}
|
|
@ -37,7 +37,7 @@ namespace Light {
|
||||||
switch (GraphicsContext::GetGraphicsAPI())
|
switch (GraphicsContext::GetGraphicsAPI())
|
||||||
{
|
{
|
||||||
case GraphicsAPI::OpenGL:
|
case GraphicsAPI::OpenGL:
|
||||||
return CreateRef<glVertexBuffer>(vertices, count);
|
return CreateRef<glVertexBuffer>(vertices, stride, count);
|
||||||
|
|
||||||
case GraphicsAPI::DirectX: LT_WIN(
|
case GraphicsAPI::DirectX: LT_WIN(
|
||||||
return CreateRef<dxVertexBuffer>(vertices, stride, count, std::static_pointer_cast<dxSharedContext>(sharedContext));)
|
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)
|
Renderer::Renderer(GLFWwindow* windowHandle, Ref<SharedContext> sharedContext)
|
||||||
: m_QuadRenderer(LT_MAX_QUAD_RENDERER_VERTICES, sharedContext),
|
: m_QuadRenderer(LT_MAX_QUAD_RENDERER_VERTICES, sharedContext),
|
||||||
m_TextureRenderer(LT_MAX_TEXTURE_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_ViewProjectionBuffer(nullptr),
|
||||||
m_RenderCommand(nullptr),
|
m_RenderCommand(nullptr),
|
||||||
m_Blender(nullptr),
|
m_Blender(nullptr),
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#define LT_MAX_QUAD_RENDERER_VERTICES 1028u * 4u
|
#define LT_MAX_QUAD_RENDERER_VERTICES 1028u * 4u
|
||||||
#define LT_MAX_TEXTURE_RENDERER_VERTICES 1028u * 4u
|
#define LT_MAX_TEXTURE_RENDERER_VERTICES 1028u * 4u
|
||||||
|
#define LT_MAX_TINTED_TEXTURE_RENDERER_VERTICES 1028u * 4u
|
||||||
|
|
||||||
struct GLFWwindow;
|
struct GLFWwindow;
|
||||||
|
|
||||||
|
|
|
@ -39,11 +39,11 @@ namespace Light {
|
||||||
//==================== CONSTANT_BUFFER ====================//
|
//==================== CONSTANT_BUFFER ====================//
|
||||||
|
|
||||||
//==================== VERTEX_BUFFER ====================//
|
//==================== VERTEX_BUFFER ====================//
|
||||||
glVertexBuffer::glVertexBuffer(float* vertices, unsigned int count)
|
glVertexBuffer::glVertexBuffer(float* vertices, unsigned int stride, unsigned int count)
|
||||||
: m_BufferID(NULL)
|
: m_BufferID(NULL)
|
||||||
{
|
{
|
||||||
glCreateBuffers(1, &m_BufferID);
|
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()
|
glVertexBuffer::~glVertexBuffer()
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace Light {
|
||||||
unsigned int m_BufferID;
|
unsigned int m_BufferID;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
glVertexBuffer(float* vertices, unsigned int count);
|
glVertexBuffer(float* vertices, unsigned int stride, unsigned int count);
|
||||||
~glVertexBuffer();
|
~glVertexBuffer();
|
||||||
|
|
||||||
void Bind() override;
|
void Bind() override;
|
||||||
|
|
Loading…
Add table
Reference in a new issue