@@ -160,13 +160,13 @@ namespace glen
160160 {
161161 process_uniform_2d_array ();
162162 }
163- else if (m_target == GL_TEXTURE_CUBE_MAP)
163+ else if (m_target == GL_TEXTURE_CUBE_MAP && m_surfaces. size () > 1 )
164164 {
165- process_cube_map ();
165+ process_textured_cube_map ();
166166 }
167- else if (m_target == GL_TEXTURE_CUBE_MAP_POSITIVE_X )
167+ else if (m_target == GL_TEXTURE_CUBE_MAP )
168168 {
169- process_textured_cube_map ();
169+ process_cube_map ();
170170 }
171171
172172 glTexParameteri (m_target, GL_TEXTURE_MIN_FILTER, m_min_filter);
@@ -538,7 +538,7 @@ namespace glen
538538
539539 Texture Texture::create_cubemap_texture (const std::vector<const char *> face_paths)
540540 {
541- Texture texture{ GL_TEXTURE_CUBE_MAP_POSITIVE_X };
541+ Texture texture{ GL_TEXTURE_CUBE_MAP };
542542
543543 for (auto & face_path : face_paths) {
544544 auto surface = IMG_Load (face_path);
@@ -553,19 +553,22 @@ namespace glen
553553 }
554554 // Texture texture{ face_paths.at(0), true};
555555 texture.set_name (" Cube Map Texture" );
556+ texture.set_width (texture.surface ()->w );
557+ texture.set_height (texture.surface ()->h );
556558 texture.set_internal_format (GL_RGB);
557- texture.set_format (GL_RGB );
559+ texture.set_format (GL_BGR );
558560 texture.set_type (GL_UNSIGNED_BYTE);
561+ texture.set_data (texture.surface ()->pixels );
559562 texture.set_min_filter (GL_LINEAR);
560563 texture.set_mag_filter (GL_LINEAR);
561564 texture.set_mipmap (false );
562565 // texture.set_mipmap(true);
563566 texture.set_st_wrap (GL_CLAMP_TO_EDGE);
564567
565- texture.bind ();
566- // texture.process_cube_map(face_paths);
567- texture.process ();
568- texture.unbind ();
568+ // texture.bind();
569+ // // texture.process_cube_map(face_paths);
570+ // texture.process();
571+ // texture.unbind();
569572
570573 return texture;
571574 }
0 commit comments