Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
José Pardo Madera
/
pag_practicas_2025
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
b291de91
authored
Sep 26, 2025
by
José Pardo Madera
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Apartado 4.2 practica 3: Colores con VBO entrelazado
parent
3c699dc8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
renderer.cpp
renderer.cpp
View file @
b291de91
...
...
@@ -208,6 +208,7 @@ namespace PAG {
}
void
Renderer
::
creaModelo
()
{
/* Código para No Entrelazado
GLfloat vertices[] = {
-0.5, -0.5, 0,
0.5, -0.5, 0,
...
...
@@ -235,6 +236,26 @@ namespace PAG {
glBufferData(GL_ARRAY_BUFFER, sizeof(colores), colores, GL_STATIC_DRAW);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 3*sizeof(GLfloat), nullptr);
glEnableVertexAttribArray(1);
*/
/* Código para Entrelazado */
GLfloat
vertices
[]
=
{
-
0.5
,
-
0.5
,
0
,
1
,
0
,
0
,
0.5
,
-
0.5
,
0
,
0
,
1
,
0
,
0
,
0.5
,
0
,
0
,
0
,
1
};
GLuint
indices
[]
=
{
0
,
1
,
2
};
glGenVertexArrays
(
1
,
&
idVAO
);
glBindVertexArray
(
idVAO
);
glGenBuffers
(
1
,
idVBO
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
idVBO
[
0
]);
glBufferData
(
GL_ARRAY_BUFFER
,
sizeof
(
vertices
),
vertices
,
GL_STATIC_DRAW
);
glVertexAttribPointer
(
0
,
3
,
GL_FLOAT
,
GL_FALSE
,
6
*
sizeof
(
GLfloat
),
nullptr
);
glVertexAttribPointer
(
1
,
3
,
GL_FLOAT
,
GL_FALSE
,
6
*
sizeof
(
GLfloat
),
(
void
*
)
sizeof
(
GLfloat
[
3
]));
glEnableVertexAttribArray
(
0
);
glEnableVertexAttribArray
(
1
);
glGenBuffers
(
1
,
&
idIBO
);
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
idIBO
);
...
...
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