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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - nxzdr

Pages: [1]
1
Window / OpenGL and Threading
« on: May 18, 2011, 01:15:36 pm »
Success! =D Thanks!

So I presume that the window sets itself as Active upon creation (which I probably should have thought about before =p)

2
Window / OpenGL and Threading
« on: May 18, 2011, 01:01:29 pm »
Hmm no luck, I made the change, and now it keeps signalling GL_INVALID_OPERATION for everything, which is due to no GLContext.

Any reason this might happen? I have the App class pass a pointer to the sf::Window it creates to the renderer just before the thread starts. then the rendering thread sets the window to active before calling any gl functions.

Is there anything I'm leaving out?

3
Window / OpenGL and Threading
« on: May 18, 2011, 12:27:14 pm »
So if I made a loading thread to load and bind textures, that would need a context. But my renderer is fine with using the window pointer.

Cool, thanks for your help! =D

4
Window / OpenGL and Threading
« on: May 18, 2011, 11:43:10 am »
So I don't need the sf::Context at all then?

5
Window / OpenGL and Threading
« on: May 18, 2011, 09:22:48 am »
Alright so I've been playing around with SFML for a few days now, just for a bit of fun. I've decided to try to get it working with two threads, one to handle input, audio and the like, and the other to loop through a 3d scene and perform all the rendering tasks. The trouble is, I'm not sure if I'm getting this down correctly, presently I have a black filled window, that handles input and everything fine, but nothing from the rendering thread draws to the window. I've debugged and checked to make sure everything is running as I expect it to, so I'm guessing I've misinterpreted the docs on how to accomplish this. Here's what I've got thus far (just the important parts obviously):

Main Thread
App has a sf::Window as a member
Code: [Select]

App::Init()
{
    // Creates and sf::Window
    sf::VideoMode videoMode(iWidth, iHeight, 32);
    mWindow.Create(videoMode, "AppNameHere");
}

App::Loop()
{
    while(!quit)
    {
        mWindow.SetActive();

        // Process Events for close, resize ect here

        mWindow.Display();
    }

    mWindow.Close();
}


Render Thread
Renderer Class has a sf::Context as a member
Code: [Select]

Renderer::Init()
{
    // Set GL States and Projection Matrix
}

Renderer::Loop()
{
    while(!quit)
    {
        mContext.SetActive();

        // OpenGL Commands here

    }
}



This is what I gathered from searching about thus far. Any help would be greatly appreciated =]

Pages: [1]