I am currently attempting to get started with OpenGL using SFML and GLEW. The problem I am having is with GLEW.
The code is as follows:
#include <GL/glew.h>
#include <SFML/Window.hpp>
#include <SFML/OpenGL.hpp>
int main()
{
//Initialize Glew
glewExperimental = GL_TRUE;
glewInit();
GLuint vertexBuffer;
glGenBuffers(1, &vertexBuffer); //*
printf("%u
", vertexBuffer);
// create the window
sf::Window window(sf::VideoMode::getDesktopMode(), "IsoWars", sf::Style::Fullscreen, sf::ContextSettings(32));
window.setVerticalSyncEnabled(true);
// load resources, initialize the OpenGL states, ...
// run the main loop
bool running = true;
while (running)
{
// clear the buffers
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// draw...
// end the current frame (internally swaps the front and back buffers)
window.display();
// handle events
sf::Event event;
while (window.pollEvent(event))
{
switch (event.type)
{
case sf::Event::Closed:
// end the program
running = false;
break;
case sf::Event::KeyPressed:
switch (event.key.code)
{
case sf::Keyboard::Escape:
running = false;
break;
}
}
}
}
// release resources...
return 0;
}
The call to ‘glGenBuffers(1, &vertexBuffer);’ gives an access violation similar to this (which the forum wont let me post):
http colon slash slash s54.photobucket dot com/user/azoundria/media/unhandledexception_zps3908c912.png.html
If I comment that out, the program runs fine. I need to get GLEW working/configured properly.
I’m using Microsoft Visual C++ 2010. Here is my configuration (again sorry - the forum wont let me post images properly):
http colon slash slash s54.photobucket dot com/user/azoundria/media/linkerinput_zps35c5db14.png.html
http colon slash slash s54.photobucket dot com/user/azoundria/media/linker-input_zpsd8404d4a.png.html
http colon slash slash s54.photobucket dot com/user/azoundria/media/additionalinclude_zpsa32e9b3a.png.html
http colon slash slash s54.photobucket dot com/user/azoundria/media/additionallibrary_zps941fe777.png.html
My system is 64 bit. I’ve tried both glew32.dlls that come with it, and both glew32s.dlls (with the GLEW_STATIC #defined). Does anyone know what I’ve done wrong in the setup?