SFML community forums

Help => General => Topic started by: masskiller on September 16, 2012, 07:32:48 am

Title: Combining SFML graphics and OpenGL
Post by: masskiller 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?
Title: Re: Combining SFML graphics and OpenGL
Post by: Laurent 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 ;)
Title: Re: Combining SFML graphics and OpenGL
Post by: cloudncali 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:

(https://dl.dropbox.com/u/26522674/Screenshot%207.png)

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