Web Mercator projection reprojection

When using Ceisum to load the tiles of the web Mercator projection, there are some places that I cannot understand. The reprojectToGeographic function is used when the _reprojectTexture function in the ImageryLayer.js file reprojects the tiles. Create a projection shader, vertex, texture, and index data in the reprojectToGeographic function, and then reproject the tiles. Everything is normal in cesium. But when I use Cpp to display a square in OpenGL with the shader, vertex, texture, and index, the projected tiles are not obtained. I am sure that the shader is correct, and the vertex, texture, and index are also correct. But as a result, the reprojected picture cannot be seen.
I can’t find the reason now. What is the cause?

@mylove10086

Can you please share a sandcastle demo that showcases the issue that you are facing? This will provide a good place to start debugging.

-Sam

WebMercatroProjection.zip (3.7 MB)
Thank you very much for your reply.
This is my test code, built using clion and cmake. Realize that the Mercator projected picture is displayed in two triangles. Can not reproject successfully. I don’t know where the problem is.

Thank you very much

@mylove10086

Thank you for sharing this with me. When I get the chance, I will look through your repository. Any instructions for running your code?

-Sam

thank you very much for your help
The project code is built by cpp cmake. All third-party libraries used are compiled in the project using source code.

  1. 5.2WebMercatorProjection.cpp is the main function for testing Mercator projection. There are two shaders in 5.2WebMercatorProjection.cpp, render_vs is the shader for Mercator reprojection in cesium, and render_vs1 is the shader used to display the reprojection. Running the program will display a rectangle. The startOpenGL function contains the vertex, texture, and index data to create the rectangle.
  2. The initwindow function creates a rectangular shader and initializes all the data. Then the webMer function initializes the data of the Mercator projection and reprojects it.
  3. The code in the WebDraw.h file is used to reproject Mercator tiles. Initialize the reprojected vertices and index data in the webMer function and perform reprojection.
  4. The data methods created by the positions(), indeicesFun(), and webMercatorTFun() functions all come from the reprojectToGeographic function of the ImageryLayer.js file of cesiuim.
    The result of the current operation is:
    6EB9YV6RUB09P%`E2TDA1W

The ideal result is to be able to see the tiles after projection, but this is not yet possible. I don’t know where the problem is. Please give me some hints

thank you very much for your help
I have found the reason and solved the problem
Thanks again

@mylove10086

I am happy to help out and glad that you were able to find a solution to your problem! :grinning: :rocket:

-Sam