Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error C:\Python27>python.exe spheretransform.py #1

Open
catafest opened this issue Oct 3, 2016 · 0 comments
Open

error C:\Python27>python.exe spheretransform.py #1

catafest opened this issue Oct 3, 2016 · 0 comments

Comments

@catafest
Copy link

catafest commented Oct 3, 2016

C:\Python27>python.exe spheretransform.py
QOpenGLShader::compile(Vertex): ERROR: 0:24: 'gl_Vertex' : undeclared identifier
ERROR: 0:24: 'xy' :  field selection requires structure, vector, or matrix on left hand side
ERROR: 0:24: '=' :  cannot convert from 'float' to '2-component vector of float'
ERROR: 0:29: 'gl_Normal' : undeclared identifier
ERROR: 0:29: 'mix' : no matching overloaded function found
ERROR: 0:29: 'assign' :  cannot convert from 'const mediump float' to '3-component vector of float'
ERROR: 0:30: 'xyz' :  field selection requires structure, vector, or matrix on left hand side
ERROR: 0:30: 'mix' : no matching overloaded function found
ERROR: 0:30: 'assign' :  cannot convert from 'const mediump float' to '3-component vector of float'
ERROR: 0:32: 'gl_NormalMatrix' : undeclared identifier
ERROR: 0:33: 'gl_ModelViewMatrix' : undeclared identifier
ERROR: 0:42: 'gl_ModelViewProjectionMatrix' : undeclared identifier

*** Problematic Vertex shader source code ***

varying vec4 Color;

uniform vec3 LightPosition;
uniform vec3 SurfaceColor;

const float PI = 3.14159;
const float TWO_PI = PI * 2.0;

uniform float Radius;
uniform float Blend;

vec3 sphere(vec2 domain)
{
    vec3 range;
    range.x = Radius * cos(domain.y) * sin(domain.x);
    range.y = Radius * sin(domain.y) * sin(domain.x);
    range.z = Radius * cos(domain.x);
    return range;
}

void main()
{
    vec2 p0 = gl_Vertex.xy * TWO_PI;
    vec3 normal = sphere(p0);;
    vec3 r0 = Radius * normal;
    vec3 vertex = r0;

    normal = mix(gl_Normal, normal, Blend);
    vertex = mix(gl_Vertex.xyz, vertex, Blend);

    normal = normalize(gl_NormalMatrix * normal);
    vec3 position = vec3(gl_ModelViewMatrix * vec4(vertex, 1.0));

    vec3 lightVec = normalize(LightPosition - position);
    float diffuse = max(dot(lightVec, normal), 0.0);

    if (diffuse < 0.125)
         diffuse = 0.125;

    Color = vec4(SurfaceColor * diffuse, 1.0);
    gl_Position = gl_ModelViewProjectionMatrix * vec4(vertex,1.0);
}

***
QOpenGLShaderProgram::uniformLocation( LightPosition ): shader program is not linked
QOpenGLShaderProgram::uniformLocation( SurfaceColor ): shader program is not linked
QOpenGLShaderProgram::uniformLocation( Blend ): shader program is not linked
QOpenGLShaderProgram::uniformLocation( Radius ): shader program is not linked
QOpenGLShaderProgram::uniformLocation( Blend ): shader program is not linked
Traceback (most recent call last):
  File "spheretransform.py", line 78, in exposeEvent
    self.renderNow()
  File "spheretransform.py", line 63, in renderNow
    self.render(self.m_gl)
  File "spheretransform.py", line 183, in render
    gl.glBegin(gl.GL_QUADS)
AttributeError: 'QOpenGLFunctions_ES2' object has no attribute 'glBegin'
QOpenGLShaderProgram::uniformLocation( Blend ): shader program is not linked
Traceback (most recent call last):
  File "spheretransform.py", line 78, in exposeEvent
    self.renderNow()
  File "spheretransform.py", line 63, in renderNow
    self.render(self.m_gl)
  File "spheretransform.py", line 183, in render
    gl.glBegin(gl.GL_QUADS)
AttributeError: 'QOpenGLFunctions_ES2' object has no attribute 'glBegin'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant