Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Diego Pérez Peña
/
PAG_p1
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
1917abda
authored
Sep 26, 2025
by
Diego Pérez Peña
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Ajustes en documentación del código
parent
55f91e77
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
10 deletions
Renderer.cpp
Renderer.h
ShaderException.cpp
Renderer.cpp
View file @
1917abda
...
...
@@ -72,7 +72,8 @@ void PAG::Renderer::inicializar() {
* @brief Función a llamar cuando se necesite refrescar la ventana.
*
* Esta función limpia los buffers de color y de profundidad de
* OpenGL. No intercambia los buffers.
* OpenGL y renderiza lso modelos asignados con el programa Shader
* asignado. No intercambia los buffers.
*/
void
PAG
::
Renderer
::
refrescar
()
{
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
);
...
...
@@ -100,6 +101,8 @@ void PAG::Renderer::refrescar_tamanio_framebuffer(int width, int height) {
* Función para crear, compilar y enlazar el shader program
* @param nombre Nombre de los archivos a cargar
* @note Se cargarán los archivos <nombre>-vs.glsl y <nombre>-fs.glsl
* @throws ShaderException Si hay errores durante creaciones, lecturas,
* compilaciones o enlazados de algún shader.
*/
void
PAG
::
Renderer
::
creaShaderProgram
(
std
::
string
&
nombre
)
{
std
::
ifstream
lectorArchivos
;
...
...
@@ -219,8 +222,9 @@ void PAG::Renderer::creaShaderProgram(std::string& nombre) {
}
/**
* Función para crear el VAO para el modelo a renderizar
* @note No se incluye ninguna comprobación de errores
* Función para crear el VAO para el modelo a renderizar.
* @note Está implementado a nivel de código con dos modos:
* Entrelazado y no entrelazado. Ambas son equivalentes.
*/
void
PAG
::
Renderer
::
creaModelo
()
{
GLfloat
vertices
[]
=
{
-
.5
,
-
.5
,
0
,
...
...
@@ -257,6 +261,8 @@ void PAG::Renderer::creaModelo() {
*/
// END NO ENTRELAZADO
// START ENTRELAZADO
glGenBuffers
(
1
,
&
idVBO
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
idVBO
);
glEnableVertexAttribArray
(
0
);
...
...
@@ -265,6 +271,8 @@ void PAG::Renderer::creaModelo() {
glVertexAttribPointer
(
1
,
3
,
GL_FLOAT
,
GL_FALSE
,
6
*
sizeof
(
GLfloat
),
(
GLvoid
*
)(
3
*
sizeof
(
float
)));
glBufferData
(
GL_ARRAY_BUFFER
,
18
*
sizeof
(
GLfloat
),
entrelazados
,
GL_STATIC_DRAW
);
// END ENTRELAZADO
glGenBuffers
(
1
,
&
idIBO
);
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
idIBO
);
glBufferData
(
GL_ELEMENT_ARRAY_BUFFER
,
3
*
sizeof
(
GLuint
),
indices
,
GL_STATIC_DRAW
);
...
...
Renderer.h
View file @
1917abda
...
...
@@ -36,7 +36,7 @@ namespace PAG {
GLuint
idFS
=
0
;
// Identificador del Fragment Shader
GLuint
idSP
=
0
;
// Identificador del Shader Program
GLuint
idVAO
=
0
;
// Identificador del Vertex Array Object
GLuint
idVBO
=
0
;
// Identificador del Vertex Buffer Object
(geometría si no entrelazada)
GLuint
idVBO
=
0
;
// Identificador del Vertex Buffer Object
GLuint
idColor
=
0
;
// Idenfiticador del VBO de color (solo no entrelazada)
GLuint
idIBO
=
0
;
// Identificador del Index Buffer Object
...
...
ShaderException.cpp
View file @
1917abda
/**
/**
y
* @file ShaderException.cpp
* @author dpp00022
*
...
...
@@ -12,23 +12,24 @@
#include <utility>
/**
* Constructor parametrizado de la clase
* @param type Tipo de shader que ha causado el error
* Constructor parametrizado de la clase
.
* @param type Tipo de shader que ha causado el error
(*)
* @param creating Si el error ha ocurrido durante la creación o no
* @param log Descripción del error
* @note (*) Pasar en type constantes de OpenGL si es Vertex o Fragment Shader
*/
ShaderException
::
ShaderException
(
int
shaderType
,
TipoError
errorType
,
std
::
string
log
)
:
shaderType
(
shaderType
),
errorType
(
errorType
),
log
(
std
::
move
(
log
))
{}
/**
* Constructor copia de la clase
* Constructor copia de la clase
.
* @param other Excepción que se desea copiar
*/
ShaderException
::
ShaderException
(
ShaderException
&
other
)
:
shaderType
(
other
.
shaderType
),
errorType
(
other
.
errorType
),
log
(
other
.
log
)
{}
/**
* Operador copia de la clase
* Operador copia de la clase
.
* @param other Excepción que se desea copiar
*/
ShaderException
&
ShaderException
::
operator
=
(
ShaderException
const
&
other
)
{
...
...
@@ -39,7 +40,7 @@ ShaderException & ShaderException::operator=(ShaderException const &other) {
}
/**
* Devuelve un string con el log completo
* Devuelve un string con el log completo
.
*/
std
::
string
ShaderException
::
getLog
()
{
std
::
string
aux
=
"Cannot "
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment