PDA

View Full Version : Using GLUT in GLFW window



MSSC89
12-29-2015, 12:36 PM
Hi guys i'm new on this forum :).

I'm programming a game, and i had to create a simple menu for it. I decided to use glutBitmapCharacter, but to create main window i'm using functions from GLFW. My question is: Is there any possibility to use functions from GLUT in GLFW windows? I tried, i have initzialized glut, then in main loop writed code

glRasterPos2f(-0.5, 0.5);
glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, 1);
and after running program nothing happens. I mean is it possible to stream items generated by glut into the GLFW window?

I know its not good to use two or more libraries like this, but i don't have any other option. I mean i have, but its extremaly hard to do this in other way.

Thanks for replies!

GClements
12-29-2015, 02:34 PM
Is there any possibility to use functions from GLUT in GLFW windows?

It should be possible provided that GLUT itself is initialised and the context state is such that the OpenGL commands which the GLUT functions execute are meaningful.

Regarding the latter, many of GLUT's utility rendering functions use deprecated features and won't work in a core profile context. E.g. glutBitmapCharacter() uses gl{Push,Pop}ClientAttrib() and glBitmap(), which are deprecated.

If a shader program is active, glRasterPos() will invoke the vertex shader, but user-defined outputs won't be stored along with the raster position; glBitmap() will invoke the fragment shader, and any user-defined inputs will have undefined values.

Apart from that, the possibility of driver bugs can't be eliminated. Even if the developers intend to follow the standard to the letter, the interactions between legacy features and modern features probably don't get a lot of real-world testing.



I know its not good to use two or more libraries like this, but i don't have any other option. I mean i have, but its extremaly hard to do this in other way.

FreeGLUT is distributed under the MIT license, so you could just take the relevant code (or even just the font data) and convert it to work with your code.

MSSC89
12-30-2015, 01:40 AM
It's good idea, but i'm still questioning: How to stream these functions to work in GLFW window?