Go Back   nV News Forums > Linux Support Forums > NVIDIA Linux

Newegg Daily Deals

Reply
 
Thread Tools
Old 12-29-06, 03:11 PM   #1
zap
Registered User
 
Join Date: Feb 2003
Location: St. Petersburg, Russia
Posts: 20
Default Multi-Threaded OpenGL

Hello!

I'm doing some graphics programming and wanted to offload some pre-computing work into a second thread. However, this does not work as calling any OpenGL function I tried from a second thread crashes. Right now I need to fill in a vertex buffer object in a second thread with heightmap data, so after loading the heightmap in the second thread I'm calling the glBindBufferARB() function so that I can lock it further with glMapBufferARB(). However, this crashes in any combinations I've tried.

I even tried to put a global mutex around my frame rendering code (e.g. when starting rendering I lock the mutex, and after rendering the frame I unlock the code -- no OpenGL calls are guaranteed while the lock is free), but I get the same crashes.

Are there any magic functions I have to invoke in order to inform OpenGL that my application is going to call some OpenGL functions from another thread (like on MacOS X, for example, seen this on the net)?

I see many references to multi-threaded applications in the nvidia driver docs, so I presume it supports it, just I don't do something right?
zap is offline   Reply With Quote
Old 12-30-06, 02:14 PM   #2
AaronP
NVIDIA Corporation
 
AaronP's Avatar
 
Join Date: Mar 2005
Posts: 2,487
Default Re: Multi-Threaded OpenGL

The current OpenGL context is a thread-local attribute. You need to call glXMakeContextCurrent (or glXMakeCurrent) in your thread before you make OpenGL calls.
AaronP is offline   Reply With Quote
Old 12-31-06, 03:06 AM   #3
zap
Registered User
 
Join Date: Feb 2003
Location: St. Petersburg, Russia
Posts: 20
Default Re: Multi-Threaded OpenGL

Quote:
Originally Posted by AaronP
The current OpenGL context is a thread-local attribute. You need to call glXMakeContextCurrent (or glXMakeCurrent) in your thread before you make OpenGL calls.
Thank you alot! And, as far as I understand, I cannot make current the same context in several threads, so I have to create a shared context?
zap is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenGL book Airstrip1 Software Development 2 08-12-12 09:55 AM
Major WineX prob... I think it has to do with the vidcard... Linewbie NVIDIA Linux 20 10-09-02 10:58 PM
Option "NvAGP" "0" causes crash w/ OpenGL. mujtaba NVIDIA Linux 5 08-25-02 01:16 PM
linux opengl extension chijacky NVIDIA Linux 5 08-23-02 12:16 PM
Slow OpenGL on 7.3 kl899 NVIDIA Linux 1 08-04-02 08:58 PM

All times are GMT -5. The time now is 08:55 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.