Textures n stuff

pull/2/head
E. Almqvist 2 years ago
parent e79c35c608
commit 13db3e22b5
  1. 3
      .gitmodules
  2. 5
      CMakeLists.txt
  3. 1
      extern/stb
  4. 8
      headers/textures.hpp
  5. 5
      src/main.cpp
  6. 0
      src/textures.cpp

3
.gitmodules vendored

@ -4,3 +4,6 @@
[submodule "lib/glad"]
path = lib/glad
url = https://github.com/Dav1dde/glad.git
[submodule "extern/stb"]
path = extern/stb
url = https://github.com/nothings/stb.git

@ -14,5 +14,10 @@ add_subdirectory(lib/glfw)
# GLAD
add_subdirectory(lib/glad)
# External headers & sources
file(GLOB EXTERN_SOURCES extern/*)
include_directories(${EXTERN_SOURCES})
link_directories(${EXTERN_SOURCES})
# Linking
target_link_libraries(Hohmann PRIVATE glfw glad)

1
extern/stb vendored

@ -0,0 +1 @@
Subproject commit 8b5f1f37b5b75829fc72d38e7b5d4bcbf8a26d55

@ -0,0 +1,8 @@
#ifndef TEXTURES_HPP
#define TEXTURES_HPP
#define STB_IMAGE_IMPLEMENTATION
#include "../extern/stb/stb_image.h"
#endif

@ -12,6 +12,7 @@
#define VERT_SHADER_SRC_FILE "shaders/vertex.glsl"
#define FRAG_SHADER_SRC_FILE "shaders/fragment.glsl"
#define RUSTY_METAL_TEXTURE "assets/textures/rusty_metal.jpg"
void framebuffer_size_callback(GLFWwindow* win, int w, int h) {
glViewport(0, 0, w, h);
@ -126,6 +127,10 @@ int main() {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_MIRRORED_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_MIRRORED_REPEAT);
// "blending"
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
float borderColor[] = {1.0f, 1.0f, 1.0f, 1.0f};
glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor);

Loading…
Cancel
Save