PDA

View Full Version : writing on console when using glut



Vlasko
03-10-2003, 08:39 AM
bit off but is there a possibility to do that ? my program always crashes when i use printf(...) command.i want to do it because of the callbacks functions(not debugable i think :-))

shinpaughp
03-10-2003, 09:45 AM
There are several glutStroke and glutBitmap functions which print text to screen. I think they are 1 char at a time but you should be able to write small function with for loop to make it print character strings. Anyway, search the glut.h file for those 2 and you should find about 10 or 15 different functions.

[This message has been edited by shinpaughp (edited 03-10-2003).]

Deiussum
03-10-2003, 11:05 AM
Maybe you're doing something wrong with printf? That's what it kind of sounds like if it is causing you to crash. For instance it can cause exceptions if you have a format string that tries to convert a type to something it can't be converted to.

BTW, callback functions are debuggable.

Vlasko
03-10-2003, 11:39 AM
i know they are :-) but the problem with debugger is it never steps into these functions(it goes init functions ,registering callbacks, glutMainLoop end debugging - VC++ 6.0)

Miguel_dup1
03-10-2003, 12:56 PM
The problem is with GLUT. The way the main loop run in glut does not allow for external commands to run. Tere are code fixes for this on the web.
Here is a link http://sjbaker.org/steve/software/glut_hack.html

You can also do a search for "main loop in glut"

Miguel Castillo


Originally posted by Vlasko:
i know they are :-) but the problem with debugger is it never steps into these functions(it goes init functions ,registering callbacks, glutMainLoop end debugging - VC++ 6.0)

Deiussum
03-11-2003, 05:26 AM
The callback functions don't get called until those events happen. So if you are expecting it to step into your display function after you call:

glDisplayFunc(Display);

You're going to be disappointed. All that function does is the equivalent to setting a pointer variable to the Display function. Display won't get called until after glutMainLoop() is called, where it goes and looks for the events.

Place a breakpoint inside the function you want to step through and all should be well.