Week 2

I went in deeper into the code this week. The first version of the system (which is currently used for demonstrations) has the basic functionality. However, it is also one big 2500+ line file which makes it very hard to add to and debug. Janaka is currently writing a new version, breaking down the application into smaller chunks. Thus, the new version is much more "object-oriented".

In a second meeting, I was also told about upcoming conferences and demonstrations, such as MobileHCI etc… In particular, I have been asked to demonstrate the system in one of the polytechnics on the 11th of September.


I started off implementing some basic functionality, atop the work that Janaka has already done. The first was displaying a text message that's received. And the other was drawing some objects on screen.

For both, I had to read through the current program and understand the concepts. This often required a lot of questions and answers from Janaka.

Displaying the text/message

The assignments also required a lot of reading and searching for information from books/online. In this case, I had to convert a basic c-string to a wchar_t*, since that was what the displaytext object took in as parameter. I finally did find the solution to this.

// First convert to a char*
const size_t newsize = 100;
char nstring[newsize];
strcpy_s(nstring, cstring.c_str());
strcat_s(nstring, " (char *)");
// Then convert to a wchar_t*
size_t origsize = strlen(cstring.c_str()) + 1;
size_t convertedChars = 0;
wchar_t wcstring[newsize];
mbstowcs_s(&convertedChars, wcstring, origsize, cstring.c_str(), _TRUNCATE);
wcscat_s(wcstring, L" (wchar_t *)");

During this process, I also learnt quite a bit on how to display non-english text on screen using OpenGL.

Drawing Objects

The new re-written version did not have the objects such as butterflies on screen yet. To get me started on OpenGL, this would again be a good exercise. I also had to create the Butterfly classes from scratch, which meant I would get even more exposure since I had to do this one from scratch.

There was a issue with the textures (they were not loading properly). However, more importantly, the program slowed down to a crawl when 50 butterflies were drawn on screen. Janaka suggested I use OpenGL Display Lists, which was again another new term. So I spent some time reading up on that. That's what I'm working on now.


Comments here.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License