OpenGL - Message box or Pop up Message box

Hi,

I am writing a program in C using openGl. I am using gcc on linux.

My program needs to pop up a window with two options (i.e Yes or No) when the user clicks on ‘Exit’ button on the screen.

Can anyone please help

I’m no expert on OpenGl but there are a few ways of doing this. One (which I recommend) is that you create it yourself. Create the window images, save them as a strip of some sort (bmp), then draw them to the screen. Get the mouse coordinates, then check if the mouse is within the images, based on if that is true do what you need to do. Another option is to use GLUI, which is pretty much a gui system made with OpenGl (I think there is another one called GLOW, but I’m not quite sure).

LINK

On windows this is pretty simple (MessageBox function) but on Linux it is a bit more involving.

The simplest way I can think of is to use system() to execute xmessage() (see http://linux.die.net/man/3/system , http://linux.die.net/man/1/xmessage ). You may also need to call fork() if you want the message box to be non-modal, but that will probably not be necessary in this case.

The alternative is to use an OpenGL GUI library, or implement it yourself (as the other poster suggested above), but this is probably a bit more work.

You could also use kdialog (for kde) or zenity (for gnome) instead of xmessage.