elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Introducción a la Factorización De Semiprimos (RSA)


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación C/C++ (Moderadores: Eternal Idol, Littlehorse, K-YreX)
| | |-+  (Solucionado) Un programa sencillo usando las librerías GLFW y GLEW crashea
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: (Solucionado) Un programa sencillo usando las librerías GLFW y GLEW crashea  (Leído 1,655 veces)
Seyro97

Desconectado Desconectado

Mensajes: 145


Ver Perfil WWW
(Solucionado) Un programa sencillo usando las librerías GLFW y GLEW crashea
« en: 14 Mayo 2015, 20:01 pm »

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:

Código
  1. #include <iostream>
  2.  
  3. #include <GL/glew.h>
  4. #include <GLFW/glfw3.h>
  5.  
  6. static void errorCallback(int error, const char* description) {
  7. std::cout << description << ". Error core: " << error << std::endl;
  8. }
  9.  
  10. static void keyCallback(GLFWwindow* window, int key, int scancode, int action, int mods) {
  11. if(key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
  12. glfwSetWindowShouldClose(window, GL_TRUE);
  13. }
  14.  
  15. int main() {
  16. GLFWwindow* window;
  17. GLuint VAO;
  18. GLuint VBO;
  19. GLfloat Vertices[] = {
  20. -0.5f, -0.5f, 0.0f,
  21. -0.5f, 0.5f, 0.0f,
  22. 0.5f, 0.5f, 0.0f
  23. };
  24.  
  25. glfwSetErrorCallback(errorCallback);
  26.  
  27. if(!glfwInit())
  28. return -1;
  29.  
  30. window = glfwCreateWindow(640, 640, "Mi juego", NULL, NULL);
  31.  
  32. if(!window) {
  33. glfwTerminate();
  34. return -1;
  35. }
  36.  
  37. glfwMakeContextCurrent(window);
  38. glfwSetKeyCallback(window, keyCallback);
  39.  
  40. glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
  41. glEnable(GL_DEPTH_TEST);
  42.  
  43. glGenVertexArrays(1, &VAO);
  44. glBindVertexArray(VAO);
  45.  
  46. glGenBuffers(1, &VBO);
  47. glBindBuffer(GL_ARRAY_BUFFER, VBO);
  48. glBufferData(GL_ARRAY_BUFFER, sizeof(Vertices), Vertices, GL_STATIC_DRAW);
  49. glVertexAttribPointer(0, 3, GL_FLOAT, false, 0, 0);
  50. glEnableVertexAttribArray(0);
  51.  
  52. while(!glfwWindowShouldClose(window)) {
  53. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  54.  
  55. glBindBuffer(GL_ARRAY_BUFFER, VBO);
  56. glDrawArrays(GL_TRIANGLES, 0, 3);
  57.  
  58. glfwSwapBuffers(window);
  59. glfwPollEvents();
  60. }
  61.  
  62. glfwDestroyWindow(window);
  63. glfwTerminate();
  64.  
  65. return 0;
  66. }

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!


« Última modificación: 14 Mayo 2015, 20:31 pm por Seyro97 » En línea

Carlos Peláez González. visita http://www.taringa.net/EnjoyC para muchos tutoriales!
Seyro97

Desconectado Desconectado

Mensajes: 145


Ver Perfil WWW
Re: (Ayuda) Un programa sencillo usando las librerías GLFW y GLEW crashea
« Respuesta #1 en: 14 Mayo 2015, 20:04 pm »

Me respondo a mi mismo: "¡TIENES QUE INICIALIZAR GLEW, DESPISTADO!"

Nota, no he podido eliminar el tema


En línea

Carlos Peláez González. visita http://www.taringa.net/EnjoyC para muchos tutoriales!
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Programa crashea al escribir
Ingeniería Inversa
x64core 0 1,810 Último mensaje 23 Septiembre 2012, 02:07 am
por x64core
Duda usando hilos, se me queda colgado el programa ?? SOLUCIONADO !!
.NET (C#, VB.NET, ASP)
TrashAmbishion 3 2,546 Último mensaje 30 Abril 2013, 16:03 pm
por TrashAmbishion
Me crashea el programa « 1 2 »
Programación C/C++
jaxoR 16 6,663 Último mensaje 14 Marzo 2014, 07:02 am
por leosansan
[SOLUCIONADO] Programa Sencillo: Representación de un Array
Programación C/C++
LaLakers94 6 2,890 Último mensaje 5 Mayo 2014, 17:49 pm
por rir3760
Me crashea el programa
Programación C/C++
jaxoR 2 2,178 Último mensaje 30 Mayo 2014, 02:42 am
por Yoel Alejandro
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines