-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Working Spinning Cube Sample (#2) * WIP Spinning Cube Sample * Working Spinning Cube Sample * refactored & commented * bug fix * Vertex Shader matrices calculation fix
- Loading branch information
Showing
19 changed files
with
194 additions
and
82 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
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
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,41 @@ | ||
#include "OPENGLVertexAttributes.h" | ||
|
||
namespace CGL::Graphics | ||
{ | ||
template <> | ||
void OPENGLEnableVertexAttributes<VertexTypes::Position>() | ||
{ | ||
glEnableVertexAttribArray(0); // Position Attribute | ||
glVertexAttribPointer( | ||
0, | ||
sizeof(Graphics::VertexTypes::Position::Position) / sizeof(float), | ||
GL_FLOAT, | ||
GL_FALSE, | ||
sizeof(Graphics::VertexTypes::Position), | ||
(void*)offsetof(Graphics::VertexTypes::Position, Position) | ||
); | ||
} | ||
|
||
template <> | ||
void OPENGLEnableVertexAttributes<VertexTypes::PositionColor>() { | ||
glEnableVertexAttribArray(0); // Position Attribute | ||
glVertexAttribPointer( | ||
0, | ||
sizeof(Graphics::VertexTypes::PositionColor::Position) / sizeof(float), | ||
GL_FLOAT, | ||
GL_FALSE, | ||
sizeof(Graphics::VertexTypes::PositionColor), | ||
(void*)offsetof(Graphics::VertexTypes::PositionColor, Position) | ||
); | ||
|
||
glEnableVertexAttribArray(1); // Color Attribute | ||
glVertexAttribPointer( | ||
1, | ||
sizeof(Graphics::VertexTypes::PositionColor::Color) / sizeof(float), | ||
GL_FLOAT, | ||
GL_FALSE, | ||
sizeof(Graphics::VertexTypes::PositionColor), | ||
(void*)offsetof(Graphics::VertexTypes::PositionColor, Color) | ||
); | ||
} | ||
} |
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,22 @@ | ||
#pragma once | ||
|
||
#include <GL/glew.h> | ||
#include <Core/Graphics/Types.h> | ||
|
||
namespace CGL::Graphics | ||
{ | ||
template <typename> | ||
void OPENGLEnableVertexAttributes(); | ||
|
||
template <> | ||
void OPENGLEnableVertexAttributes<VertexTypes::Position>(); | ||
|
||
template <> | ||
void OPENGLEnableVertexAttributes<VertexTypes::PositionColor>(); | ||
|
||
template <> | ||
void OPENGLEnableVertexAttributes<VertexTypes::PositionTexture>(); | ||
|
||
template <> | ||
void OPENGLEnableVertexAttributes<VertexTypes::PositionColorTexture>(); | ||
} |
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
Oops, something went wrong.