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

Author Topic: Combining SFML graphics and OpenGL  (Read 1975 times)

0 Members and 1 Guest are viewing this topic.

masskiller

  • Sr. Member
  • ****
  • Posts: 284
  • Pointers to Functions rock!
    • MSN Messenger - kyogre_jb@hotmail.com
    • View Profile
    • Email
Combining SFML graphics and OpenGL
« on: September 16, 2012, 07:32:48 am »
From what I've read in the doc, the render window is mainly for SFML stuff, while window is for handling OpenGL. Is there a possible way to use both in the same window? From what I've understood I think not, but I'd like to know for sure. I'd also like to know if this mix (in case it's currently not possible) is planned for future SFML versions or is just something that just cannot be for "x" or "y" reasons.

In case it's currently not possible or not planned in the future is there a reasonable way to implement something that would allow it? My purpose is to have a minimal 3d background while using SFML for 2d management like I've been doing so far. Is it possible or planned?
Programmer, Artist, Composer and Storyline/Script Writer of "Origin of Magic". If all goes well this could turn into a commercial project!

Finally back into the programming world!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Combining SFML graphics and OpenGL
« Reply #1 on: September 16, 2012, 10:16:04 am »
There's a tutorial (Using OpenGL in a SFML window -- look at the last section) and a sample code (OpenGL) that show how to mix sfml-graphics and OpenGL ;)
Laurent Gomila - SFML developer

cloudncali

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • http://jakesmakes.tumblr.com/
Re: Combining SFML graphics and OpenGL
« Reply #2 on: September 16, 2012, 10:17:11 am »
I've used sfml sprites at the same time as OpenGL rendering of 3d shapes. It seemed to work just fine. the main issue is depth, if you render your shapes or models first then place sprites they will be placed on top of the models. I think this is the case atleast its been a while sense i've done this.

Here is an example:



the player sprite, the item sprites and the walls are drawn using direct opengl (in this case it was either Vertex Arrays or Vertex buffer objects). The User interface Sprites and text where SFML Sprites and Text objects. it worked just fine with little to no
modification

 

anything