PDA

View Full Version : Help request regarding an Open GL error



VoxelRookie
01-05-2017, 07:47 PM
Hi, I tried to seek help because of a problem that I have with a certain code, basically, I followed a tutorial ( https://www.youtube.com/watch?v=i2E3-uceK9c ) and did exactly what was instructed in it to setup everything needed for the next parts, unfortunately, I am running into this error when attempting to run the code :




Failed to deactivate shared context before sharing: Descripteur non valide

Warning: The created OpenGL context does not fully meet the settings that were requested
Requested: version = 1.1 ; depth bits = 0 ; stencil bits = 0 ; AA level = 0 ; co
re = false ; debug = false ; sRGB = false
Created: version = 0.0 ; depth bits = 0 ; stencil bits = 0 ; AA level = 0 ; core
= false ; debug = false ; sRGB = false
Failed to activate the window's context
Failed to activate the window's context

Process returned -1073741819 (0xC0000005) execution time : 2.638 s
Press any key to continue.






I am running into the error when running this code :


#include <iostream>
#include <GL/glew.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <SFML/Graphics.hpp>

int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "It Works!");

//Irrelevent stuff to test if opengl stuff compiles
glewInit();
GLuint test;
glGenVertexArrays(1, &test);

//Test if SFML works and compiles
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);

while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}

window.clear();
window.draw(shape);
window.display();
}

glm::mat4 mat = glm::translate(mat, {1,1,1,}); //Test if GLM compiles

return 0;
}


Can someone help me please ^_^?

Silence
01-06-2017, 05:51 AM
Created: version = 0.0


It seems SFML could not create a window with any OpenGL contexts.
Try with another windowing tools (like glfw (http://www.glfw.org/) or glut) and sees if things changed. You could also check on an SFML forum.

There's also some missing relevant information: which OS, which version of SFML, which compiler, how this was compiled, ...

john_connor
01-06-2017, 06:16 AM
i'd also recommend using glfw + glew instead:
http://www.glfw.org/documentation.html