Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How to draw a cubemap on SFML with OpenGL  (Read 2078 times)

0 Members and 1 Guest are viewing this topic.

JohnSnow007

  • Newbie
  • *
  • Posts: 15
    • View Profile
How to draw a cubemap on SFML with OpenGL
« 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
how would I implement it on SFML.

fallahn

  • Sr. Member
  • ****
  • Posts: 492
  • Buns.
    • View Profile
    • Trederia
Re: How to draw a cubemap on SFML with OpenGL
« Reply #1 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

JohnSnow007

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: How to draw a cubemap on SFML with OpenGL
« Reply #2 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.

fallahn

  • Sr. Member
  • ****
  • Posts: 492
  • Buns.
    • View Profile
    • Trederia
Re: How to draw a cubemap on SFML with OpenGL
« Reply #3 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  :)