Page 1 of 1
Qt Creator and sfml
Posted: Wed Jul 14, 2010 11:14 pm
by WSPSNIPER
ok i dont know if any of you do this but im using sfml with qt, with qt creator. every thing works fine except loading images for the map window, one of the windows. i have a Main Window which has the menu buttons and stuff and i have 2 sfml windows... using the sfml tutorial base class and inheriting. one tile window and one map window. for loading tile sheets im using QFileDialog::getOpenFileName()(syntax check) then i loads for the tile window but not for the other window. how i load the sprites is when i create a new map i call
Code: Select all
sprite[l][x][y].SetImage(m_imageManager->GetImage(TileSheet::GetInst()->GetImageDir().toStdString()));
now the tiles show up at the right size and everything which tells me that it is loading somthing but why is it now showing up. if you want code just tell me what you want to see becuase there is a ton of it
Re: Qt Creator and sfml
Posted: Wed Jul 14, 2010 11:54 pm
by Ginto8
ok just WHY??? Qt is a window manager (of sorts), and so is SFML. Why the hell are you using the two together? Just use opengl, cuz I know you can integrate that!
Re: Qt Creator and sfml
Posted: Thu Jul 15, 2010 12:26 am
by WSPSNIPER
Ginto8 wrote:ok just WHY??? Qt is a window manager (of sorts), and so is SFML. Why the hell are you using the two together? Just use opengl, cuz I know you can integrate that!
that was what i was going to do but i just stated and sfml had tutorials on getting it to work so i thought i would give it a shot.
ill probably go opengl but it would be convenient to get sfml to work with it becuase im almost finished with it.
Re: Qt Creator and sfml
Posted: Thu Jul 15, 2010 4:59 am
by MrDeathNote
You don't have to straight into OpenGL. You can use QPainter if you want, it's much easier and it's back end is OpenGL. So if you're not comfortable with OpenGL go with that untill you get on your feet.
Re: Qt Creator and sfml
Posted: Thu Jul 15, 2010 8:24 am
by WSPSNIPER
MrDeathNote wrote:You don't have to straight into OpenGL. You can use QPainter if you want, it's much easier and it's back end is OpenGL. So if you're not comfortable with OpenGL go with that untill you get on your feet.
thanks, im comfortable with opengl but i really dont want to handle images and stuff... i guess i can try qtpainter. one thing i saw was the QBitmap did not have a clipping function so i would have to make that.
Re: Qt Creator and sfml
Posted: Thu Jul 15, 2010 10:14 am
by RyanPridgeon
Ginto8 wrote:ok just WHY??? Qt is a window manager (of sorts), and so is SFML. Why the hell are you using the two together? Just use opengl, cuz I know you can integrate that!
Using raw OpenGL would make image loading HARDER, not easier
Re: Qt Creator and sfml
Posted: Thu Jul 15, 2010 11:35 am
by MrDeathNote
RyanPridgeon wrote:Ginto8 wrote:ok just WHY??? Qt is a window manager (of sorts), and so is SFML. Why the hell are you using the two together? Just use opengl, cuz I know you can integrate that!
Using raw OpenGL would make image loading HARDER, not easier
Qt actually makes loading OpenGL textures very simple.
Code: Select all
//Local images
QImage t, b;
//Load the image
if (!b.load(file))
{
;//Fill in error stuff
}
//Convert image to a GLuint
t = QGLWidget::convertToGLFormat(b);
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, t.width(), t.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, t.bits());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
where texture is a GLuint.
This is just an example of course but it's that easy
Re: Qt Creator and sfml
Posted: Thu Jul 15, 2010 3:18 pm
by eatcomics
Hell if its that easy I wanna do QT and OGL! I really haven't looked into Qt I should do that
Re: Qt Creator and sfml
Posted: Thu Jul 15, 2010 4:56 pm
by MrDeathNote
eatcomics wrote:Hell if its that easy I wanna do QT and OGL! I really haven't looked into Qt I should do that
Lol yea it's the shit.
Re: Qt Creator and sfml
Posted: Sat Jul 17, 2010 10:52 am
by WSPSNIPER
MrDeathNote wrote:eatcomics wrote:Hell if its that easy I wanna do QT and OGL! I really haven't looked into Qt I should do that
Lol yea it's the shit.
sweet, i dident know it was that easy. good ill go opengl
Re: Qt Creator and sfml
Posted: Sat Jul 17, 2010 11:03 am
by MrDeathNote
WSPSNIPER wrote:MrDeathNote wrote:eatcomics wrote:Hell if its that easy I wanna do QT and OGL! I really haven't looked into Qt I should do that
Lol yea it's the shit.
sweet, i dident know it was that easy. good ill go opengl
Well thats the idea of it, bare in mind that thats off the top of my head pretty much and its untested.