Hola. Muy buenas a tod@s. Bueno, ya habiendo solucionado el problema con las dependencias, se me presenta otro problema: al ejecutar un programa compilado de un código sencillo, este crashea.
El código es el siguiente:
#include <iostream>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
static void errorCallback(int error, const char* description) {
std::cout << description << ". Error core: " << error << std::endl;
}
static void keyCallback(GLFWwindow* window, int key, int scancode, int action, int mods) {
if(key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GL_TRUE);
}
int main() {
GLFWwindow* window;
GLuint VAO;
GLuint VBO;
GLfloat Vertices[] = {
-0.5f, -0.5f, 0.0f,
-0.5f, 0.5f, 0.0f,
0.5f, 0.5f, 0.0f
};
glfwSetErrorCallback(errorCallback);
if(!glfwInit())
return -1;
window = glfwCreateWindow(640, 640, "Mi juego", NULL, NULL);
if(!window) {
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
glfwSetKeyCallback(window, keyCallback);
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
glEnable(GL_DEPTH_TEST);
glGenVertexArrays(1, &VAO);
glBindVertexArray(VAO);
glGenBuffers(1, &VBO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, false, 0, 0);
glEnableVertexAttribArray(0);
while(!glfwWindowShouldClose(window)) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glDrawArrays(GL_TRIANGLES, 0, 3);
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwDestroyWindow(window);
glfwTerminate();
return 0;
}
Como ya se ha mencionado, el código puede ser compilado sin problemas, pero al ejecutar el .exe correspondiente, crashea (nótese que se abre la ventana en blanco, y justo en ese momento crashea). ¡Gracias por su atención y ayuda!
Me respondo a mi mismo: "¡TIENES QUE INICIALIZAR GLEW, DESPISTADO!"
Nota, no he podido eliminar el tema