Skip to content

Froute99/OpenGLRenderer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intro.

2D 그래픽 렌더링 프레임워크입니다. 몇 가지 그래픽 데모를 포함하고 있습니다.

  • 사용한 툴 or 라이브러리: OpenGL API(glew, glfw)
  • 기간: 2019.03.26 - 2019.12.8
  • 인원: 1인 개발

Table of Contents

1. Pipeline
2. Classes Info.

Pipeline

Pipeline

Classes

Verticies: Mesh 클래스의 정보를 VAO, VBO에 바인딩

VBO binding code.

Bind mesh vertices to VBO
void Vertices::WriteMeshDataToVertexBuffer(const Mesh& mesh) const noexcept
{
	char* buffer = reinterpret_cast<char*>(glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY));
	glBindBuffer(GL_ARRAY_BUFFER, VBO);
	unsigned offset = 0;

	vec2<float> point;
	Color4f color;
	vec2<float> texture;

	// binding vertices information to buffer object
	for (int i = 0; i < static_cast<int>(verticesCount); ++i)
	{
		for (VerticesDescription::Type element : layout.GetTypes())
		{
			switch (element)
			{
			case VerticesDescription::Type::Point:
				point = mesh.GetPoint(i);
				memcpy(buffer + offset, &point, sizeof(point));
				offset += sizeof(vec2<float>);
				break;
			case VerticesDescription::Type::Color:
				color = mesh.GetColor(i);
				memcpy(buffer + offset, &color, sizeof(color));
				offset += sizeof(Color4f);
				break;
			case VerticesDescription::Type::TextureCoordinate:
				texture = mesh.GetTextureCoordinate(i);
				memcpy(buffer + offset, &texture, sizeof(texture));
				offset += sizeof(vec2<float>);
				break;
			}
		}
	}
	glUnmapBuffer(GL_ARRAY_BUFFER);
	glBindBuffer(GL_ARRAY_BUFFER, 0);
	SelectNothing();
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published