Refactor for linux
This commit is contained in:
parent
9f5ce72356
commit
e052d73ff5
4 changed files with 46 additions and 45 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -13,4 +13,5 @@ _CPack_Packages
|
||||||
CMakeCache.txt
|
CMakeCache.txt
|
||||||
Makefile
|
Makefile
|
||||||
*.cmake
|
*.cmake
|
||||||
build/
|
build/
|
||||||
|
lib
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
project(cpplab)
|
project(cpplab)
|
||||||
cmake_minimum_required(VERSION 3.17)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||||
|
@ -18,4 +18,4 @@ set(CPACK_PACKAGE_CONTACT "Balhau")
|
||||||
set(CPACK_GENERATOR "STGZ;TGZ;TZ;DEB")
|
set(CPACK_GENERATOR "STGZ;TGZ;TZ;DEB")
|
||||||
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CppLab")
|
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CppLab")
|
||||||
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.txt")
|
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.txt")
|
||||||
include(CPack)
|
include(CPack)
|
||||||
|
|
|
@ -1,31 +1,33 @@
|
||||||
# Search for glfw
|
# Search for glfw
|
||||||
find_package(glfw3 3.3 REQUIRED)
|
find_package(glfw3 3.2 REQUIRED)
|
||||||
# Search for glew
|
# Search for glew
|
||||||
find_package(glew REQUIRED)
|
find_package(GLEW REQUIRED)
|
||||||
# Search for OpenGL
|
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
add_compile_definitions(IS_DEBUG=1)
|
find_package(GLUT REQUIRED)
|
||||||
|
#add_compile_definitions(IS_DEBUG=1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Add gl1 executable build from gl1.cpp, glew.c and Renderer.cpp
|
# Add gl1 executable build from gl1.cpp, glew.c and Renderer.cpp
|
||||||
add_executable(
|
#add_executable(
|
||||||
gl1
|
# gl1
|
||||||
glew.c
|
# gl1.cpp
|
||||||
gl1.cpp
|
# Shader.cpp
|
||||||
Shader.cpp
|
# Renderer.cpp
|
||||||
Renderer.cpp
|
# VertexBuffer.cpp
|
||||||
VertexBuffer.cpp
|
# IndexBuffer.cpp
|
||||||
IndexBuffer.cpp
|
# VertexArray.cpp
|
||||||
VertexArray.cpp
|
# utils.cpp
|
||||||
utils.cpp
|
#)
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
target_link_libraries(gl1 /usr/local/lib/libGLEW.2.2.0.dylib)
|
#target_link_libraries(gl1 /usr/local/lib/libGLEW.2.2.0.dylib)
|
||||||
# Link gl1 with glfw lib
|
# Link gl1 with glfw lib
|
||||||
target_link_libraries(gl1 glfw)
|
#target_link_libraries(gl1 glfw)
|
||||||
# Link gl1 with glew
|
# Link gl1 with glew
|
||||||
#target_link_libraries(gl1 glew)
|
#target_link_libraries(gl1 glew)
|
||||||
# Link gl1 with OpenGL
|
# Link gl1 with OpenGL
|
||||||
target_link_libraries(gl1 OpenGL::GL)
|
#target_link_libraries(gl1 OpenGL::GL)
|
||||||
|
#target_link_libraries(gl1 ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} )
|
||||||
|
|
|
@ -38,29 +38,6 @@ public:
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void Push(unsigned count);
|
void Push(unsigned count);
|
||||||
template <>
|
|
||||||
void Push<float>(unsigned int count)
|
|
||||||
{
|
|
||||||
VertexBufferElement vbe = {GL_FLOAT, count, GL_FALSE};
|
|
||||||
m_Elements.push_back(vbe);
|
|
||||||
m_Stride += count * VertexBufferElement::GetSizeOfType(GL_FLOAT);
|
|
||||||
};
|
|
||||||
|
|
||||||
template <>
|
|
||||||
void Push<unsigned int>(unsigned int count)
|
|
||||||
{
|
|
||||||
VertexBufferElement vbe = {GL_UNSIGNED_INT, count, GL_FALSE};
|
|
||||||
m_Elements.push_back(vbe);
|
|
||||||
m_Stride += count * VertexBufferElement::GetSizeOfType(GL_UNSIGNED_INT);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <>
|
|
||||||
void Push<unsigned char>(unsigned int count)
|
|
||||||
{
|
|
||||||
VertexBufferElement vbe = {GL_UNSIGNED_BYTE, count, GL_TRUE};
|
|
||||||
m_Elements.push_back(vbe);
|
|
||||||
m_Stride += count * VertexBufferElement::GetSizeOfType(GL_UNSIGNED_BYTE);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const std::vector<VertexBufferElement> GetElements() const &
|
inline const std::vector<VertexBufferElement> GetElements() const &
|
||||||
{
|
{
|
||||||
|
@ -70,4 +47,25 @@ public:
|
||||||
{
|
{
|
||||||
return m_Stride;
|
return m_Stride;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <> void VertexBufferLayout::Push<float>(unsigned int count)
|
||||||
|
{
|
||||||
|
VertexBufferElement vbe = {GL_FLOAT, count, GL_FALSE};
|
||||||
|
m_Elements.push_back(vbe);
|
||||||
|
m_Stride += count * VertexBufferElement::GetSizeOfType(GL_FLOAT);
|
||||||
|
};
|
||||||
|
|
||||||
|
template <> void VertexBufferLayout::Push<unsigned int>(unsigned int count)
|
||||||
|
{
|
||||||
|
VertexBufferElement vbe = {GL_UNSIGNED_INT, count, GL_FALSE};
|
||||||
|
m_Elements.push_back(vbe);
|
||||||
|
m_Stride += count * VertexBufferElement::GetSizeOfType(GL_UNSIGNED_INT);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <> void VertexBufferLayout::Push<unsigned char>(unsigned int count)
|
||||||
|
{
|
||||||
|
VertexBufferElement vbe = {GL_UNSIGNED_BYTE, count, GL_TRUE};
|
||||||
|
m_Elements.push_back(vbe);
|
||||||
|
m_Stride += count * VertexBufferElement::GetSizeOfType(GL_UNSIGNED_BYTE);
|
||||||
|
}
|
Loading…
Reference in a new issue