मैं glew/glfw के साथ एक ओपनजीएल ऐप बनाने की कोशिश कर रहा हूं। मैंने बाइनरी डाउनलोड की हैं, उन्हें मेरे फ़ोल्डर की जड़ में रखा है, इसमें शामिल हैं और lib निर्देशिकाओं के पथ जोड़े और glew32.lib, GLFW.lib और opengl32.lib की आवश्यकता के लिए मेरे प्रोजेक्ट को बताया।glewInit() असफल, ओपनजीएल ऐप
मैंने रूट निर्देशिका में glew32.lib की प्रतिलिपि बनाई है क्योंकि मेरी परियोजना इसे नहीं देख सका।
मुझे परियोजना निर्देशिका में सभी निर्भरताओं को रखना होगा क्योंकि मैं इसे वितरित कर दूंगा। मुझे हानि हो रही है।
#include "Common.h"
GameEngine::GameEngine()
{
InitWithSize(1024, 768);
InitInput();
}
void GameEngine::InitWithSize(int _width, int _height)
{
try {
// Initialise GLFW
if(!glfwInit())
throw std::exception("Failed to initialize GLFW\n");
//glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3);
glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
// Open a window and create its OpenGL context
if(!glfwOpenWindow(_width, _height, 0,0,0,0, 32,0, GLFW_WINDOW))
throw std::exception("Failed to initialize GLFW\n");
glfwSetWindowTitle("Tutorial 01");
// Initialize GLEW
if (glewInit() != GLEW_OK)
throw std::exception("Failed to initialize GLEW\n");
} catch (std::system_error const& err) {
fprintf(stdout, "System Error: %s", err.what());
glfwTerminate(); // Free glfw if it has been allocated
// Try Again
this->InitWithSize(_width, _height);
} catch(std::exception const& err) {
fprintf(stdout, "Exception Found: %s", err.what());
} catch (...) {
fprintf(stdout,"Unknown Exception Occurred\n");
}
}
void GameEngine::InitInput()
{
// Ensure we can capture the escape key being pressed below
glfwEnable(GLFW_STICKY_KEYS);
}
void GameEngine::StartGameLoop()
{
do{
// Draw nothing, see you in tutorial 2 !
// 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));
}
void GameEngine::InitTestData()
{
// An array of 3 vectors which represents 3 vertices
static const GLfloat g_vertex_buffer_data[] = {
-1.0f, -1.0f, 0.0f,
1.0f, -1.0f, 0.0f,
0.0f, 1.0f, 0.0f,
};
}
मेरी आम हैडर के साथ
:
#ifndef _COMMON_H
#define _COMMON_H
// OpenGL Libraries
#define GLEW_STATIC
//#pragma comment(lib, "glew32.lib")
#include <GL\glew.h>
#include <GL\glfw.h>
// Core Libraries
#include <Windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <map>
#include <string>
#include <fstream>
// C++ 11 Libraries
#include <memory>
#include <exception>
#include <thread>
#include <chrono>
// Manager Classes
#include "ThreadManager.h"
#include "GameEngine.h"
#include "ShaderManager.h"
// Lesser Classes
#include "Shader.h"
#endif
पर कॉल करने से पहले आपको ऐसा करना होगा शायद अपना कोड डालें? मुझे उस लॉग में कोई वास्तविक त्रुटियां नहीं दिखाई देती हैं, केवल एक अधिसूचना है कि कार्यक्रम निष्पादित हो गया है। आप सभी पीडीबी प्रतीकों की रेखाओं को अनदेखा कर सकते हैं। – Tim
'glewInit() 'वास्तव में एक त्रुटि कोड देता है जिसका उपयोग आप' glewGetErrorString' के साथ कर सकते हैं। Http://glew.sourceforge.net/basic.html देखें – Grimmy