Seguendo alcuni tutorial OpenGL per OpenGL 3+, appena uscito dal gate, ho riscontrato alcune discrepanze, ecco il codice che sono riuscito a ottenere, ma appena uscito dal gate , Sto ricevendo questo enorme numero di errori, nessuno dei quali dice che non riesce a trovare le intestazioni incluse, ma semplicemente che le intestazioni non definiscono le funzioni principali.glfwOpenWindowHint non dichiarato in questo ambito GLFW3 & GLEW
#include <stdio.h>
#include <stdlib.h>
#include <GL/glew.h>
#include <GL/glfw3.h>
#include <glm/glm.hpp>
int main(){
// Initialise GLFW
if(!glfwInit())
{
fprintf(stderr, "Failed to initialize GLFW\n");
return -1;
}
glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4); // 4x antialiasing
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3);
glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); //I don't want the
//old OpenGL
// Open a window and create its OpenGL context
if(!glfwOpenWindow(1024, 768, 0,0,0,0, 32,0, GLFW_WINDOW))
{
fprintf(stderr, "Failed to open GLFW window\n");
glfwTerminate();
return -1;
}
// Initialize GLEW
glewExperimental=true; // Needed in core profile
if (glewInit() != GLEW_OK) {
fprintf(stderr, "Failed to initialize GLEW\n");
return -1;
}
glfwSetWindowTitle("Tutorial 01");
// Ensure we can capture the escape key being pressed below
glfwEnable(GLFW_STICKY_KEYS);
do{
// Draw nothing
// Swap buffers
glfwSwapBuffers();
} // Check if the ESC key was pressed or the window was closed
while(glfwGetKey(GLFW_KEY_ESC) != GLFW_PRESS &&
glfwGetWindowParam(GLFW_OPENED));
Il problema è il fatto che MinGW questo non piace molto e ha prodotto una tonnellata di errori "dichiarati", che sono tutti necessari per una finestra OpenGL di esistere. Non ho mai lavorato con nessuna libreria grafica oltre a un po 'di SDL2, quindi potrebbe essere necessario guidarmi attraverso questo ... Il che sarebbe molto apprezzato.
SigmaGLPP\main.cpp:23:20: error: 'GLFW_FSAA_SAMPLES' was not declared in this scope
SigmaGLPP\main.cpp:23:40: error: 'glfwOpenWindowHint' was not declared in this scope
SigmaGLPP\main.cpp:24:20: error: 'GLFW_OPENGL_VERSION_MAJOR' was not declared in this
scope
SigmaGLPP\main.cpp:25:20: error: 'GLFW_OPENGL_VERSION_MINOR' was not declared in this
scope
SigmaGLPP\main.cpp:29:48: error: 'GLFW_WINDOW' was not declared in this scope
SigmaGLPP\main.cpp:29:60: error: 'glfwOpenWindow' was not declared in this scope
SigmaGLPP\main.cpp:43:35: error: cannot convert 'const char*' to 'GLFWwindow*' for
argument '1' to 'void glfwSetWindowTitle(GLFWwindow*, const char*)'
SigmaGLPP\main.cpp:46:30: error: 'glfwEnable' was not declared in this scope
SigmaGLPP\main.cpp:52:21: error: too few arguments to function 'void
glfwSwapBuffers(GLFWwindow*)'
SigmaGLPP\main.cpp:55:20: error: 'GLFW_KEY_ESC' was not declared in this scope
SigmaGLPP\main.cpp:56:21: error: 'GLFW_OPENED' was not declared in this scope
SigmaGLPP\main.cpp:56:33: error: 'glfwGetWindowParam' was not declared in this scope
SigmaGLPP\main.cpp:56:36: error: expected '}' at end of input
Sei riuscito a caricare gli shader di base? – SpicyWeenie