• Skip to main content
  • Skip to primary sidebar

Anastasios Chondrogiannis

Software developer with a focus on iOS

Android OpenGL ES – Part 10: Specular lighting

March 25, 2020 by Anastasios Chondrogiannis Leave a Comment

In order to apply specular lighting you will need 4 additional pieces of information:

  1. The fragment position.
  2. The camera position.
  3. The specular intensity of the pyramid material.
  4. The shininess of the pyramid material.

1. Add the fragment position

1.1. Modify the vertex shader

  • Open the main.cpp file.
  • Modify the fragment shader source code as follows:
[Read more…] about Android OpenGL ES – Part 10: Specular lighting

Filed Under: Android Development

Android OpenGL ES – Part 9: Diffuse lighting

March 24, 2020 by Anastasios Chondrogiannis Leave a Comment

1. Modify the directional light

1.1. Modify the fragment shader

  • Open the main.cpp file.
  • Modify the fragment shader source code as follows:
[Read more…] about Android OpenGL ES – Part 9: Diffuse lighting

Filed Under: Android Development

Android OpenGL ES – Part 8: Ambient Lighting

March 24, 2020 by Anastasios Chondrogiannis Leave a Comment

1. Add a directional light

1.1. Modify the fragment shader

  • Open the main.cpp file.
  • Modify the fragment shader source code as follows:
[Read more…] about Android OpenGL ES – Part 8: Ambient Lighting

Filed Under: Android Development

Android OpenGL ES – Part 7: Textures

March 13, 2020 by Anastasios Chondrogiannis Leave a Comment

1. Add the texture image file

  • Download this image.
  • Open the Project pane from the left side of the IDE.
  • Select the Project view.
  • Navigate to app->src->main.
  • Right click the main folder and select New->Directory.
  • Name it assets and click OK.
  • Drag and drop the image to the newly created assets directory and click OK.
  • Return to the Android view.
[Read more…] about Android OpenGL ES – Part 7: Textures

Filed Under: Android Development

Android OpenGL ES – Part 6: Camera View

March 12, 2020 by Anastasios Chondrogiannis Leave a Comment

1. Reset the pyramid position

  • Open the main.cpp file.
  • Modify the Java_dev_anastasioscho_glestriangle_NativeLibrary_nOnDrawFrame function as follows:
[Read more…] about Android OpenGL ES – Part 6: Camera View

Filed Under: Android Development

Android OpenGL ES – Part 5: Perspective Projection

March 10, 2020 by Anastasios Chondrogiannis Leave a Comment

1. Create the transformation matrix

  • Open the main.cpp file.
  • Declare the following global variable:
[Read more…] about Android OpenGL ES – Part 5: Perspective Projection

Filed Under: Android Development

  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Go to Next Page »

Primary Sidebar

Let’s connect!

  • Facebook
  • Instagram
  • LinkedIn
  • Twitter

Recent Posts

  • Android OpenGL ES – Part 10: Specular lighting
  • Android OpenGL ES – Part 9: Diffuse lighting
  • Android OpenGL ES – Part 8: Ambient Lighting
  • Android OpenGL ES – Part 7: Textures
  • Android OpenGL ES – Part 6: Camera View

Archives

  • March 2020
  • February 2020
  • November 2019
  • October 2019
  • July 2019

Categories

  • Android Development
  • Machine Learning

Copyright © 2023 · Genesis Sample on Genesis Framework · WordPress · Log in