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

Author Topic: QT integration and OpenGL 3.x  (Read 3184 times)

0 Members and 1 Guest are viewing this topic.

Peixinho

  • Newbie
  • *
  • Posts: 6
    • View Profile
QT integration and OpenGL 3.x
« on: October 13, 2011, 11:28:17 am »
Hi,

I don't know if this is the right place to post about this subject, but I'm trying to integrate my opengl project into QT using SFML.
I'm using SFML 1.6 and I based my code on the QT tutorial on the website.
What I've noticed is that opengl fixed function is working really well, and on Opengl 3.x the GL context breaks, on windows it crashes and says that its repainting recursively, on linux it just crashes.

Thanks in advance :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
QT integration and OpenGL 3.x
« Reply #1 on: October 13, 2011, 11:36:17 am »
What's the purpose of using SFML here? Qt (not QT -- unless you really meant QuickTime) can handle OpenGL nicely without another external library.
Laurent Gomila - SFML developer

Peixinho

  • Newbie
  • *
  • Posts: 6
    • View Profile
QT integration and OpenGL 3.x
« Reply #2 on: October 13, 2011, 11:39:07 am »
True, but I have my little engine based on SFML, and since I saw that QT was supported by SFML...
Maybe that's another option

bananu7

  • Newbie
  • *
  • Posts: 25
    • View Profile
QT integration and OpenGL 3.x
« Reply #3 on: October 13, 2011, 11:47:09 am »
I integrated SFML in a MFC window for my editor once. I guess that's what you are trying to do.

If using Qt window interface and SFML rendering is actually what you want, you must do something like this (its code using MFC, but i will do something similar in Qt)
Code: [Select]
m_RenderingContext = new sf::RenderWindow ();
sf::WindowHandle MyH = m_hWnd;// GetSafeHwnd();
m_RenderingContext->Create (MyH);


So basically I'm just getting window handle (which in this case is a part of my application window using to display OpenGL), and letting SFML initialize it just like a normal window.

//Edit: I thought i might add some more

Its actually implementation of the CChildView class of MFC, which should have its equivalent in Qt;

Also, i modified the OnPaint event to:
Code: [Select]
m_RenderingContext->Clear (sf::Color (0, 0, 0, 255));
/* Drawing code goes here */
m_RenderingContext->Display();

Peixinho

  • Newbie
  • *
  • Posts: 6
    • View Profile
QT integration and OpenGL 3.x
« Reply #4 on: October 13, 2011, 12:18:19 pm »
Thanks for your replies, will try to solve the problem ;)