Hello. I was just trying to do some kind of GPGPU Computing with OpenGL and OpenCL(you don't have to know about OpenCL),
and I created a VBO(vertex buffer object) before creating a window.
GLuint vbo;
glGenBuffers(1,&vbo);
But there was a segmentation fault and the program throwed an error.
So, I tried to create a VBO after creating window, but it doesnt' work neither. It worked only in the 'main loop', and I want to initialize everything before creating the window. What's the problem and how can I solve this?
int main()
{
sf::Context context;//I think this code doesn't related with my problem.
Fluid fluid;
cout<<"main() - Window initalized"<<endl;
sf::RenderWindow window(sf::VideoMode(1080, 720), "SFML works!",sf::Style::Titlebar|sf::Style::Close);
//initialize something
// The 'main loop'
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
//draw and update something
}
//exit
}
*i'm not a native english speaker, so I'm sorry for my bad English.