Skip to main content
gamedev.net
🔒 Locked

Problem creating textures from another thread

Started by Stazh 1 reply 700+ views
Original Post
Stazh
Stazh
Hy there. I have a problem with creating textures (using glTexImage2D and gluBuild2DMipmaps) from "loading" thread. I use this thread for loading purposes (doh :D ) and when i call these functions for creatig textures in OpenGL it does nothing. When i try to create textures from my main thread all works fine. Does some one know how to fix this. Btw this is my first post, so, hy everyone :D
OrangyTang
OrangyTang
You can't tinker with OpenGL from multiple threads at the same time. You can either 1) make the GL context 'current' (exact implementation varies depending on platform) while loading your texture, but that can be tricky to do correctly and will likely stall your rendering. Or 2) do the bulk of the loading in a separate thread but hand off the actual texture creation and data upload to the main thread.
Stazh
Stazh
Thanks. I will devide texture loading from texture creating then.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.