Getting GLEW error 1 (Missing GL version) on FireMonkey

  

I’m building a cross-platform app with C++Builder 10.2 Tokyo and FireMonkey which uses OpenGL 2.0. On Android, using OpenGL (ES) 2.0 is easy, as it is provided by the operating system. On Windows, only OpenGL 1.1 is included, so I am using GLEW to make use of OpenGL 2.0.

When I call glewInit(), it returns with an error code of 1 (“Missing GL version”). This is often the case when an OpenGL context has not yet been created and made current; however, an OpenGL context should already have been made current by the FireMonkey TForm3D I am using to draw, and my drawing code uses this context successfully when run on Android. What do I need to do in order to initialize GLEW properly?

Below is the relevant part of my code, which is called by my Form3DRender FireMonkey callback:

#ifdef _WIN32
glewExperimental = 1;
int result = glewInit();
if (result) {
exit(result);
}
#endif

Comments are closed.