* This is the main entry point of a native application that is using * android_native_app_glue. It runs in its own thread, with its own * event loop for receiving input events and doing other things. */
| 38 | * event loop for receiving input events and doing other things. |
| 39 | */ |
| 40 | void android_main(struct android_app* state) |
| 41 | { |
| 42 | // Make sure glue isn't stripped. |
| 43 | app_dummy(); |
| 44 | |
| 45 | vtkNew<vtkRenderWindow> renWin; |
| 46 | vtkNew<vtkRenderer> renderer; |
| 47 | vtkNew<vtkAndroidRenderWindowInteractor> iren; |
| 48 | |
| 49 | // this line is key, it provides the android |
| 50 | // state to VTK |
| 51 | iren->SetAndroidApplication(state); |
| 52 | |
| 53 | renWin->AddRenderer(renderer.Get()); |
| 54 | iren->SetRenderWindow(renWin.Get()); |
| 55 | |
| 56 | vtkNew<vtkSphereSource> sphere; |
| 57 | sphere->SetThetaResolution(8); |
| 58 | sphere->SetPhiResolution(8); |
| 59 | |
| 60 | vtkNew<vtkPolyDataMapper> sphereMapper; |
| 61 | sphereMapper->SetInputConnection(sphere->GetOutputPort()); |
| 62 | vtkNew<vtkActor> sphereActor; |
| 63 | sphereActor->SetMapper(sphereMapper.Get()); |
| 64 | |
| 65 | vtkNew<vtkConeSource> cone; |
| 66 | cone->SetResolution(6); |
| 67 | |
| 68 | vtkNew<vtkGlyph3D> glyph; |
| 69 | glyph->SetInputConnection(sphere->GetOutputPort()); |
| 70 | glyph->SetSourceConnection(cone->GetOutputPort()); |
| 71 | glyph->SetVectorModeToUseNormal(); |
| 72 | glyph->SetScaleModeToScaleByVector(); |
| 73 | glyph->SetScaleFactor(0.25); |
| 74 | |
| 75 | vtkNew<vtkPolyDataMapper> spikeMapper; |
| 76 | spikeMapper->SetInputConnection(glyph->GetOutputPort()); |
| 77 | |
| 78 | vtkNew<vtkActor> spikeActor; |
| 79 | spikeActor->SetMapper(spikeMapper.Get()); |
| 80 | |
| 81 | renderer->AddActor(sphereActor.Get()); |
| 82 | renderer->AddActor(spikeActor.Get()); |
| 83 | renderer->SetBackground(0.4, 0.5, 0.6); |
| 84 | |
| 85 | vtkNew<vtkTextActor> ta; |
| 86 | ta->SetInput("Droids Rock"); |
| 87 | ta->GetTextProperty()->SetColor(0.5, 1.0, 0.0); |
| 88 | ta->SetDisplayPosition(50, 50); |
| 89 | ta->GetTextProperty()->SetFontSize(32); |
| 90 | renderer->AddActor(ta.Get()); |
| 91 | |
| 92 | iren->Initialize(); |
| 93 | renWin->Render(); |
| 94 | renWin->Render(); |
| 95 | renWin->Render(); |
| 96 | renWin->Render(); |
| 97 | renWin->Render(); |
nothing calls this directly
no test coverage detected