SDL and OpenGL - Problem with Rects

Hello all!

I’m making a program with graphical chat. In order to do this, I need to
take input from the user (via PollEvent, due to other events happening at
the same time), and display it on the screen. Whenever a key is pressed, the
Unicode is returned as a letter, and the letter printed to the screen.

However, I am having problems with this last part. I can print only 8
letters (one GL_Rect for every new sequence of characters. i.e. ‘A’, then
’AB’, then ‘ABC’, and so on), before a Segmentation Fault occurs, and the
SDL parachute is deployed.

I can’t work out what it could be - the only thing I’ve come up with is that
I’m rendering too fast, but delaying each by 50 milliseconds didn’t work

I’ll post links to the code for the functions that Print the new text to the
screen, and the function that is used within it.

Printing function (called when a new letter is detected):

Actual function that renders text:

Hope you guys can help!

Many Thanks,


Hi!Am Freitag 11 Juli 2008 schrieb Ben Ockmore:

Printing function (called when a new letter is detected):

If you new[] something you should also delete[] it before you loose your
pointer, although I don’t think that’s causing your problem here.

You are probably miscalculating some string lengths.


Matthias Bach

?Der einzige Weg, die Grenzen des M?glichen zu finden, ist ein klein wenig
?ber diese hinaus in das Unm?gliche vorzusto?en.? - Arthur C. Clarke
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.