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

Author Topic: Drawing SFML alongside opengl 3+ ?  (Read 2402 times)

0 Members and 1 Guest are viewing this topic.

Jim70

  • Newbie
  • *
  • Posts: 23
    • View Profile
Drawing SFML alongside opengl 3+ ?
« on: January 29, 2016, 10:20:33 am »
It works fine with ogl 2, but it doesnt draw in opengl 3, why is that?

      window.pushGLStates();

      window.draw(sf::RectangleShape(sf::Vector2f(100, 100)));

      window.popGLStates();
« Last Edit: January 29, 2016, 10:53:57 am by Jim70 »

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Drawing SFML alongside opengl 3+ ?
« Reply #1 on: February 01, 2016, 12:29:51 am »
Does this help:

Quote
OpenGL versions above 3.0 are supported by SFML (as long as your graphics driver can handle them). Support for selecting the profile of 3.2+ contexts and whether the context debug flag is set was added in SFML 2.3. The forward compatibility flag is not supported. By default, SFML creates 3.2+ contexts using the compatibility profile because the graphics module makes use of legacy OpenGL functionality. If you intend on using the graphics module, make sure to create your context without the core profile setting or the graphics module will not function correctly. On OS X, SFML supports creating OpenGL 3.2+ contexts using the core profile only. If you want to use the graphics module on OS X, you are limited to using a legacy context which implies OpenGL version 2.1.

from the "Using OpenGL in a SFML window" tutorial.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re: Drawing SFML alongside opengl 3+ ?
« Reply #2 on: March 29, 2016, 03:00:04 pm »
I don't quite understand this part:
Quote
make sure to create your context without the core profile setting or the graphics module will not function correctly
How can I do this? I'm using OpenGL 3.x with SFML and it looks like push/popGLStates doesn't help, so I have to clean up the state (then everything else works correctly)
Does it mean I have to do it or is there any other way to handle stuff?
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10823
    • View Profile
    • development blog
    • Email
AW: Drawing SFML alongside opengl 3+ ?
« Reply #3 on: March 29, 2016, 03:21:52 pm »
That probably meant that some drivers (mostly on Linux) don't (or didn't) support non core contexts. You request core contexts with the ContextSettings when creating the window.

Also keep in mibd that SFML won't handle your OpenGL 3 states, so you'll have handle them yourself.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re: Drawing SFML alongside opengl 3+ ?
« Reply #4 on: March 30, 2016, 08:34:11 am »
Thanks for the info!
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

 

anything