Login
Username:

Password:

Remember me



Lost Password?

Register now!
Main Menu
Who's Online
18 user(s) are online (14 user(s) are browsing Forum)

Members: 0
Guests: 18

more...

Browsing this Thread:   1 Anonymous Users





GLSL shaders

Joined:
2011/9/25 1:23
From Hungary
Group:
Member
Posts: 1359
Offline
Is it possible to compile GLSL shaders with the current version of Mesa? I have two programs which use glShaderSourceARB and glCompileShaderARB, but none of them works. They fail with some generic error message (fragment/vertex shader failed to compile).

Posted on: 2013/1/6 5:05
_________________
My AROS&MorphOS ports
Arguments that explain everything... explain nothing.
Transfer the post to other applications Transfer


Re: GLSL shaders

Joined:
2013/1/15 16:24
From Hungary
Group:
Member
Posts: 2
Offline
I'm interested in same functions. Can I use GLSL shaders under AROS?

Posted on: 2013/1/18 4:52
Transfer the post to other applications Transfer


Re: GLSL shaders

Joined:
2008/1/7 12:41
From Poland
Group:
Member
Posts: 2369
Offline
Hi,

GLSL is working though I don't remember this version is available. There is Cube2 and DOOM3 ports that use it as well I written a simple code in tests/mesasimplerendering which also use shaders.

BSzili: try using functions without ARB suffix

Posted on: 2013/1/18 5:57
_________________
Krzysztof

"There is no such thing as software for free. If it is not the user who covers the cost of software creation with money, it is the developer who covers this cost with his own free time."

www.aros3d.org
www.twitter.com/ddeadwood
Transfer the post to other applications Transfer


Re: GLSL shaders

Joined:
2011/9/25 1:23
From Hungary
Group:
Member
Posts: 1359
Offline
AFAIR both Supermodel and Darkplaces use the non-ARB versions of these functions. but they can't compile shaders either.

edit: Doesn't Doom3 use ARB assembly shaders? Cube2 also supports assembly shaders beside GLSL.

Posted on: 2013/1/18 11:01
_________________
My AROS&MorphOS ports
Arguments that explain everything... explain nothing.
Transfer the post to other applications Transfer


Re: GLSL shaders

Joined:
2008/1/7 12:41
From Poland
Group:
Member
Posts: 2369
Offline
@BSzili

I seem to remember that there are some gl error reporting functions that allow you to read the output of compiler and linker so that you can get more information on what is failing.

Edit, here is my simple code:

fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL);
glCompileShader(fragmentShader);
glGetShaderInfoLog(fragmentShader, BUFFER_LEN, &len, buffer);
printf("Fragment shader compile output: %s\n", buffer);

vertexShader = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);
glCompileShader(vertexShader);
glGetShaderInfoLog(vertexShader, BUFFER_LEN, &len, buffer);
printf("Vertex shader compile output: %s\n", buffer);

shaderProgram = glCreateProgram();
glAttachShader(shaderProgram, vertexShader);
glAttachShader(shaderProgram, fragmentShader);
glLinkProgram(shaderProgram);
glGetProgramInfoLog(shaderProgram, BUFFER_LEN, &len, buffer);
printf("Shader program compile output: %s\n", buffer);

Posted on: 2013/1/18 11:42
_________________
Krzysztof

"There is no such thing as software for free. If it is not the user who covers the cost of software creation with money, it is the developer who covers this cost with his own free time."

www.aros3d.org
www.twitter.com/ddeadwood
Transfer the post to other applications Transfer


Re: GLSL shaders

Joined:
2011/9/25 1:23
From Hungary
Group:
Member
Posts: 1359
Offline
It turns out that supermodel already had the glGetShaderInfoLog() function.

// Attempt to compile fragment shader
    
glShaderSource(fragmentShader1, (const GLchar **) &fsSourceNULL);
    
glCompileShader(fragmentShader);
    
glGetShaderiv(fragmentShaderGL_COMPILE_STATUS, &result);
    if (!
result)    // failed to compile
    
{
        
glGetShaderInfoLog(fragmentShader2048, &leninfoLog);
        
ErrorLog("Fragment shader failed to compile. Your OpenGL driver said:n%s"infoLog);
        
ret FAIL;    // error
    
}


This is the output I'm getting:
Quote:
0:28:(11) error: syntax error, unexpected IDENTIFIER, expecting INT constant.


The output is same for the fragment and the vertex shader.

edit: And the line which causes the error:
Quote:
#version 120


edit #2: Well, what do you know, getting rid of that line from the shader helped the problem. So our Mesa implementation doesn't know about the #version directive?

Attach file:



jpg  supermodel1.jpg (319.49 KB)
2982_5110d744055e4.jpg 1040X848 px

jpg  supermodel2.jpg (308.75 KB)
2982_5110d8de68d1c.jpg 1040X848 px

Posted on: 2013/2/5 1:22

Edited by BSzili on 2013/2/5 1:56:23
Edited by BSzili on 2013/2/5 2:03:14
_________________
My AROS&MorphOS ports
Arguments that explain everything... explain nothing.
Transfer the post to other applications Transfer






You can view topic.
You cannot start a new topic.
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.

[Advanced Search]


Search
Top Posters
1 paolone
paolone
3758
2 nikolaos
nikolaos
3470
3 magorium
magorium
3119
4 phoenixkonsole
phoenixkonsole
3068
5 deadwood
deadwood
2369
6 ncafferkey
ncafferkey
2134
7 mazze
mazze
2068
8 clusteruk
clusteruk
2051
9 damocles
damocles
1770
10 Kalamatee
Kalamatee
1767
© 2004-2014 AROS Exec