MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / SimpleOpenGL2App

Method SimpleOpenGL2App

examples/OpenGLWindow/SimpleOpenGL2App.cpp:115–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115SimpleOpenGL2App::SimpleOpenGL2App(const char* title, int width, int height)
116{
117 gApp2 = this;
118 m_data = new SimpleOpenGL2AppInternalData;
119
120 m_window = new b3gDefaultOpenGLWindow();
121 b3gWindowConstructionInfo ci;
122 ci.m_title = title;
123 ci.m_openglVersion = 2;
124 ci.m_width = width;
125 ci.m_height = height;
126 m_window->createWindow(ci);
127
128 m_window->setWindowTitle(title);
129
130#ifndef NO_GLEW
131#ifndef __APPLE__
132#ifndef _WIN32
133#ifndef B3_USE_GLFW
134 //some Linux implementations need the 'glewExperimental' to be true
135#endif //B3_USE_GLFW
136#endif //_WIN32
137
138#ifndef B3_USE_GLFW
139 //gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
140
141#if 0
142 if (glewInit() != GLEW_OK)
143 {
144 b3Error("glewInit failed");
145 exit(1);
146 }
147 if (!GLEW_VERSION_2_1) // check that the machine supports the 2.1 API.
148 {
149 b3Error("GLEW_VERSION_2_1 needs to support 2_1");
150 exit(1); // or handle the error in a nicer way
151 }
152#endif
153#endif //B3_USE_GLFW
154#endif //__APPLE__
155#endif //NO_GLEW
156
157 TwGenerateDefaultFonts();
158 m_data->m_fontTextureId = BindFont2(g_DefaultNormalFont);
159 m_data->m_largeFontTextureId = BindFont2(g_DefaultLargeFont);
160
161 glGetError(); //don't remove this call, it is needed for Ubuntu
162 glClearColor(m_backgroundColorRGB[0],
163 m_backgroundColorRGB[1],
164 m_backgroundColorRGB[2],
165 1.f);
166
167 b3Assert(glGetError() == GL_NO_ERROR);
168
169 //m_primRenderer = new GLPrimitiveRenderer(width,height);
170 m_parameterInterface = 0;
171
172 b3Assert(glGetError() == GL_NO_ERROR);

Callers

nothing calls this directly

Calls 10

exitFunction · 0.85
TwGenerateDefaultFontsFunction · 0.85
BindFont2Function · 0.85
createWindowMethod · 0.45
setWindowTitleMethod · 0.45
setMouseMoveCallbackMethod · 0.45
setKeyboardCallbackMethod · 0.45
setWheelCallbackMethod · 0.45
setResizeCallbackMethod · 0.45

Tested by

no test coverage detected