FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

glShaderSource

 
Post new topic   Reply to topic     Forum Index -> Derelict
View previous topic :: View next topic  
Author Message
dav1d



Joined: 12 Sep 2011
Posts: 40

PostPosted: Sat Jun 23, 2012 4:44 am    Post subject: glShaderSource Reply with quote

This commit https://github.com/aldacron/Derelict3/commit/bbf2cc32afa13f18f7af439baaf235bce25d3c3f broke this code:

Code:
            auto ssp = shader_source.ptr; # shader_source = string
            int ssl = cast(int)(shader_source.length);
            glShaderSource(shader, 1, &ssp, &ssl);


The Error:
Code:
 Error: function pointer glShaderSource (uint, int, const(char)**, const(int)*) is not callable using argument types (uint,int,immutable(char)**,int*)


Why did you change that and what is the proper way of passing the shader source?
Back to top
View user's profile Send private message
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Sat Jun 23, 2012 5:05 am    Post subject: Re: glShaderSource Reply with quote

dav1d wrote:
This commit https://github.com/aldacron/Derelict3/commit/bbf2cc32afa13f18f7af439baaf235bce25d3c3f broke this code:

Code:
            auto ssp = shader_source.ptr; # shader_source = string
            int ssl = cast(int)(shader_source.length);
            glShaderSource(shader, 1, &ssp, &ssl);


The Error:
Code:
 Error: function pointer glShaderSource (uint, int, const(char)**, const(int)*) is not callable using argument types (uint,int,immutable(char)**,int*)


Why did you change that and what is the proper way of passing the shader source?


I changed it because I was getting a similar error doing it a different way. Anyway, this works for me:

Code:


const(char)* src = source.toStringz();
glShaderSource(shader, 1, &src, null);



You don't have to go the toStringz route. Just drop the auto and declare your source pointer as const(char)* explicitly, and that should do it.
_________________
The One With D | The One With Aldacron | D Bits
Back to top
View user's profile Send private message Send e-mail
dav1d



Joined: 12 Sep 2011
Posts: 40

PostPosted: Sun Jun 24, 2012 4:28 am    Post subject: Reply with quote

The error is not a Bug it's "by design": http://d.puremagic.com/issues/show_bug.cgi?id=8288

Btw. the change was reverted: https://github.com/aldacron/Derelict3/commit/bf7f9af26bea3ce7e8e32da5cf25b9d2e44b6297
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Derelict All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group