SFML community forums

Help => General => Topic started by: JohnSnow007 on November 28, 2020, 09:06:18 am

Title: How to draw a cubemap on SFML with OpenGL
Post by: JohnSnow007 on November 28, 2020, 09:06:18 am
I really couldn't find much about the implementation on doing this with SFML. Alot of the syntax like GL_TEXTURE_CUBE_MAP, samplerCube etc are undefined. I read somewhere SFML isn't great for cubemaps but I'm not sure if that's true.

Say I wanted to draw the cubemap for (https://learnopengl.com/img/advanced/cubemaps_skybox.png)
how would I implement it on SFML.
Title: Re: How to draw a cubemap on SFML with OpenGL
Post by: fallahn on November 28, 2020, 10:37:16 am
SFML only provides the most basic OpenGL functions via OpenGL.hpp. You can load the others yourself with a loader such as GLad : https://glad.dav1d.de/

Note that if you're using pure OpenGL you can target any version your hardware supports - however if you want to mix your OpenGL with the SFML graphics module you require a compatible version (this is what SFML uses: https://github.com/SFML/SFML/blob/master/extlibs/headers/glad/include/glad/gl.h)

From there you should be able to load your cubemap using standard OpenGL calls, as per any tutorial  ;D
Title: Re: How to draw a cubemap on SFML with OpenGL
Post by: JohnSnow007 on November 29, 2020, 11:34:09 am
Thanks!
But I read somewhere that  I had to download GLEW from http://glew.sourceforge.net/, add the include and lib files to the additional file settings respectively for the project settings on Visual Studio and then add #include <GL/glew.h> to my file.
Title: Re: How to draw a cubemap on SFML with OpenGL
Post by: fallahn on November 29, 2020, 12:20:03 pm
glew is also an option (it's an OpenGL function loader) but is perhaps a bit out of date. A quick search reveals a few options:

https://github.com/google/galogen
https://glad.dav1d.de/
https://github.com/skaslev/gl3w

and of course glew. There's a wiki page on the kronos site dedicated to opengl loaders: https://www.khronos.org/opengl/wiki/OpenGL_Loading_Library

Choose one whichever one best suits your project  :)