+ | Cleaning and color texture done
121
LMakefile
@ -1,121 +0,0 @@
|
||||
# **************************************************************************** #
|
||||
# #
|
||||
# ::: :::::::: #
|
||||
# Makefile :+: :+: :+: #
|
||||
# +:+ +:+ +:+ #
|
||||
# By: ycontre <ycontre@student.42.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2024/10/13 19:39:57 by ycontre #+# #+# #
|
||||
# Updated: 2024/12/23 17:41:04 by ycontre ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
BLACK = \033[30;49;3m
|
||||
RED = \033[31;49;3m
|
||||
GREEN = \033[32;49;3m
|
||||
YELLOW = \033[33;49;3m
|
||||
BLUE = \033[34;49;3m
|
||||
MAGENTA = \033[35;49;3m
|
||||
CYAN = \033[36;49;3m
|
||||
WHITE = \033[37;49;3m
|
||||
|
||||
BBLACK = \033[30;49;3;1m
|
||||
BRED = \033[31;49;3;1m
|
||||
BGREEN = \033[32;49;3;1m
|
||||
BYELLOW = \033[33;49;3;1m
|
||||
BBLUE = \033[34;49;3;1m
|
||||
BMAGENTA = \033[35;49;3;1m
|
||||
BCYAN = \033[36;49;3;1m
|
||||
BWHITE = \033[37;49;3;1m
|
||||
|
||||
RESET = \033[0m
|
||||
|
||||
LINE_CLR = \33[2K\r
|
||||
|
||||
FILE = $(shell ls -lR srcs/ | grep -F .c | wc -l)
|
||||
CMP = 1
|
||||
|
||||
NAME := RT
|
||||
|
||||
SRCS_DIR := srcs
|
||||
|
||||
OBJS_DIR := .objs
|
||||
|
||||
ASSETS_DIR := assets
|
||||
|
||||
SRC_ASSETS_DIR := assets_src
|
||||
|
||||
ALL_SRCS := RT.cpp gl.cpp \
|
||||
Window.cpp \
|
||||
Shader.cpp \
|
||||
Camera.cpp
|
||||
|
||||
SRCS := $(ALL_SRCS:%=$(SRCS_DIR)/%)
|
||||
|
||||
|
||||
OBJS := $(addprefix $(OBJS_DIR)/, $(SRCS:%.cpp=%.o))
|
||||
|
||||
HEADERS := includes/RT.hpp
|
||||
|
||||
CC := clang++ -Wextra -Werror -Wall
|
||||
|
||||
CFLAGS := -Ofast
|
||||
|
||||
LDFLAGS := -lglfw -lstdc++
|
||||
|
||||
IFLAGS := -I ./includes
|
||||
|
||||
|
||||
RM := rm -rf
|
||||
|
||||
MAKEFLAGS += --no-print-directory
|
||||
|
||||
DIR_DUP = mkdir -p $(@D)
|
||||
|
||||
# RULES ********************************************************************** #
|
||||
|
||||
all: $(NAME)
|
||||
|
||||
bonus: all
|
||||
|
||||
$(NAME): $(OBJS) $(HEADERS) $(ASSETS)
|
||||
@$(CC) $(LDFLAGS) $(CFLAGS) $(IFLAGS) $(OBJS) -o $(NAME)
|
||||
@printf "$(LINE_CLR)$(BWHITE) $(NAME): PROJECT COMPILED !$(RESET)\n\n"
|
||||
|
||||
$(OBJS_DIR)/%.o: %.cpp
|
||||
@$(DIR_DUP)
|
||||
@if [ $(CMP) -eq '1' ]; then \
|
||||
printf "\n"; \
|
||||
fi;
|
||||
@printf "$(LINE_CLR)$(WHITE) $(NAME): $(CMP)/$(FILE) $(BWHITE)$<$(RESET) $(GREEN)compiling...$(RESET)"
|
||||
@$(CC) $(CFLAGS) $(IFLAGS) -o $@ -c $^
|
||||
@$(eval CMP=$(shell echo $$(($(CMP)+1))))
|
||||
@if [ $(CMP) -gt $(FILE) ]; then \
|
||||
printf "$(LINE_CLR)$(WHITE) $(NAME): $$(($(CMP)-1))/$(FILE)\n$(LINE_CLR)$(BGREEN) Compilation done !$(RESET)\n"; \
|
||||
fi \
|
||||
|
||||
|
||||
clean:
|
||||
@$(RM) $(OBJS)
|
||||
|
||||
dclean: clean
|
||||
@$(RM) $(OBJS_DIR)
|
||||
|
||||
fclean: dclean
|
||||
@printf " $(BWHITE)$(NAME):$(BRED) cleaned.$(RESET)\n"
|
||||
@$(RM) $(NAME)
|
||||
|
||||
mfclean: dclean
|
||||
@$(RM) $(NAME)
|
||||
|
||||
mre:
|
||||
@$(MAKE) mfclean
|
||||
@$(MAKE) all
|
||||
|
||||
re:
|
||||
@$(MAKE) fclean
|
||||
@$(MAKE) all
|
||||
|
||||
# **************************************************************************** #
|
||||
|
||||
.PHONY: all clean fclean dclean re bonus
|
76
WMakefile
@ -1,76 +0,0 @@
|
||||
# **************************************************************************** #
|
||||
# #
|
||||
# ::: :::::::: #
|
||||
# WMakefile :+: :+: :+: #
|
||||
# +:+ +:+ +:+ #
|
||||
# By: TheRed <TheRed@students.42.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2024/10/14 22:33:37 by TheRed #+# #+# #
|
||||
# Updated: 2024/10/14 22:33:37 by TheRed ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
BLACK = [90m
|
||||
RED = [91m
|
||||
GREEN = [92m
|
||||
YELLOW = [93m
|
||||
BLUE = [94m
|
||||
MAGENTA = [95m
|
||||
CYAN = [96m
|
||||
WHITE = [97m
|
||||
|
||||
RESET = [0m
|
||||
|
||||
LINE_CLR = \33[2K\r
|
||||
|
||||
NAME := RT
|
||||
|
||||
SRCS_DIR := srcs
|
||||
|
||||
OBJS_DIR := .objs
|
||||
|
||||
ALL_SRCS := RT.cpp gl.cpp \
|
||||
Window.cpp \
|
||||
Shader.cpp \
|
||||
Camera.cpp
|
||||
|
||||
|
||||
SRCS := $(ALL_SRCS:%=$(SRCS_DIR)/%)
|
||||
|
||||
|
||||
OBJS := $(addprefix $(OBJS_DIR)/, $(SRCS:%.cpp=%.o))
|
||||
|
||||
CC := g++
|
||||
|
||||
IFLAGS := -Ofast -I./includes -L./lib -lglfw3 -lopengl32 -lgdi32 -lcglm
|
||||
|
||||
RM := del /f /s /q
|
||||
|
||||
MAKEFLAGS += --no-print-directory
|
||||
|
||||
DIR_DUP = if not exist "$(@D)" mkdir "$(@D)"
|
||||
|
||||
# RULES ********************************************************************** #
|
||||
|
||||
all: $(NAME)
|
||||
|
||||
$(NAME): $(OBJS) $(HEADERS)
|
||||
@$(CC) -o $(NAME) $(OBJS) $(IFLAGS)
|
||||
@echo $(WHITE) $(NAME): PROJECT COMPILED !$(RESET) & echo:
|
||||
|
||||
$(OBJS_DIR)/%.o: %.cpp
|
||||
@$(DIR_DUP)
|
||||
@echo $(WHITE) $(NAME): $(WHITE)$<$(RESET) $(GREEN)compiling...$(RESET)
|
||||
@$(CC) -c $^ $(IFLAGS) -o $@
|
||||
|
||||
|
||||
fclean:
|
||||
@echo $(WHITE)$(NAME):$(RED) cleaned.$(RESET)
|
||||
@del /f /s /q $(NAME).exe
|
||||
@rmdir /S /Q "$(OBJS_DIR)"
|
||||
|
||||
re:
|
||||
@$(MAKE) fclean
|
||||
@$(MAKE) all
|
||||
|
||||
.PHONY: all clean fclean dclean re bonus
|
@ -33,6 +33,8 @@ class Shader
|
||||
// void setVec4(const std::string &name, const RT::Vec4f &value) const;
|
||||
void set_mat4(const std::string &name, const glm::mat4 &value) const;
|
||||
|
||||
void set_textures(std::vector<GLuint> textureIDs);
|
||||
|
||||
GLuint getProgram(void) const;
|
||||
GLuint getProgramCompute(void) const;
|
||||
|
||||
|
BIN
output.mp4
@ -1,12 +1,10 @@
|
||||
CAM 0 -0.5 4 -10.6 -90.2 0.241 4.709 60.399 5
|
||||
|
||||
TEX texture.jpg
|
||||
|
||||
MAT 255 010 010 5 0.0 1.0
|
||||
MAT 010 255 010 5 0.0 1.0
|
||||
MAT 010 010 255 5 0.0 1.0
|
||||
|
||||
MAT 255 255 255 0 1.7 1.0 DIE 0
|
||||
MAT 255 255 255 0 1.7 1.0 DIE
|
||||
|
||||
MAT 200 200 200 0 0.0 1.0
|
||||
|
||||
|
158
scenes/obj/jinx.mtl
Normal file
@ -0,0 +1,158 @@
|
||||
# Aspose.3D Wavefront OBJ Exporter
|
||||
# Copyright 2004-2024 Aspose Pty Ltd.
|
||||
# File created: 01/29/2025 16:07:20
|
||||
|
||||
newmtl mat0_Ears
|
||||
illum 2
|
||||
Kd 1 1 1
|
||||
Ke 0 0 0
|
||||
Pr 0
|
||||
Pm 0
|
||||
d 1
|
||||
Tr 0
|
||||
map_Kd textures/mat0_Ears_color.png
|
||||
map_Pr mat0_Ears_metallic.png
|
||||
map_Pm mat0_Ears_metallic.png
|
||||
newmtl mat0_Chest
|
||||
illum 2
|
||||
Kd 1 1 1
|
||||
Ke 0 0 0
|
||||
Pr 0
|
||||
Pm 0
|
||||
d 1
|
||||
Tr 0
|
||||
map_Kd textures/mat0_Chest_color.png
|
||||
map_Pr mat0_Chest_metallic.png
|
||||
map_Pm mat0_Chest_metallic.png
|
||||
newmtl mat0_Hair
|
||||
illum 2
|
||||
Kd 1 1 1
|
||||
Ke 0 0 0
|
||||
Pr 0
|
||||
Pm 0
|
||||
d 1
|
||||
Tr 0
|
||||
map_Kd textures/mat0_Hair_color.png
|
||||
map_Pr mat0_Hair_metallic.png
|
||||
map_Pm mat0_Hair_metallic.png
|
||||
newmtl mat0_Head
|
||||
illum 2
|
||||
Kd 1 1 1
|
||||
Ke 0 0 0
|
||||
Pr 0
|
||||
Pm 0
|
||||
d 1
|
||||
Tr 0
|
||||
map_Kd textures/mat0_Head_color.png
|
||||
map_Pr mat0_Head_metallic.png
|
||||
map_Pm mat0_Head_metallic.png
|
||||
newmtl mat0_Eyes
|
||||
illum 2
|
||||
Kd 1 1 1
|
||||
Ke 0 0 0
|
||||
Pr 0
|
||||
Pm 0
|
||||
d 1
|
||||
Tr 0
|
||||
map_Kd textures/mat0_Eyes_color.png
|
||||
map_Pr mat0_Eyes_metallic.png
|
||||
map_Pm mat0_Eyes_metallic.png
|
||||
newmtl mat0_Teeth
|
||||
illum 2
|
||||
Kd 1 1 1
|
||||
Ke 0 0 0
|
||||
Pr 0
|
||||
Pm 0
|
||||
d 1
|
||||
Tr 0
|
||||
map_Kd textures/mat0_Teeth_color.png
|
||||
map_Pr mat0_Teeth_metallic.png
|
||||
map_Pm mat0_Teeth_metallic.png
|
||||
newmtl mat0_Bangs
|
||||
illum 2
|
||||
Kd 1 1 1
|
||||
Ke 0 0 0
|
||||
Pr 0
|
||||
Pm 0
|
||||
d 1
|
||||
Tr 0
|
||||
map_Kd textures/mat0_Bangs_color.png
|
||||
map_Pr mat0_Bangs_metallic.png
|
||||
map_Pm mat0_Bangs_metallic.png
|
||||
newmtl mat0_Hair_Bracelet_2
|
||||
illum 2
|
||||
Kd 1 1 1
|
||||
Ke 0 0 0
|
||||
Pr 0
|
||||
Pm 0
|
||||
d 1
|
||||
Tr 0
|
||||
map_Kd textures/mat0_Hair_Bracelet_2_color.png
|
||||
map_Pr mat0_Hair_Bracelet_2_metallic.png
|
||||
map_Pm mat0_Hair_Bracelet_2_metallic.png
|
||||
newmtl mat0_Pin
|
||||
illum 2
|
||||
Kd 1 1 1
|
||||
Ke 0 0 0
|
||||
Pr 0
|
||||
Pm 0
|
||||
d 1
|
||||
Tr 0
|
||||
map_Kd textures/mat0_Pin_color.png
|
||||
map_Pr mat0_Pin_metallic.png
|
||||
map_Pm mat0_Pin_metallic.png
|
||||
newmtl mat0_Braids
|
||||
illum 2
|
||||
Kd 1 1 1
|
||||
Ke 0 0 0
|
||||
Pr 0
|
||||
Pm 0
|
||||
d 1
|
||||
Tr 0
|
||||
map_Kd textures/mat0_Braids_color.png
|
||||
map_Pr mat0_Braids_metallic.png
|
||||
map_Pm mat0_Braids_metallic.png
|
||||
newmtl mat0_Lashes
|
||||
illum 2
|
||||
Kd 1 1 1
|
||||
Ke 0 0 0
|
||||
Pr 0
|
||||
Pm 0
|
||||
d 1
|
||||
Tr 0
|
||||
map_Kd textures/mat0_Lashes_color.png
|
||||
map_Pr mat0_Lashes_metallic.png
|
||||
map_Pm mat0_Lashes_metallic.png
|
||||
newmtl mat0_FX
|
||||
illum 2
|
||||
Kd 1 1 1
|
||||
Ke 0 0 0
|
||||
Pr 0
|
||||
Pm 0
|
||||
d 1
|
||||
Tr 0
|
||||
map_Kd textures/mat0_FX_color.png
|
||||
map_Pr mat0_FX_metallic.png
|
||||
map_Pm mat0_FX_metallic.png
|
||||
newmtl mat0_Blast
|
||||
illum 2
|
||||
Kd 1 1 1
|
||||
Ke 0 0 0
|
||||
Pr 0
|
||||
Pm 0
|
||||
d 1
|
||||
Tr 0
|
||||
map_Kd textures/mat0_Blast_color.png
|
||||
map_Pr mat0_Blast_metallic.png
|
||||
map_Pm mat0_Blast_metallic.png
|
||||
newmtl mat0_BG
|
||||
illum 2
|
||||
Kd 1 1 1
|
||||
Ke 0 0 0
|
||||
Pr 0
|
||||
Pm 0
|
||||
d 1
|
||||
Tr 0
|
||||
map_Kd textures/mat0_BG_color.png
|
||||
map_Pr mat0_BG_metallic.png
|
||||
map_Pm mat0_BG_metallic.png
|
822243
scenes/obj/jinx.obj
Normal file
BIN
scenes/obj/textures/mat0_BG_color.png
Normal file
After Width: | Height: | Size: 2.5 MiB |
BIN
scenes/obj/textures/mat0_BG_metallic.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
scenes/obj/textures/mat0_Bangs_color.png
Normal file
After Width: | Height: | Size: 1.6 MiB |
BIN
scenes/obj/textures/mat0_Bangs_metallic.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
scenes/obj/textures/mat0_Blast_color.png
Normal file
After Width: | Height: | Size: 1.8 MiB |
BIN
scenes/obj/textures/mat0_Blast_metallic.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
scenes/obj/textures/mat0_Braids_color.png
Normal file
After Width: | Height: | Size: 3.0 MiB |
BIN
scenes/obj/textures/mat0_Braids_metallic.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
scenes/obj/textures/mat0_Chest_color.png
Normal file
After Width: | Height: | Size: 1.5 MiB |
BIN
scenes/obj/textures/mat0_Chest_metallic.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
scenes/obj/textures/mat0_Ears_color.png
Normal file
After Width: | Height: | Size: 1.3 MiB |
BIN
scenes/obj/textures/mat0_Ears_metallic.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
scenes/obj/textures/mat0_Eyes_color.png
Normal file
After Width: | Height: | Size: 235 KiB |
BIN
scenes/obj/textures/mat0_Eyes_metallic.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
scenes/obj/textures/mat0_FX_color.png
Normal file
After Width: | Height: | Size: 95 KiB |
BIN
scenes/obj/textures/mat0_FX_metallic.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
scenes/obj/textures/mat0_Hair_Bracelet_2_color.png
Normal file
After Width: | Height: | Size: 1.0 MiB |
BIN
scenes/obj/textures/mat0_Hair_Bracelet_2_metallic.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
scenes/obj/textures/mat0_Hair_color.png
Normal file
After Width: | Height: | Size: 2.4 MiB |
BIN
scenes/obj/textures/mat0_Hair_metallic.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
scenes/obj/textures/mat0_Head_color.png
Normal file
After Width: | Height: | Size: 1.2 MiB |
BIN
scenes/obj/textures/mat0_Head_metallic.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
scenes/obj/textures/mat0_Lashes_color.png
Normal file
After Width: | Height: | Size: 124 KiB |
BIN
scenes/obj/textures/mat0_Lashes_metallic.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
scenes/obj/textures/mat0_Pin_color.png
Normal file
After Width: | Height: | Size: 650 KiB |
BIN
scenes/obj/textures/mat0_Pin_metallic.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
scenes/obj/textures/mat0_Teeth_color.png
Normal file
After Width: | Height: | Size: 573 KiB |
BIN
scenes/obj/textures/mat0_Teeth_metallic.png
Normal file
After Width: | Height: | Size: 22 KiB |
@ -1,4 +1,4 @@
|
||||
CAM 18.9143 2.24843 -5.48951 8.60003 -200.801 0 2 45 5
|
||||
CAM 18.9143 20.24843 -5.48951 8.60003 -200.801 0 2 45 5
|
||||
|
||||
MAT 255 255 255 0.0 1.0 0.5 // dragon 0
|
||||
MAT 255 220 50 0.0 1.0 0.5 // dragon 1
|
||||
@ -7,8 +7,8 @@ MAT 255 220 50 0.0 1.0 0.5 // dragon 1
|
||||
MAT 255 255 255 5.0 0.0 0.0 // light 2
|
||||
sp 0 50 0 25 2
|
||||
|
||||
OBJ scenes/obj/sponza.obj 0 0 0 0.025
|
||||
OBJ obj/sponza.obj 0 0 0 0.025
|
||||
|
||||
OBJ scenes/obj/Dragon_80K.obj 7 2.5 0 9 0 140 0 0
|
||||
OBJ scenes/obj/Dragon_80K.obj 9 1.35 -3.5 5 0 40 0 1
|
||||
OBJ obj/Dragon_80K.obj 7 2.5 0 9 0 140 0 0
|
||||
OBJ obj/Dragon_80K.obj 9 1.35 -3.5 5 0 40 0 1
|
||||
|
||||
|
7
scenes/test.rt
Normal file
@ -0,0 +1,7 @@
|
||||
CAM 15.6252 30.089 20.0977 -46.6002 -103.601 0 1 90 5
|
||||
|
||||
MAT 50 50 50 0. 0. 0. // 0 gray
|
||||
pl 0 0 0 0 1 0 0 // floor
|
||||
|
||||
# OBJ obj/jinx.obj 0 1.5 0
|
||||
OBJ obj/sponza.obj 0 5 0 0.01
|
@ -121,6 +121,9 @@ struct hitInfo
|
||||
vec3 position;
|
||||
int obj_index;
|
||||
int mat_index;
|
||||
|
||||
float u;
|
||||
float v;
|
||||
};
|
||||
|
||||
struct Stats
|
||||
|
@ -2,7 +2,7 @@ hitInfo traceRay(Ray ray);
|
||||
|
||||
vec3 GetEnvironmentLight(Ray ray)
|
||||
{
|
||||
return vec3(0.);
|
||||
// return vec3(0.);
|
||||
vec3 sun_pos = vec3(-0.5, 0.5, 0.5);
|
||||
float SunFocus = 1.5;
|
||||
float SunIntensity = 1.;
|
||||
@ -121,7 +121,7 @@ vec3 getTextureColor(int texture_index, hitInfo hit)
|
||||
|
||||
void calculateLightColor(GPUMaterial mat, hitInfo hit, inout vec3 color, inout vec3 light, inout uint rng_state)
|
||||
{
|
||||
color *= mat.texture_index == -1 ? vec3(1.0) : getTextureColor(mat.texture_index, hit);
|
||||
// color *= mat.texture_index == -1 ? vec3(1.0) : getTextureColor(mat.texture_index, hit);
|
||||
color *= mat.color;
|
||||
light += mat.emission * mat.color;
|
||||
// light += sampleLights(hit.position, rng_state);
|
||||
|
15
srcs/RT.cpp
@ -21,9 +21,9 @@ int main(int argc, char **argv)
|
||||
|
||||
Window window(&scene, WIDTH, HEIGHT, "RT_GPU", 0);
|
||||
Shader shader("shaders/vertex.vert", "shaders/frag.frag", "shaders/compute.glsl");
|
||||
|
||||
// Shader shader("shaders/vertex.vert", "shaders/frag.frag", "shaders/debug.glsl");
|
||||
|
||||
|
||||
GLint max_gpu_size;
|
||||
glGetIntegerv(GL_MAX_SHADER_STORAGE_BLOCK_SIZE, &max_gpu_size);
|
||||
|
||||
@ -179,18 +179,7 @@ int main(int argc, char **argv)
|
||||
shader.set_float("u_time", (float)(glfwGetTime()));
|
||||
shader.set_vec2("u_resolution", glm::vec2(WIDTH, HEIGHT));
|
||||
|
||||
//texture
|
||||
// In your render loop
|
||||
std::vector<GLuint> textureIDs = scene.getTextureIDs();
|
||||
for (size_t i = 0; i < textureIDs.size(); i++)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0 + i);
|
||||
glBindTexture(GL_TEXTURE_2D, textureIDs[i]);
|
||||
|
||||
std::string uniform_name = "textures[" + std::to_string(i) + "]";
|
||||
glUniform1i(glGetUniformLocation(shader.getProgramCompute(), uniform_name.c_str()), i);
|
||||
}
|
||||
//
|
||||
shader.set_textures(scene.getTextureIDs());
|
||||
|
||||
glDispatchCompute((WIDTH + 15) / 16, (HEIGHT + 15) / 16, 1);
|
||||
glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
|
||||
|
@ -204,6 +204,18 @@ void Shader::set_mat4(const std::string &name, const glm::mat4 &value) const
|
||||
glUniformMatrix4fv(glGetUniformLocation(_program_compute, name.c_str()), 1, GL_FALSE, glm::value_ptr(value));
|
||||
}
|
||||
|
||||
void Shader::set_textures(const std::vector<GLuint> textureIDs)
|
||||
{
|
||||
for (size_t i = 0; i < textureIDs.size(); i++)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE0 + i);
|
||||
glBindTexture(GL_TEXTURE_2D, textureIDs[i]);
|
||||
|
||||
std::string uniform_name = "textures[" + std::to_string(i) + "]";
|
||||
glUniform1i(glGetUniformLocation(_program_compute, uniform_name.c_str()), i);
|
||||
}
|
||||
}
|
||||
|
||||
GLuint Shader::getProgram(void) const
|
||||
{
|
||||
return (_program);
|
||||
|
BIN
texture.jpg
Before Width: | Height: | Size: 82 KiB |
BIN
texture2.jpg
Before Width: | Height: | Size: 206 KiB |