Skip to content

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

@catafest

Description

@catafest
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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions