change shaderSercve so it can take both of char* and std::filesystem::path
This commit is contained in:
20
main.cc
20
main.cc
@@ -4,7 +4,7 @@
|
||||
#include <filesystem>
|
||||
#include "decoder.h"
|
||||
#include "shaderService.h"
|
||||
using namespace std::filesystem;
|
||||
#include "shader.h"
|
||||
using std::cout, std::endl;
|
||||
|
||||
int main(int argc, char **const argv)
|
||||
@@ -14,8 +14,15 @@ int main(int argc, char **const argv)
|
||||
cout << SDL_GetError() << "\n";
|
||||
return -1;
|
||||
}
|
||||
const char* targetFilepath = argv[1];
|
||||
|
||||
if(targetFilepath == nullptr || !std::filesystem::exists(targetFilepath)){
|
||||
cout<<"File Not Exist\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
DecoderParam param{};
|
||||
InitDecoder("/home/jie/code/cc/sdl2/videoPlayer/video/ocean.mp4", param);
|
||||
InitDecoder(targetFilepath, param);
|
||||
int client_width = param.width / 2;
|
||||
int client_height = param.height / 2;
|
||||
SDL_Window *window = SDL_CreateWindow(
|
||||
@@ -92,9 +99,12 @@ int main(int argc, char **const argv)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
}
|
||||
ShaderService shaderService{
|
||||
"/home/jie/code/cc/sdl2/videoPlayer/shaders/vertexShader.vert",
|
||||
"/home/jie/code/cc/sdl2/videoPlayer/shaders/fragShader.frag"};
|
||||
/* ShaderService shaderService{
|
||||
std::filesystem::path("/home/jie/project/mp/shaders/vertexShader.vert"),
|
||||
std::filesystem::path("/home/jie/project/mp/shaders/fragShader.frag")};
|
||||
|
||||
*/
|
||||
ShaderService shaderService{vSource.data(), fSource.data()};
|
||||
shaderService.Use();
|
||||
shaderService.SetUniform<int>("textureY", 0);
|
||||
shaderService.SetUniform<int>("textureU", 1);
|
||||
|
||||
Reference in New Issue
Block a user