I finally started working on this, and here's the code I have so far. I'm trying to do everything within a single function, instead of using csProxTexture. The first block containing LoadTexture is within another function, in case you're wondering why the code searches for the texture right after that (so it's intentional). The goal is to write text onto a loaded texture, but for now I'm testing it by trying to draw a line.
if (!loader->LoadTexture(name, filename))
{
ReportError("Error loading texture");
return false;
}
csRef<iTextureWrapper> tex = engine->GetTextureList()->FindByName(name);
if (!tex)
return false;
g3d->SetRenderTarget(tex->GetTextureHandle());
if (!g3d->BeginDraw (CSDRAW_2DGRAPHICS)) return false;
g2d->DrawLine(1, 1, 100, 100, g2d->FindRGB(255, 255, 255));
g3d->FinishDraw();
//g3d->UnsetRenderTargets();
This is all done before Prepare() is run, but the supposedly modified texture isn't changed from this code (on Windows at least). On Linux, the app crashes later on when trying to render the texture. I've also tried switching engine contexts, which doesn't help. Is there something I'm doing wrong here?
-eventhorizon