Advertisement Jump to content
Sign in to follow this  
philipptr

calling SDL_GL_SwapBuffers() from a thread

This topic is 4906 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

im coding a game and use a thread for the grafics and the normal function for input and calculation. with sdl only that was no problem, but since im using Opengl too the grafics just not appear (but the menu which, is a extra function called before thread creation, works). so my question is: should i exchange the input/calculating, so that this is in the thread, or did i do something else wrong? (the rest in the thread works, it even calculates fps)

Share this post


Link to post
Share on other sites
Advertisement
thanks very much, i only found one note saying i should only use video functions from one thread (not multiple ones) which i did.

thanks very much again helped alot :)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Sorry but now i have another problem:

ive exchanged gamecontrol and the grafics, but if i have a SDL_Delay in Gamecontrol i get Xlib: unexpected async reply (sequence 0x78)! but if i dont have the SDL_Delay the redrawing function is much too slow.




Also i have a little problem with Opengl:
i cant draw grafics which reach out the left or top part of the window. my Opengl initialisation looks like this:

glViewport(0,0,resx,resy); //resx and resy are exactly the resolution
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

glOrtho(0.0f, resx, resy, 0.0f, -1.0f, 1.0f);

glMatrixMode(GL_MODELVIEW);

Share this post


Link to post
Share on other sites
Sdl_delay isn't a graphical function, so I don't know what's going on there.

Your OpenGL code looks ok to me. I don't have a glViewport line in my code however.

Share this post


Link to post
Share on other sites
under windows the window gets idle very fast after the creation of the threads, and when i check the mouse position from the thread it doesnt work (but i can move the sdl_cursor)

imo this is very strange...

Share this post


Link to post
Share on other sites
drawing out of screen works now but still the mouse input under windows doesnt work... did someone have that problem too? (it only happens when im catching the mouseinput out of the threaf)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!