Chapter 6. Cross-platform, Android

Now we will try to run TheGame spinning triangle sample on Android. 1. Start Visual Studio, open C:\CPP\a999hello\p_android\p_android.sln solution. 2. Under p_android.NativeActivity project add “xTheGame” filter: Right-click on p_android.NativeActivity project -> Add -> New Filter. Name - xTheGame Under xTheGame add Existing Item: Right-click on xTheGame -> Add -> Existing Item, Navigate to C:\CPP\a999hello Files […]

Chapter 5. Cross-platform, Windows

In this chapter we will dissect our GLFW spinning triangle sample. We will move “game” implementation into a separate class, which we will reuse later in Android version. It will be triangle rendering related code. In order to make it platform-independent we will separate it from platform-specific calls. All environment related code, such as window […]

Chapter 4. Printf in OpenGL ES

Now, having OpenGL ES projects for 2 different platforms, we can see what is common and what is different. Common is generic structure: Creating GL context, initializing data, main loop with frames rendering, exit. GL calls (Thank God!) look similar too. The difference is in program and GL initialization, in GL-related includes (gl/egl on Android […]

Chapter 3. Hello Windows

Visual Studio, Windows, C++, OpenGL ES, GLFW, GLAD Using OpenGL ES on the PC is less straight forward than on Android. The reason is that GL ES is intended for mobile devices, NOT for desktops. Fortunately, solutions do exist. OpenGL producers strongly advise to use a window toolkit (GLFW) and an OpenGL loading libraries (GLAD). […]

Chapter 2. Hello Android

Visual Studio, Android, Native activity, C++, OpenGL ES Official Android languages are Java and Kotlin. Native activity will allow us to write code for Android in C++. Besides, Visual Studio’s Native activity template includes OpenGL ES initialization. 1. Open Visual Studio. Pick "Create a new project". In templates menu pick Android, then “Native Activity Application […]

Chapter 1. Installing Visual Studio

1. Google “Visual Studio download”. Proceed to https://visualstudio.microsoft.com Continue to Download Visual Studio -> Community 2022 (or whatever is current). Download and start installer. 2. On Workloads page pick “Desktop development with C++”. Don’t need extra components so far, so use default settings (on the right-hand side panel). If necessary, we can install them later. […]