TileRenderer in Cinder 0.9.0

H everyone,

I haven’t been able to find the TileRender implementation in Cinder 0.9.0. Does it still exist? If not, does anyone have any suggestions on how to re-create this functionality? is it even possible in 0.9.0.

Thanks in advance for any info.

Cheers,

Ken

Looking at the source code, it looks like it should run with very minimal modification. Just change the raw gl calls to use their gl::* counterparts and bob’s your mother’s brother.

edit

Excuse the formatting, fighting against you “tab” heretics. :wink:

Using the same header from 0.8.6 ( except changing the Vec2i to ivec2 ), this seems to do the trick. One thing to be aware of, you may want to change TileRender::getSurface() to return a const ref, because i believe this used the old implicitly shared object paradigm where copying a Surface wouldn’t trigger a copy of the underlying data, whereas now i’m pretty sure it does, and being that this class is for rendering giant images, it’s a copy you definitely want to avoid.

A.

Thanks very much for the source code and information @lithium.

I’ll give it a go!

Cheers,

Ken

Hi folks,

I’m still struggling to implement the TileRender in 0.9.0.

  1. I grabbed the TileRender.h file from 0.8.6 and @lithium’s gist for the TileRender.cpp file.
  2. Replaced all Vec2i with ivec2
  3. Saved TileRender.h into include/cinder/gl and saved TileRender.cpp into src/cinder/gl
  4. Rebuilt Cinder 32 debug with no errors.
  5. Included TileRender.h in EarthquakeApp.cpp: #include “cinder/gl/TileRender.h”
  6. Added the TileRendercalls back into the keydown event of the Earthquake example.

else if (event.getChar() == ’ ') {
gl::TileRender tr( 5000, 5000 );
CameraPersp cam;
cam.lookAt(mPov.mEye, mPov.mCenter);
cam.setPerspective(60.0f, tr.getImageAspectRatio(), 1, 20000);
tr.setMatrices(cam);
while (tr.nextTile()) {
draw();
}
writeImage(getHomeDirectory() / “output_Cinder_9.png”, tr.getSurface());

  1. Ran EarthquakeApp.cpp in debug mode in VS 2013.

  2. Got 3 compile-time errors for unresolved externals related to the “gl::TileRender tr” iinstance.

1>EarthquakeApp.obj : error LNK2019: unresolved external symbol “public: __thiscall cinder::gl::TileRender::TileRender(int,int,int,int)” (??0TileRender@gl@cinder@@QAE@HHHH@Z) referenced in function “public: virtual void __thiscall EarthquakeApp::keyDown(class cinder::app::KeyEvent)” (?keyDown@EarthquakeApp@@UAEXVKeyEvent@app@cinder@@@Z)
1>EarthquakeApp.obj : error LNK2019: unresolved external symbol “public: bool __thiscall cinder::gl::TileRender::nextTile(void)” (?nextTile@TileRender@gl@cinder@@QAE_NXZ) referenced in function “public: virtual void __thiscall EarthquakeApp::keyDown(class cinder::app::KeyEvent)” (?keyDown@EarthquakeApp@@UAEXVKeyEvent@app@cinder@@@Z)
1>EarthquakeApp.obj : error LNK2019: unresolved external symbol “public: void __thiscall cinder::gl::TileRender::setMatrices(class cinder::Camera const &)” (?setMatrices@TileRender@gl@cinder@@QAEXABVCamera@3@@Z) referenced in function “public: virtual void __thiscall EarthquakeApp::keyDown(class cinder::app::KeyEvent)” (?keyDown@EarthquakeApp@@UAEXVKeyEvent@app@cinder@@@Z)
1>E:\libs\cinder\samples\Earthquake\vc2013\Debug\Earthquake.exe : fatal error LNK1120: 3 unresolved externals

The weird thing is that I’m using Visual Assist X and its Intellisense sees all of the methods the compiler is complaining about as being available to the “gl::TileRender tr” instance.

Just to be sure I didn’t mess up something, I cleaned the Cinder solution and repeated all the steps above. Same problem persists.

My question is since Tilerender has been removed from 0.9.0 has something fundamentally changed about Cinder that makes using the Tilerender simply impossible? If so, can anyone suggest an alternate method of saving out huge images from Cinder?

Thanks in advance for any advice.

Cheers,

Ken

You’ll need to add TileRender.cpp to the cinder solution (and recompile it) otherwise it won’t be compiled and included in the static library; just having it exist on the filesystem isn’t enough. You could also add the .cpp to your project too, though that’s a slightly dirtier way around it.

Hi @lithium

I can’t believe I forgot this step. Of course, now that I added the files to the Cinder solution and rebuilt it everything is working great.

I’ve never added a new file to a Cinder solution, so it just slipped my mind entirely.

Thank you so much for taking the time to point out such a simple error for me. And thanks again for the gist. It’s great to be up and running again.

Cheers,

Ken

Hey @lithium - This is a bit of an older thread but didn’t feel like I needed to create a new one to ask this:

I was able to get TileRenderer setup and working no problem with the most recent version of Cinder as long as I’m not running my app using the high density enabled flag. If I set the app to run with setHighDensityEnabled(true), the output of the TileRenderer is only a single solid texture of whatever the gl::clear color is set to, but none of the draw commands show up in the output image. Any idea how I might be able to modify it to work with a high density app?

Do you have any idea why it was removed from core after 0.8x? After looking at it, I thought maybe it was just a simple enough class that people could implement on their own if they needed it?

Thanks for any tips!

Max.

I have no idea why it was removed, as it took minimal effort to make it (sort of) work in 0.9.0. Looking at it now, there’s definitely some points vs pixels issues here for high density displays. For starters, any reference to app::getWindow{Width|Height}() needs to be wrapped in a app::toPixels() to scale it by the window content scale. With any luck that’s all you’ll need to do, but it’s definitely a good place to start.

Have you checked out https://github.com/rezaali/Cinder-Tiler ? I wrote it and use it for all my work.

Let me know if you need any pointers!

Reza