Merge branch 'linux' into masterWithLinux

This commit is contained in:
balhau 2020-07-16 11:43:03 +01:00
commit 72a6ce2282
No known key found for this signature in database
GPG key ID: BE6343D39997BF6C
7 changed files with 36 additions and 58614 deletions

2
.gitignore vendored
View file

@ -14,3 +14,5 @@ CMakeCache.txt
Makefile
*.cmake
build/
lib
.gitkey

View file

@ -1,5 +1,5 @@
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_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)

View file

@ -1,31 +1,33 @@
# Search for glfw
find_package(glfw3 3.3 REQUIRED)
find_package(glfw3 3.2 REQUIRED)
# Search for glew
find_package(glew REQUIRED)
# Search for OpenGL
find_package(GLEW 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_executable(
gl1
glew.c
gl1.cpp
Shader.cpp
Renderer.cpp
VertexBuffer.cpp
IndexBuffer.cpp
VertexArray.cpp
VertexBufferLayout.cpp
utils.cpp
)
target_link_libraries(gl1 /usr/local/lib/libGLEW.2.2.0.dylib)
# Link gl1 with glfw lib
target_link_libraries(gl1 glfw)
# Link gl1 with glew
#target_link_libraries(gl1 glew)
target_link_libraries(gl1 GLEW)
# Link gl1 with OpenGL
target_link_libraries(gl1 OpenGL::GL)
#target_link_libraries(gl1 ${OPENGL_LIBRARIES} ${GLUT_LIBRARY} )

View file

@ -0,0 +1,22 @@
#include "VertexBufferLayout.h"
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);
}

View file

@ -38,29 +38,6 @@ public:
template <typename T>
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 &
{

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff