2013-08-21 7 views
7

ओपनजीएल 3+ के लिए कुछ ओपनजीएल ट्यूटोरियल के बाद, गेट के बाहर, मैंने कुछ विसंगतियों में भाग लिया है, यहां वह कोड है जिसे मैं प्राप्त करने में कामयाब रहा, लेकिन गेट से बाहर , मुझे इस बड़े पैमाने पर त्रुटियां मिल रही हैं, जिनमें से कोई भी नहीं कहता है कि इसमें शामिल हेडर नहीं मिल सकते हैं, लेकिन केवल हेडर कोर फ़ंक्शंस को परिभाषित नहीं करते हैं।glfwOpenWindowHint इस दायरे में घोषित नहीं किया गया 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)); 

समस्या तथ्य यह है कि MinGW यह बहुत ज्यादा पसंद नहीं करता है और "अघोषित" त्रुटियों, जो सभी के लिए एक ओपन खिड़की का अस्तित्व के लिए आवश्यक हैं की एक टन का उत्पादन किया गया जा रहा है। मैंने कभी भी एसडीएल 2 के अलावा किसी भी ग्राफिक्स लाइब्रेरी के साथ काम नहीं किया है, इसलिए आपको मुझे इस माध्यम से चलने की आवश्यकता हो सकती है ... जिसकी बहुत सराहना की जाएगी।

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 
+1

क्या आपने मूल शेडर्स लोड करने में कामयाब रहे हैं? – SpicyWeenie

उत्तर

8

आप GLFW3 हेडर का उपयोग लेकिन कोड आप ने लिखा GLFW2 के लिए है।

GLFW3 में समारोह glfwOpenWindowHint() अपग्रेड संबंधी निर्देशों के लिए के लिए बाहर glfwWindowHint()

चेक इस पेज का नाम बदले जाने: http://www.glfw.org/docs/3.0/moving.html कि GLFW2 के बाद से बदल के लिए बहुत कुछ कर रहे हैं।

+0

त्रुटियों से ऐसा लगता है कि –

+0

@JustinMeiners: मेरे उत्तर में अपग्रेड पेज लिंक देखें। आपको कई चीजें अपग्रेड करनी चाहिए। –

+0

लिंक ने बहुत मदद की, मुझे एहसास नहीं हुआ कि जीएलएफडब्ल्यू 2 से 3 में इतना बदल गया है। साथ ही, यह प्रतिक्रिया मुझसे अपेक्षाकृत बहुत तेज थी, हाहा। आपसे आसपास ही मिलने की उम्मीद है! –

संबंधित मुद्दे