calling SDL_GL_SwapBuffers() from a thread

Started by
6 comments, last by ........................................ 18 years, 8 months ago
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)
Advertisement
http://www.libsdl.org/faq.php?action=listentries&category=2#61
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 :)
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);
so erm does someone know whether sdl_delay is an xlib command or not?
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.
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...
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)

This topic is closed to new replies.

Advertisement