@@ -60,7 +60,7 @@ int GlEngine::initGL(OS::OS& os) {
6060 // Use the GL3 way to get the version number
6161 glGetIntegerv (GL_MAJOR_VERSION, &OpenGLVersion[0 ]);
6262 glGetIntegerv (GL_MINOR_VERSION, &OpenGLVersion[1 ]);
63- std::cout << " Using OpenGL " << OpenGLVersion[0 ] << " ." << OpenGLVersion[1 ] << " \n " ;
63+ std::cerr << " Using OpenGL " << OpenGLVersion[0 ] << " ." << OpenGLVersion[1 ] << " \n " ;
6464
6565 // Sanity check to make sure we are at least in a good major version number.
6666 assert ((OpenGLVersion[0 ] > 1 ) && (OpenGLVersion[0 ] < 5 ));
@@ -324,6 +324,11 @@ int GlEngine::initGL(OS::OS& os) {
324324 glAttachShader (shaderProgram, fragmentShader);
325325 check_gl_error ();
326326
327+ // Bind attributes indexes
328+ glBindAttribLocation (shaderProgram, sh_in_Position, " in_Position" );
329+ glBindAttribLocation (shaderProgram, sh_in_Color, " in_Color" );
330+ glBindAttribLocation (shaderProgram, sh_in_UV, " in_UV" );
331+
327332 // Link shader program
328333 glLinkProgram (shaderProgram);
329334
@@ -347,11 +352,6 @@ int GlEngine::initGL(OS::OS& os) {
347352 return -1 ;
348353 }
349354
350- // Bind attributes indexes
351- glBindAttribLocation (shaderProgram, sh_in_Position, " in_Position" );
352- glBindAttribLocation (shaderProgram, sh_in_Color, " in_Color" );
353- glBindAttribLocation (shaderProgram, sh_in_UV, " in_UV" );
354-
355355 modelId = glGetUniformLocation (shaderProgram, " in_Model" );
356356 viewId = glGetUniformLocation (shaderProgram, " in_View" );
357357 projId = glGetUniformLocation (shaderProgram, " in_Proj" );
@@ -426,7 +426,7 @@ void GlEngine::UpdScreen (OS::OS& os, const double delta) {
426426 auto tdata = glMapBufferRange (GL_PIXEL_UNPACK_BUFFER, 0 , 320 *240 *4 ,
427427 GL_MAP_WRITE_BIT |GL_MAP_INVALIDATE_BUFFER_BIT );
428428 if (tdata != nullptr ) {
429- // std::fill_n(tdata, 320*240, 0xFF800000);
429+ std::fill_n (( unsigned *) tdata, 320 *240 , 0xFF800000 );
430430 if (painter) {
431431 painter (tdata);
432432 }
0 commit comments