# leonard2012

Member

102

167 Neutral

• Rank
Member

• Interests
Programming
1. ## Why the transform between normalized device and viewport coordinates is different between OpenGL and Direct3D?

Hi Hodgman, Thank you for your help. It seems that I'd better accept and remember these nuances.
2. ## 3D Why the transform between normalized device and viewport coordinates is different between OpenGL and Direct3D?

According to https://en.wikibooks.org/wiki/GLSL_Programming/Vertex_Transformations and https://www.khronos.org/registry/OpenGL-Refpages/es2.0/xhtml/glViewport.xml, the relation between normalized device coordinates (NDC) and viewport coordinates in OpenGL is y_vp = (y_ndc + 1) * height / 2 For Direct3D however, it is said in section 16.1 of "Introduction to 3D Game Programming with DirectX 11" by F. D. Luna (https://www.amazon.com/Introduction-3D-Game-Programming-DirectX/dp/1936420228) that the relation is y_vp = (1 - y_ndc) * height / 2 I could not figure out the reason of this difference. Could someone kindly give me some explanation?
3. ## 3D complex polygons rendering on a sphere with GLU tessellation routines

Thanks, I will do some research on tessellation first.
4. ## 3D complex polygons rendering on a sphere with GLU tessellation routines

The picture below shows what we have done in rendering continent in white and ocean in blue with GLU tessellation routines.     We need to do the same (shading continents in white) in 3D but have not figure it out.
5. ## 3D complex polygons rendering on a sphere with GLU tessellation routines

The projection mentioned in my previous post is cartographic projections, not projection matrix. The problem with the mesh method is that GLU tessellation routines work for polygons, not mesh. I wonder if OpenGL support triangulation of a mesh.
6. ## 3D complex polygons rendering on a sphere with GLU tessellation routines

Thank you for further discussion. Actually the polygons of the input data all represent continents. Among them, a small portion of polygons are continent boundaries and therefore of large length, whereas the rest (usually hundreds of) are all island and peninsular boundaries and of small length. Let's take a look at a large polygon for example representing north American continent. As all the vertices of a polygon are on its boundary, the tessellation of this polygon is just a plane. So a possible solution is to make a mesh from a polygon by adding some vertices inside the polygon. As to why I choose render-time computation, there are two reasons. First, we need to draw on the planet surface other iregular polygons, whose boundaries tend to change from time to time. Typical examples of these polygons are rainfall/drought/forest regions. Second, users may change projection types at runtime, which cause recalculation of boundary vertex coordinates.
7. ## 3D complex polygons rendering on a sphere with GLU tessellation routines

I am sorry for being so late to reply. I was sent on-site to our client to fix bugs in our system in the past two weeks. What I want to do is just draw the continents in a different color (e.g. white) from the Earth surface color (e.g. light blue). The continent boundary data can be obtained from either authoritative agencies or open source GIS projects. The data is encoded in ISRI shape format and consists of thousands of complex polygons.
8. ## 3D complex polygons rendering on a sphere with GLU tessellation routines

Thanks for reply. You mean I may use texture mapping.Could you recommend some relevant code samples? I am new to OpenGL and have no clear mind on how to do this.
9. ## 3D complex polygons rendering on a sphere with GLU tessellation routines

In my app, I need to render complex polygons representing e.g. continents, rainfall regions on the Earth surface. The Earth is simulated with a bi-tangent sphere like Google Earth. In 2D orthogonal projection, I can render complex polygons with GLU tessellation routines (gluTessNew, gluTessCallback and so on). When I do the same in 3D perspective projection, most of the part of a polygon except the boundary is occluded by the sphere surface. The cause of the error is that all the vertices of a tessellated polygon lie on a plane, and this plane is behind the spherical surface of the Earth. I really appreciate if someone could recommend some hints on how to accomplish the task.
10. ## Viable 3D text rendering solution for DirectX11

Thank you for the recommendations. I've tried both and decided to skip FW1FontWrapper, which cannot be consumed in Windows Phone applications. The font engine (rastertek.com/dx11tut12.html) is great, but it has the common problem with DirectX Tool Kit's SpritonFont/SpriteBatch implementation: it works in screen space, not in world space. This means I have to read and modify  the code to suit my need.
11. ## Viable 3D text rendering solution for DirectX11

Thank you. I've tried FW1FontWrapper but found it had one problem: it use Win32 GDI APIs that are not available in WinRT (Windows store and phone store APIs).
12. ## Viable 3D text rendering solution for DirectX11

Thank you, I'll check that code.
13. ## Viable 3D text rendering solution for DirectX11

Thanks, I just need the projected 2D text. I searched "DirectX billboard" but all the results are for DX10 and below or XNA. I need one for DX11.
14. ## Viable 3D text rendering solution for DirectX11

I need to draw text in 3D perspective scene. The text can be rotated/translated/scaled so that it can be drawn with desired position and orientation. Is there any viable solutions to my issue? thanks.
15. ## 3D text rendering with DirectX Toolkit's SpriteFont

I am trying to implement text/symbol rendering in 3D perspective projection setup using DirectXTK's SpriteBatch/SpriteFont. I've searched the web on related topics and found two helpful articles [1],[2]. To experiment with walbourn's code given in [2], I start with the DirectXTK simple sample [3]. I want to change the code so that the Windows logo and the text "DirectXTK Simple Sample" take on a 3D perspective feel of look. The only changes I've made so far is in function Renderer::Render() of file Renderer.cpp. In details, I pass an transform matrix as the function argument to Renderer::Render.      // Draw sprite     XMMATRIX world = XMLoadFloat4x4( &m_world );     XMMATRIX view = XMLoadFloat4x4( &m_view );     XMMATRIX projection = XMLoadFloat4x4( &m_projection );     XMMATRIX local = XMMatrixMultiply( world, XMMatrixTranslation( -2.f, -2.f, -4.f ) );     XMMATRIX worldViewProj = local * view * projection;     m_sprites->Begin(DirectX::SpriteSortMode_Deferred, nullptr, nullptr, nullptr, nullptr, nullptr, worldViewProj);     //m_sprites->Begin();     m_sprites->Draw( m_texture2.Get(), XMFLOAT2(10,75), nullptr, Colors::White );     m_font->DrawString( m_sprites.get(), L"DirectXTK Simple Sample", XMFLOAT2( 100, 10 ), Colors::Yellow );     m_sprites->End();  The rendering result is apparently wrong as both logo and text are invisible at first and then become rays of light staring from the top-left corner of the screen, and then disappear again at the end of animation period. Could someone tell me what's wrong with my code. How to change the code so that the logo and the text are rendered on the surface of the tea pot or character face? Thank you in advance.   [1] SpriteBatch billboards in a 3D world. http://blogs.msdn.com/b/shawnhar/archive/2011/01/12/spritebatch-billboards-in-a-3d-world.aspx?PageIndex=2. [2] SpriteBatch.Begin() https://directxtk.codeplex.com/discussions/459391. [3] DirectXTK Simple Sample (Windows 8.1) http://code.msdn.microsoft.com/DirectXTK-Simple-Sample-a0b6de36.   PS: I've posted this question on MSDN a few days ago but got no reply yet. Sorry for the repetition.