-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Rafal Maziejuk <[email protected]>
- Loading branch information
1 parent
b24494a
commit fe6fb48
Showing
5 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
#include <nox/format.h> | ||
|
||
#include <cstdint> | ||
#include <vector> | ||
|
||
namespace nox { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
#pragma once | ||
|
||
#include <vector> | ||
|
||
namespace nox { | ||
|
||
enum class ImageFormat { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include "src/opengl/gl_buffer.h" | ||
#include "src/opengl/gl_vertex_array.h" | ||
|
||
#include "tests/base/opengl/gl_test_environment.h" | ||
|
||
#include <glad/gl.h> | ||
#include <gtest/gtest.h> | ||
|
||
using namespace nox; | ||
|
||
struct GLBufferFixture : public tests::GLTestFixture { | ||
struct Vertex { | ||
float position[2]; | ||
float textureCoordinates[2]; | ||
}; | ||
static constexpr Vertex vertices[]{ | ||
{{0.5f, 0.5f}, {1.0f, 1.0f}}, // top right | ||
{{0.5f, -0.5f}, {1.0f, 0.0f}}, // bottom right | ||
{{-0.5f, -0.5f}, {0.0f, 0.0f}}, // bottom left | ||
{{-0.5f, 0.5f}, {0.0f, 1.0f}}, // top left | ||
}; | ||
|
||
static constexpr uint32_t indices[]{0, 1, 3, | ||
1, 2, 3}; | ||
}; | ||
|
||
TEST_F(GLBufferFixture, GivenValidVertexBufferDescriptorWhenCallingCreateVertexBufferThenVertexBufferIsSuccessfullyCreated) { | ||
auto vertexArrayRegistry = GLVertexArrayRegistry::create(); | ||
|
||
VertexBufferDescriptor vertexBufferDescriptor{}; | ||
vertexBufferDescriptor.usage = BufferUsage::STATIC; | ||
vertexBufferDescriptor.size = sizeof(vertices); | ||
vertexBufferDescriptor.data = vertices; | ||
vertexBufferDescriptor.vertexAttributes = { | ||
VertexAttributeFormat::RG32F, | ||
VertexAttributeFormat::RG32F, | ||
}; | ||
auto vertexBuffer = GLVertexBuffer::create(vertexBufferDescriptor, vertexArrayRegistry); | ||
ASSERT_NE(nullptr, vertexBuffer); | ||
} |