OpenGL Coverflow

Discuss any 3rd-party tools and code that may be of interest to other Juce users

Re: OpenGL Coverflow

Postby maxprod » Wed Jan 20, 2010 2:43 pm

Dub wrote:Right, if I comment-out calls to both drawForeground and drawBackground it works beautifully (very smooth)


Cool. That's a first point and we know where is the problem now. Take a look about the other point when you will have 5 minutes (color mode).
User avatar
maxprod
JUCE UberWeenie
 
Posts: 100
Joined: Fri Mar 14, 2008 2:12 pm
Location: Lille, France

Re: OpenGL Coverflow

Postby Dub » Wed Jan 20, 2010 2:59 pm

//A little test by inverting BGR to RGB & BGRA to RGBA will probably resolve your problem. //
I didn't quite understand that reverse RGB to GBR - (Quick Google) Where do I find the defines for those?
Dub
Dub
JUCE UberWeenie
 
Posts: 158
Joined: Wed Jun 28, 2006 10:45 pm
Location: London

Re: OpenGL Coverflow

Postby maxprod » Wed Jan 20, 2010 3:07 pm

User avatar
maxprod
JUCE UberWeenie
 
Posts: 100
Joined: Fri Mar 14, 2008 2:12 pm
Location: Lille, France

Re: OpenGL Coverflow

Postby maxprod » Wed Jan 20, 2010 3:28 pm

I've send a HD Video on YouTube. The problem is that it's first time i recorded my screen in HD, so there's sometimes little blocking due to my hard-drive and the 8000Kps bitrate used to record the video. Need to defrag my drive and/or use another drive. Next time.

http://www.youtube.com/watch?v=x0CD2ahtjyA
User avatar
maxprod
JUCE UberWeenie
 
Posts: 100
Joined: Fri Mar 14, 2008 2:12 pm
Location: Lille, France

Re: OpenGL Coverflow

Postby zamrate » Thu Jan 21, 2010 8:14 am

removing drawBackground() and drawForeground() also helps for me (I can use the .exe now, and there's no white rectangle anymore).
but still got problems: some of the covers are just white. I'm not sure if this has something to do with it, but I remember vaguely that in my code I had to use some kind of OpenGL context lock for uploading the textures, i.e. you cannot load up textures to the GPU while the same OpenGL context is being used to draw. Otherwise I also got this white areas.. Not sure if this hint helps, haven't checked your code much at the moment..

Edit: The white covers were due to JPG's my JUCE version (147) couldn't read (for instance Chic - Le Freak.jpg). I removed them from the XML and it was ok.

Still, I do face the problem that whenever I move the scrollbar, the animation "hangs" until I release it. I suppose this is not normal?
User avatar
zamrate
JUCE UberWeenie
 
Posts: 1081
Joined: Mon Sep 24, 2007 5:33 pm

Re: OpenGL Coverflow

Postby maxprod » Thu Jan 21, 2010 1:01 pm

zamrate wrote:removing drawBackground() and drawForeground() also helps for me (I can use the .exe now, and there's no white rectangle anymore).
but still got problems: some of the covers are just white. I'm not sure if this has something to do with it, but I remember vaguely that in my code I had to use some kind of OpenGL context lock for uploading the textures, i.e. you cannot load up textures to the GPU while the same OpenGL context is being used to draw. Otherwise I also got this white areas.. Not sure if this hint helps, haven't checked your code much at the moment..


You're surely right. The two methods are Thread safe (CriticalSection) but at the Juce UI level. Maybe there's a method to lock the OpenGL drawing until the texture loading is finish. I'm not a OpenGL expert. I will see that as soon as possible.

zamrate wrote:Edit: The white covers were due to JPG's my JUCE version (147) couldn't read (for instance Chic - Le Freak.jpg). I removed them from the XML and it was ok.


Juce 1.47 don't like disco-funk music ? :lol:

zamrate wrote:Still, I do face the problem that whenever I move the scrollbar, the animation "hangs" until I release it. I suppose this is not normal?


I've the same reaction when I resize the window in full screen on my laptop. It's not normal. Maybe it's the same problem because scrollBarMoved () just change the "current" selected item in the CoverFlowContext and call delayedUpdate () that change the 2D foreground, send it and call a repaint() to OpenGL. So, maybe the solution is to lock the OpenGL drawing during the access to the GPU (texture loading). Now the question is how do?
User avatar
maxprod
JUCE UberWeenie
 
Posts: 100
Joined: Fri Mar 14, 2008 2:12 pm
Location: Lille, France

Re: OpenGL Coverflow

Postby Dub » Thu Jan 21, 2010 3:22 pm

Juce 1.47 don't like disco-funk music ?

{Checks Juce Demo Table Components page which seems to confirm with this }
Dub
Dub
JUCE UberWeenie
 
Posts: 158
Joined: Wed Jun 28, 2006 10:45 pm
Location: London

Re: OpenGL Coverflow

Postby zamrate » Thu Jan 21, 2010 4:14 pm

So, maybe the solution is to lock the OpenGL drawing during the access to the GPU (texture loading). Now the question is how do?

i think you have to use OpenGlCompoent::getContextLock( ) when transfering textures. the problem with transfering textures to the GPU is that you have to do it in portions, because if it takes to long your drawing will obviously be stalled.
User avatar
zamrate
JUCE UberWeenie
 
Posts: 1081
Joined: Mon Sep 24, 2007 5:33 pm

Re: OpenGL Coverflow

Postby maxprod » Thu Jan 21, 2010 5:14 pm

zamrate wrote:i think you have to use OpenGlCompoent::getContextLock( ) when transfering textures.


I will check that when I'll find minutes. Thanks for replying. If it's the solution, i will rewrite the component more proper, especially CoverFlowComponent is badly written.
User avatar
maxprod
JUCE UberWeenie
 
Posts: 100
Joined: Fri Mar 14, 2008 2:12 pm
Location: Lille, France

Re: OpenGL Coverflow

Postby maxprod » Thu Jan 21, 2010 5:15 pm

Dub wrote:{Checks Juce Demo Table Components page which seems to confirm with this }


:lol:
User avatar
maxprod
JUCE UberWeenie
 
Posts: 100
Joined: Fri Mar 14, 2008 2:12 pm
Location: Lille, France

Re: OpenGL Coverflow

Postby alimjan » Sat Jan 23, 2010 8:42 pm

Hi, maxprod! Here is my problem with coverflow, this is about high CPU usage :(
Image

?
Thanks to Jules for The Juce.
User avatar
alimjan
JUCE Geek
 
Posts: 42
Joined: Sat Dec 05, 2009 6:08 pm

Re: OpenGL Coverflow

Postby Bruce Wheaton » Thu Jan 28, 2010 9:01 pm

maxprod wrote:
zamrate wrote:i think you have to use OpenGlCompoent::getContextLock( ) when transfering textures.


I will check that when I'll find minutes. Thanks for replying. If it's the solution, i will rewrite the component more proper, especially CoverFlowComponent is badly written.


Just found this thread, super work Max! And it looks like you're learning OpenGL as you go along too? Cool.

So yes, OpenGL is fussy about threads. You should ideally:
- only use each context on one thread
- create and destroy the context on the same thread

There are two things you may want to look at as well:
- shared contexts, where each context can access the textures, lists etc. of the other (you can use one thread/context just to upload)
- PBOs, where you can 'start' a texture upload, then go off and do other things in that thread - the GPU will use DMA to transfer, as long as you don't try to access the texture right away.

Keep it up, great stuff.

Bruce
User avatar
Bruce Wheaton
JUCE UberWeenie
 
Posts: 936
Joined: Thu Aug 17, 2006 1:43 am
Location: Northern California

Re: OpenGL Coverflow

Postby Dub » Thu Jan 28, 2010 11:17 pm



Eek! When I get a chance, I'd love to
Dub
Dub
JUCE UberWeenie
 
Posts: 158
Joined: Wed Jun 28, 2006 10:45 pm
Location: London

Re: OpenGL Coverflow

Postby rolnxyz » Mon Feb 01, 2010 8:59 pm

I would like to see that cool VU Meter you mentioned in the original post.
User avatar
rolnxyz
JUCE Weenie
 
Posts: 11
Joined: Tue Jan 19, 2010 10:56 pm
Location: Seattle, WA

Re: OpenGL Coverflow

Postby maxprod » Mon Feb 01, 2010 10:09 pm

User avatar
maxprod
JUCE UberWeenie
 
Posts: 100
Joined: Fri Mar 14, 2008 2:12 pm
Location: Lille, France

PreviousNext

Return to Useful Tools and Components

Who is online

Users browsing this forum: No registered users and 0 guests