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
b71051cb
authored
Sep 11, 2025
by
José Pardo Madera
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Copiado programa de prueba
parent
3a0fd521
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
2 deletions
CMakeLists.txt
main.cpp
make.sh
CMakeLists.txt
View file @
b71051cb
...
...
@@ -4,5 +4,14 @@ project(pr01)
set
(
CMAKE_CXX_STANDARD 17
)
file
(
GLOB MY_FILES *.cpp
)
file
(
GLOB GLAD_FILES GLAD/src/*.c
)
add_executable
(
${
PROJECT_NAME
}
${
MY_FILES
}
)
add_executable
(
${
PROJECT_NAME
}
${
MY_FILES
}
${
GLAD_FILES
}
)
target_include_directories
(
${
PROJECT_NAME
}
PUBLIC GLAD/include
)
target_link_libraries
(
${
PROJECT_NAME
}
GL glfw
)
main.cpp
View file @
b71051cb
#include <iostream>
#include <cstdlib>
// IMPORTANTE: GLAD se ha de incluir antes que GLFW
#include <glad/glad.h>
#include <GLFW/glfw3.h>
// Helper que muestra un mensaje y cierra el programa
#define panic(message) { \
std::cout << __FILE__ << ":" << __LINE__ << " : panic!" << std::endl;\
std::cout << __FILE__ << ":" << __LINE__ << " : " << message << std::endl;\
exit(-1);\
}
int
main
()
{
std
::
cout
<<
"Hello world!"
<<
std
::
endl
;
std
::
cout
<<
"Starting Application PAG - Prueba 01"
<<
std
::
endl
;
if
(
glfwInit
()
!=
GLFW_TRUE
)
{
panic
(
"Failed to initialize GLFW"
);
}
glfwWindowHint
(
GLFW_SAMPLES
,
4
);
glfwWindowHint
(
GLFW_OPENGL_PROFILE
,
GLFW_OPENGL_CORE_PROFILE
);
glfwWindowHint
(
GLFW_CONTEXT_VERSION_MAJOR
,
4
);
glfwWindowHint
(
GLFW_CONTEXT_VERSION_MINOR
,
1
);
GLFWwindow
*
window
;
window
=
glfwCreateWindow
(
1024
,
576
,
"PAG Introduction"
,
nullptr
,
nullptr
);
if
(
window
==
nullptr
)
{
glfwTerminate
();
panic
(
"Failed to open GLFW window"
);
}
glfwMakeContextCurrent
(
window
);
if
(
!
gladLoadGLLoader
((
GLADloadproc
)
glfwGetProcAddress
))
{
glfwDestroyWindow
(
window
);
glfwTerminate
();
panic
(
"GLAD initialization failed"
);
}
std
::
cout
<<
glGetString
(
GL_RENDERER
)
<<
std
::
endl
;
std
::
cout
<<
glGetString
(
GL_VENDOR
)
<<
std
::
endl
;
std
::
cout
<<
glGetString
(
GL_VERSION
)
<<
std
::
endl
;
std
::
cout
<<
glGetString
(
GL_SHADING_LANGUAGE_VERSION
)
<<
std
::
endl
;
glClearColor
(
0.6
,
0.6
,
0.6
,
1.0
);
glEnable
(
GL_DEPTH_TEST
);
while
(
!
glfwWindowShouldClose
(
window
))
{
glClear
(
GL_COLOR_BUFFER_BIT
|
GL_DEPTH_BUFFER_BIT
);
glfwSwapBuffers
(
window
);
glfwPollEvents
();
}
std
::
cout
<<
"Finishing application pag prueba"
<<
std
::
endl
;
glfwDestroyWindow
(
window
);
glfwTerminate
();
}
make.sh
View file @
b71051cb
...
...
@@ -6,6 +6,8 @@ die() {
PROJECT_NAME
=
pr01
mkdir build
cmake
-B
build/
.
cd
build
...
...
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