My goal is to create noise, render with a shader on a framebuffer, and pull the data on the CPU. I don't need to do further rendering with opengl in the loop, I only need it once, at the beginning.
I load glad after initializing my SFML window, and my opengl code works fine and works as expected.
The problem is drawing things with SFML again, after having done opengl calls.
I've read the example and the tutorial but I fail to understand what is going wrong...
I use my own copy of gladc/glad.h to initialize opengl.
window->setActive(true);
{
if (!gladLoadGLLoader(reinterpret_cast<GLADloadproc>(sf::Context::getFunction)))
//if (!gladLoadGL())
{
std::cout << "Failed to initialize GLAD" << std::endl;
return -1;
}
ourShader = gl_things::Shader("shaders/quad.vs", "shaders/perlin2.fs");
init_geom();
init_framebuffer();
pull();
}
window->setActive(false);
window->resetGLStates();
When I draw a SFML rectangle, an exception is raised
void draw() {
window->pushGLStates();
window->draw(dadaism);
window->popGLStates();
}
I'm wondering if it's actually possible to use opengl like I'm doing. An important detail is that I'm using opengl because I need to declare a texture as GL_FLOAT so it can be pulled back after. SFML cannot does this by itself.