I've been using CS to make a prototype for a game project I'm working on.
I've got some 3D stuff down and now I've been attempting to work with making a GUI of my own design, seeing that AWS probably won't meet the needs of my project.
Therefore, I've tried to make use of iGraphics2D functions like Blit and Write to get GUI elements on the screen.
However, I've isolated a crash case to occur whenever I call either of these functions. The prototype will crash and I've narrowed it to a memory access error (which hasn't really totld me what is at fault). I've theorized that I'm not putting these calls between relevant BeginDraw and FinishDraw calls, but after playing with this extensively I haven't had success. Further, I've tried putting these calls both before and after the 3D scene is drawn to the frame buffer (obviously, since the 2D stuff would overlay, I would want it after, but it crashes in either instance).
I am guessing that I am not setting up the drawing right such that the 2D functions can work. Here's a sample of relevent code:
// Tell 3D driver we're going to display 3D things.
if (!g3d->BeginDraw (engine->GetBeginDrawFlags () | CSDRAW_3DGRAPHICS))
// Tell the camera to render into the frame buffer.
// Draw UI if necessary
ReportError("About to write.");
g2d->Write(font, 200, 100, g2d->FindRGB(255, 255, 255), -1, "This is a GUI");
I get the error reported but then nothing is displayed before a crash. I've tried beginning the draw in 2D as well as telling the iGraphics3D that I'm going to draw in 2D (CSDRAW_GRAPHICS2D) but to no avail.
What is the general way to draw using both the 2D and 3D interfaces in CS during the same frame?
Thanks for the help.