I'm attempting to integrate a program I've written using Irrlicht with the AR devices from TIltFive (tiltfive.com). As far as I can tell, to send a frame to the glasses, I need to provide them with structures of type GL_TEXTURE_2D for each of the left and right eyes. Is there a way to access the underlying GL structures using the existing Irrlicht calls?
If I've understood things correctly, I need to call addRenderTargetTexture for each of the eyes (cameras) and then in the main loop do a setRenderTarget and a drawAll for each one. At that point I'm guessing I have populated GL structures that can either be sent to the host GL engine or to the glasses?
Of course, I may be completely off base here, in which case I'd be happy to learn the right way to do something like this.
Thanks in advance,
TiltFive Integration
Re: TiltFive Integration
There is no official way currently.
If you don't bother about your code getting a bit dirty there is some workaround...
You can directly include headers from the Irrlicht source folder - the ones you would need are COpenGLDriver.h and COpenGLCoreTexture.h. And as you know you are working with opengl (assuming this isn't with OGLES in which you you would have to include that stuff instead) your texture is internally a COpenGLCoreTexture<COpenGLDriver>. So you can cast to that. And usually other API's need the texturename (GL_TEXTURE_2D is used to create the texture and it returns a "name" which is really just an integer) which you can then get with getOpenGLTextureName().
So example:
Sorry, I know using internal interfaces is ugly, but there is no cleaner solution yet currently. In some projects doing this will be fine (I use a similar hack in company code...), in others it's probably not acceptable.
If you don't bother about your code getting a bit dirty there is some workaround...
You can directly include headers from the Irrlicht source folder - the ones you would need are COpenGLDriver.h and COpenGLCoreTexture.h. And as you know you are working with opengl (assuming this isn't with OGLES in which you you would have to include that stuff instead) your texture is internally a COpenGLCoreTexture<COpenGLDriver>. So you can cast to that. And usually other API's need the texturename (GL_TEXTURE_2D is used to create the texture and it returns a "name" which is really just an integer) which you can then get with getOpenGLTextureName().
So example:
Code: Select all
COpenGLCoreTexture<COpenGLDriver>* glTex = static_cast<COpenGLCoreTexture<COpenGLDriver>*>(yourTexture);
glTex->getOpenGLTextureName();
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: TiltFive Integration
Excellent. That seems to have worked. However, it looks like the 1.8.5 code base I'm using may be a little different than yours. In mine, there isn't a COpenGLCoreTexture.h, but just COpenGLTexture.h. And in it COpenGLTexture isn't a template but a class of its own. But it does have the getOpenGLTextureName method. I'm getting back 34 and 35. I'm no expert on GL, so I can't say whether these make sense in absolute terms, but the fact that they're consecutive and come from a pair of back to back calls to addRenderTargetTexture seems to make sense at least.
As for it being ugly to reach inside and mess with the internals, I'm not worried about it. This isn't a commercial product; it's more academic research. So I'm fine with doing it this way. If something breaks in the future, I expect I can adapt.
BTW, it's one of various forms of visualization I'm adding to my simulator of the ENIAC. We already had versions for a first-person arcade style interface and a stereo display with LCD shutter glasses. I'm trying to add an AR glasses device now.
Thanks,
As for it being ugly to reach inside and mess with the internals, I'm not worried about it. This isn't a commercial product; it's more academic research. So I'm fine with doing it this way. If something breaks in the future, I expect I can adapt.
BTW, it's one of various forms of visualization I'm adding to my simulator of the ENIAC. We already had versions for a first-person arcade style interface and a stereo display with LCD shutter glasses. I'm trying to add an AR glasses device now.
Thanks,
Re: TiltFive Integration
Ah yes, I was talking about svn trunk. Which I'd strongly recommend to use instead of Irrlicht 1.8.5 at this point as it has lots of improvements and bugfixes.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm