Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7772925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:59:41+00:00 2026-06-01T16:59:41+00:00

In the vertex shader I define a structure: #version 110 struct LightSourceParameters { vec4

  • 0

In the vertex shader I define a structure:

#version 110                                                                 
struct LightSourceParameters {                                               
    vec4 ambient;                                                            
    vec4 diffuse;                                                            
    vec4 specular;                                                           
    vec4 position;                                                           
};                                                                           

and declare an instance for a single light

uniform LightSourceParameters light;                                         

but when I try to get a parameter of the light, it fails ( i < 0 )

name = "light.ambient"                                                       
GLint i = glGetUniformLocation(program, name );                              
// i == -1                                                                   

I know I cannot refer structures, but here I refer an exact field. What can be wrong?
~

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T16:59:42+00:00Added an answer on June 1, 2026 at 4:59 pm

    Are you using that structure in the shader? If not, then the compiler is well within its rights to optimize the uniform out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following vertex shader: attribute vec4 Position; attribute vec4 SourceColor; varying vec4
This is my vertex shader code: attribute vec4 position; attribute vec4 inputTextureCoordinate; varying vec2
I need a vec4 and a float to be passed from the vertex shader
I have the following vertex shader: uniform mat4 uMVP; attribute vec4 aPosition; attribute vec4
vertex shader: #version 150 in vec3 MCVertex; in float pointvar; uniform mat4 MVMatrix; uniform
In OpenGL 2.1, I'm passing a position and normal vector to my vertex shader.
Given the next vertex shader, what is the simplest, most efficient and fastest way
If we are going to generate fog using the vertex shader and the fragment
If I have a few Program3D objects (each with it's own Vertex-Shader and Fragment-Shader
I have a vertex shader (2.0) doing some instancing - each vertex specifies an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.