SFML community forums
Help => General => Topic started by: jakobb on February 08, 2014, 02:27:35 am
-
Hello everyone,
I recently purchased this book: http://www.amazon.com/gp/product/0321712617 (http://www.amazon.com/gp/product/0321712617)
The author uses their own wrapper called sb6, I'm assuming to make things easier. It's extremely confusing, although it incorporates GLFW from what I can tell. I knew this was the case before I purchased the book, however, I assumed that the actual OpenGL API function calls would be the same no matter what framework for handling windows you use. Apparently I was completely wrong. Even the first OpenGL function mentioned in the book, "glClearBufferfv()", doesn't work in SFML. What's weird is that some things do work, like the data type "GLfloat".
What I really want to do is write OpenGL applications inside SFML so I can have access to all of its useful features. What I really need to know is if this book is essentially a $50 paperweight for my purposes, and also if there is documentation somewhere on the API you can use within SFML, where is it?
Thank you for the help,
~Jakob
-
If you combine this tutorial (http://www.sfml-dev.org/tutorials/2.0/window-opengl.php) with GLEW (http://glew.sourceforge.net/) you should be able to access all the opengl functionality that your card supports.
-
Do I need to integrate GLEW into SFML just to access the OpenGL API at all? Or does integrating GLEW into SFML let me use the functionality used in the book? Or both?
-
When you #include <SFML/OpenGL.hpp> you are getting your operating system's implementation of OpenGL, which for windows is quite old. It will give you some basic things, but most modern opengl things won't work. That's where GLEW comes into it, it basically lets you access modern opengl. What actually works depends on your graphics card and drivers, but GLEW gives you an easy way to check your gfx card capabilities.
So if you want to do modern opengl stuff then you'll need to install and link GLEW to your SFML application.
-
Ahh, I was under the impression that SFML had OpenGL working out of the box! Thank you for clearing that up for me, I appreciate it.
-
Developing OpenGL on windows is harder than it should be (thx to directx), and you'll find that most libraries (SDL, GLFW, etc.) will need either GLEW, GLEE, or something similar to get easy access to modern OpenGL functionality. There's been some discussion on this forum about whether SFML should expose GLEW or not (which it uses internally), but its now hidden completely, which is why you need to link it in yourself if you want to use it.