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

Author Topic: SFML with OpenGL  (Read 2515 times)

0 Members and 1 Guest are viewing this topic.

andariel97

  • Newbie
  • *
  • Posts: 14
    • View Profile
    • Email
SFML with OpenGL
« on: December 07, 2016, 06:36:44 pm »
I want to create an app with a GUI in modern opengl. I want to use vertexarrays to render the sfml sprites so the program can run faster. So ill need to use a lot of small textures for drawing my GUI elements(buttons,textboxes etc.). The thing is that my GUI is being updated during runtime so i dont know exactly how many textures i have. I know in modern opengl you have a lot of ways to send textures to the shader. Which one would be the best for my problem? In the begining i wanted to use texture units but on my pc i only have 32 texture units which is not much. How do i do to have hundreds of thousands of little textures?I think have to choose between there options which i found on wikipedia but i dont even know what all of them are.
sampler2D​   GL_TEXTURE_2D
sampler3D​   GL_TEXTURE_3D   
samplerCube​   GL_TEXTURE_CUBE_MAP   
sampler2DRect​   GL_TEXTURE_RECTANGLE   
sampler1DArray​   GL_TEXTURE_1D_ARRAY
sampler2DArray​   GL_TEXTURE_2D_ARRAY
samplerCubeArray​   GL_TEXTURE_CUBE_MAP_ARRAY
samplerBuffer​   GL_TEXTURE_BUFFER   Buffer Texture
sampler2DMS​   GL_TEXTURE_2D_MULTISAMPLE
sampler2DMSArray GL_TEXTURE_2D_MULTISAMPLE_ARRAY

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
SFML with OpenGL
« Reply #1 on: December 07, 2016, 07:58:41 pm »
So you want to do things in OpenGL yet you use SFML vertex array but then you don't want to use the SFML shader class? I'm a bit confused of your final goal.

As for the texture, why would you split things into many different textures? Just use one large textures with all the elements. That way all you need to do is replace that one "skin" texture.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

andariel97

  • Newbie
  • *
  • Posts: 14
    • View Profile
    • Email
Re: SFML with OpenGL
« Reply #2 on: December 08, 2016, 03:46:02 am »
You are right. I made a mistake there. What i want is to use modern opengl functions(vertex buffers) to draw the scene faster. But i want my project to use sfml for other tasks. And i dont think using a single big texture is a good idea since the maximum texture size on a graphics card is 1024x1024, 2048x2048 or something close to that.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
SFML with OpenGL
« Reply #3 on: December 08, 2016, 11:38:41 am »
What kind of UI elements are you think of putting on a texture then? The common approach is to use something like 9-patch so the UI widgets can be scaled in any way. For that a 1024x1024 texture should be enough.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Chaia*

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: SFML with OpenGL
« Reply #4 on: December 29, 2016, 12:46:16 am »
Maximum texture size on more or less modern gpus is much larger than 1024x1024.
Since you plan to use modern OpenGl, I assume you won't support too old gpus. Therefore 8k textures or even 16k textures are most likely supported on your target hardware.

For example the IntelR HD Graphics 4000 supports up to 16k.

 

anything