Results 1 to 3 of 3

Thread: weird problem with gl_Position variable

  1. #1
    Junior Member Newbie
    Join Date
    May 2012
    Posts
    23

    weird problem with gl_Position variable

    Hello everybody.
    Trying to compile the following simple vertex shader:

    #version 150

    in vec4 vPosition;
    //in vec4 vColor;
    uniform vec4 vColor;

    uniform mat4 model_view;
    uniform mat4 projection;

    out vec4 color;

    void main()
    {
    gl_Position = projection*model_view*vPosition;
    color = vColor;
    }

    I've got the next error:

    vshader.glsl failed to compile:
    ERROR: 0:13: 'gl_Position' : undeclared identifier
    ERROR: 0:13: 'assign' : cannot convert from 'varying 4-component vector of floa
    t' to 'float'

    The funny thing is that the very same code works in anothet simple testing application I have...

    Anybody knows what might be the problem?

    Thanks you very much.

    Heinrich

  2. #2
    Senior Member Frequent Contributor arekkusu's Avatar
    Join Date
    Nov 2003
    Posts
    890

    Re: weird problem with gl_Position variable

    That might happen if you mistakenly try to compile vertex shader text as GL_FRAGMENT_SHADER.

  3. #3
    Junior Member Newbie
    Join Date
    May 2012
    Posts
    23

    Re: weird problem with gl_Position variable

    Well, I don't know why it happened for me, but when I moved the code out from some inner lass to an initalizing function it actually disappeared...
    I dont't know why but... let it be.
    If anyone still has some explanation for me, I will thank hime very much...

Similar Threads

  1. weird result of local variable
    By holyodin in forum OpenCL
    Replies: 2
    Last Post: 03-07-2017, 06:10 AM
  2. Dividing gl_Position by gl_Position.w
    By Hermannicus in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 05-03-2016, 11:05 AM
  3. Problem casting variable.
    By XaBerr in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 10-06-2013, 10:53 AM
  4. Problem with gl_position in shaders
    By Worker in forum OpenGL ES
    Replies: 1
    Last Post: 04-03-2013, 02:37 PM
  5. problem with out variable
    By powerpad in forum OpenGL: GLSL
    Replies: 2
    Last Post: 07-30-2005, 12:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean