Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. OpenGL ES GLSL: How to add Light in shaders without gl_Normal calls?
Forum Updated to NodeBB v4.3 + New Features

OpenGL ES GLSL: How to add Light in shaders without gl_Normal calls?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    omgodie
    wrote on last edited by
    #1

    I want to add a basic light to a textured object in a shader. Some basic method would be creating a lightvector but i can't use gl_Normal to calculate the light direction. Are there any workarounds? (I'm fairly new to OpenGL ES GLSL and i'm using the newest qt 5.1.1 with ANGLE for windows)

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      ZapB
      wrote on last edited by
      #2

      You need to write a vertex/fragment shader pair that implements the lighting model you wish to use. I'd suggest something simple like the Phong lighting model to begin with.

      You then need to pass in lighting parameters such as light position, light intensity, etc as uniform variables to the shaders.

      Nokia Certified Qt Specialist
      Interested in hearing about Qt related work

      1 Reply Last reply
      1
      • O Offline
        O Offline
        omgodie
        wrote on last edited by
        #3

        I already have a shaderpair. I'm trying now with passing the position with uniform variables.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved