[nostalgia/glutils] Add bind(FrameBuffer) function
This commit is contained in:
		@@ -1,5 +1,5 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
 | 
					 * Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <ox/std/assert.hpp>
 | 
					#include <ox/std/assert.hpp>
 | 
				
			||||||
@@ -46,6 +46,13 @@ template struct GLObject<deleteVertexArray>;
 | 
				
			|||||||
template struct GLObject<deleteProgram>;
 | 
					template struct GLObject<deleteProgram>;
 | 
				
			||||||
template struct GLObject<deleteShader>;
 | 
					template struct GLObject<deleteShader>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void bind(const FrameBuffer &fb) noexcept {
 | 
				
			||||||
 | 
						glBindFramebuffer(GL_FRAMEBUFFER, fb);
 | 
				
			||||||
 | 
						glViewport(0, 0, fb.width, fb.height);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static ox::Result<GLShader> buildShader(GLuint shaderType, const GLchar *src, ox::CRStringView shaderName) noexcept {
 | 
					static ox::Result<GLShader> buildShader(GLuint shaderType, const GLchar *src, ox::CRStringView shaderName) noexcept {
 | 
				
			||||||
	GLShader shader(glCreateShader(shaderType));
 | 
						GLShader shader(glCreateShader(shaderType));
 | 
				
			||||||
	glShaderSource(shader, 1, &src, nullptr);
 | 
						glShaderSource(shader, 1, &src, nullptr);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright 2016 - 2022 Gary Talent (gary@drinkingtea.net). All rights reserved.
 | 
					 * Copyright 2016 - 2023 Gary Talent (gary@drinkingtea.net). All rights reserved.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
@@ -134,6 +134,8 @@ struct FrameBuffer {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void bind(const FrameBuffer &fb) noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ox::Result<GLProgram> buildShaderProgram(const GLchar *vert, const GLchar *frag, const GLchar *geo = nullptr) noexcept;
 | 
					ox::Result<GLProgram> buildShaderProgram(const GLchar *vert, const GLchar *frag, const GLchar *geo = nullptr) noexcept;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user