Old 07-18-2010, 11:47 PM   #1
-kiff-
Human being with feelings
 
-kiff-'s Avatar
 
Join Date: May 2010
Location: Tx.
Posts: 32
Default Direct3D or OpenGL in a plugin?

I've looked around a little without finding a lot, but I figured you guys could give me a quick answer on the feasibility of this. I'd like to make a VST or a Reaper plugin that displays 3d graphics. D3D or OGL is fine since I'm familiar with both.

Is this doable at all? Windows only is fine (at least to start).

TIA!
-kiff- is offline   Reply With Quote
Old 07-19-2010, 11:28 AM   #2
-kiff-
Human being with feelings
 
-kiff-'s Avatar
 
Join Date: May 2010
Location: Tx.
Posts: 32
Default

So, from what I've seen, JS's gfx_ lib doesn't look like it can do it nor can VSTGUI. Any other possibilities?
-kiff- is offline   Reply With Quote
Old 07-19-2010, 11:50 AM   #3
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,750
Default

It's definitely possible (I did a proof of concept plugin for this years ago). It's not trivial though. You might want to look at lice_glbitmap for some guidance, though that code is not much more than a proof of concept itself.

I can't even really remember what this plugin was intended to do


Last edited by schwa; 07-19-2010 at 02:04 PM.
schwa is offline   Reply With Quote
Old 07-19-2010, 12:58 PM   #4
-kiff-
Human being with feelings
 
-kiff-'s Avatar
 
Join Date: May 2010
Location: Tx.
Posts: 32
Default

Quote:
Originally Posted by schwa View Post
It's definitely possible (I did a proof of concept plugin for this years ago). It's not trivial though. You might want to look at lice_glbitmap for some guidance, though that code is not much more than a proof of concept itself.
Cool. So it is a reaper plugin (I figured that would be the most likely route).

OK, I couldn't find "lice_glbitmap" specifically (found LICE__GetDC and LICE_CreateBitmap functions... looking for a type?), but it looks like this is roughly process:
- Get a handle (or pointer) to the drawing context of the plugin (or a bitmap created by it).
- Use windows API to do the d3d/ogl rendering and pass it the pointer to the context (or bitmap)

It's been a while since I've coded d3d, so the exacts maybe different, but is that basically the way you did it?

Quote:
I can't even really remember what this plugin was intended to do
Very nice! It pretty much looks like what I wanted to do. Draw a 3d surface ("terrain") of the entire song's spectrum so you can see what's going on at a glance. Also, having a plane (like a ceiling) that you can lower to certain peaks, for a reference, to compare to others (for example to compare chorus 1 to chorus 2).
-kiff- is offline   Reply With Quote
Old 07-19-2010, 01:07 PM   #5
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,750
Default

That was a generic VST plugin, there wasn't anything Reaper-specific. It did more or less what you say, create an openGL context and bind it to the plugin's HWND.

lice_glbitmap.cpp is a file included with LICE, that handles mixing standard LICE and GDI drawing (and mouse capture, etc) with openGL, by managing an offscreen drawing context and copying data back and forth. It would only be interesting if you didn't want to do everything inside openGL.
schwa is offline   Reply With Quote
Old 07-19-2010, 02:06 PM   #6
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 15,750
Default

White Tie found a copy of the actual working plugin ... here it is:
https://stash.reaper.fm/oldsb/957592/RubberSoul.dll

Left and right drag to move stuff around. I think this was the first VST I ever did, as well as the first thing I ever worked with White Tie on. Like I said it was just a proof of concept, it doesn't do anything but the display. Also it's probably horribly inefficient. But it does prove the concept!
schwa is offline   Reply With Quote
Old 07-19-2010, 03:16 PM   #7
-kiff-
Human being with feelings
 
-kiff-'s Avatar
 
Join Date: May 2010
Location: Tx.
Posts: 32
Default

Quote:
Originally Posted by schwa View Post
That was a generic VST plugin, there wasn't anything Reaper-specific. It did more or less what you say, create an openGL context and bind it to the plugin's HWND.
ok, even better

Quote:
lice_glbitmap.cpp is a file included with LICE, that handles mixing standard LICE and GDI drawing (and mouse capture, etc) with openGL
great, I'll check it out

Quote:
Originally Posted by schwa View Post
White Tie found a copy of the actual working plugin ... here it is:
https://stash.reaper.fm/oldsb/957592/RubberSoul.dll

Left and right drag to move stuff around. I think this was the first VST I ever did, as well as the first thing I ever worked with White Tie on. Like I said it was just a proof of concept, it doesn't do anything but the display. Also it's probably horribly inefficient. But it does prove the concept!
scroll wheel zooms hopefully some optimizations, like vertex arrays and triangle lists, will boost it.

Good work, pretty cool!
-kiff- is offline   Reply With Quote
Old 07-22-2010, 10:44 PM   #8
bruce
Human being with feelings
 
Join Date: Jul 2010
Posts: 66
Default

It sounds like you already have a good answer. But I might as well point out the Juce explicitly supports OpenGL, if you want to use Juce.

From their site: "OpenGL support makes it easy to have openGL running inside a Juce component".

But, as people have pointed out, associating gl with an HWND it not exactly black magic ;-)
bruce is offline   Reply With Quote
Old 07-22-2010, 10:59 PM   #9
-kiff-
Human being with feelings
 
-kiff-'s Avatar
 
Join Date: May 2010
Location: Tx.
Posts: 32
Default

cool, thanks bruce. It looks like Juce would be helpful for ports (assuming I ever get to that stage).

hopefully I'll get some time soon to get on this project... damned 24 hr days
-kiff- is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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


All times are GMT -7. The time now is 03:37 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.