Beispiel #1
0
void drawSplashScreen(const std::string &filename){
	if(splashScreen.ID) gl::DeleteTextures(1, &splashScreen.ID);
	else {
		ResourceLoader loader;
		loader.reloadShader("ApplyFBO");
		splashScreen = loader.loadImage(filename);

		glfwShowWindow(Global::main.window);
		glfwSetWindowPos(Global::main.window, Global::main.screenSize.x/2.f - splashScreen.width/2, Global::main.screenSize.y/2.f - splashScreen.height/2);
		glfwSetWindowSize(Global::main.window, splashScreen.width, splashScreen.height);
	}
	gl::Viewport(0, 0, splashScreen.width, splashScreen.height);
	gl::ClearColor(0.f, 0.f, 0.f, 0.f);
	gl::Clear(gl::COLOR_BUFFER_BIT);
	gl::DepthMask(gl::FALSE_);
	gl::Enable(gl::BLEND);
	gl::BlendFunc(gl::SRC_ALPHA, gl::ONE_MINUS_SRC_ALPHA);

	gl::BindBuffer(gl::ARRAY_BUFFER, 0);
	gl::DisableVertexAttribArray(0);
	gl::BindFramebuffer(gl::DRAW_FRAMEBUFFER, 0);

	auto shader = assets::getShader("ApplyFBO");
	shader.bind();
	float width = Global::main.size.x;
	float height = Global::main.size.y;

	shader.texture("uTexture", splashScreen.ID);

	drawScreen();

	glfwSwapBuffers(Global::main.window);

	CHECK_FOR_ERRORS
}
Beispiel #2
0
void Grass::loadData(ResourceLoader &loader, const pmk::Cfg &cfg){
	mesh = loader.loadMesh(cfg["Mesh"].string());
	texture = loader.loadImage(cfg["Texture"].string());

	densitySampler = make_shared<Sampler2D>("../res/textures/GrassDensity.png");
}