Re: [Derelict-GL3] GLSL: Syntax error unexpected tokens following #version

2016-12-04 Thread Payotz via Digitalmars-d-learn

On Sunday, 4 December 2016 at 08:32:23 UTC, Mike Parker wrote:

On Sunday, 4 December 2016 at 08:30:40 UTC, Mike Parker wrote:


your shader, print out the result of glGetString(GL_VERSION) to


Alternatively, since you're using Derelict, you can check the 
return value of DerelictGL3.reload() or, any time after calling 
it, DerelictGL3.loadedVersion.


Actually, the fix was something anticlimactic. It had something 
to do with glShaderSource() and how I passed the arguments, it 
had nothing to do with the source code itself.

Thanks for the advice though. I'll be taking note of this.


[Derelict-GL3] GLSL: Syntax error unexpected tokens following #version

2016-12-03 Thread Payotz via Digitalmars-d-learn
So I've been trying to teach myself how to OpenGL, and there are 
errors whenever I try to compile my shaders.


Errors are : http://i.imgur.com/5hRaQL8.png

My shader code is as follows:
///
#version 130

attribute vec3 position;

void main()
{
gl_Position = vec4(position,1.0);
}
///

My shader loader code is :

//
string loadShader(string fileName){
File file = File(fileName,"r");
string line;
line = string.init;
while(!file.eof()){
line ~= file.readln();
}
writeln(line);
return line;
}//

Through my constant "googling" on the internet, I've seen many 
countless answers to the loader code not appending '\n' to each 
newline when it reads the new code.

It was not the case: http://i.imgur.com/6mWSs4S.png ;

So with that, I don't have any leads. Any ideas?

My graphics card is an Intel HD 5000, and GPU is AMD Radeon HD 
7670M which supports OpenGL 3.0.


Re: Two part question. Making a dynamic array of delegates, and taking in a delegate with unknown parameters as an argument .

2016-12-01 Thread Payotz via Digitalmars-d-learn
Thank you all for the replies. I'm extremely grateful. I'll look 
into each and every answer.


Two part question. Making a dynamic array of delegates, and taking in a delegate with unknown parameters as an argument .

2016-12-01 Thread Payotz via Digitalmars-d-learn
So, to give context, I am trying to make an event manager for a 
game I'm making.

I was writing the "register()" method so I ran into a problem.

The register method will take in delegates as an argument, but 
those delegates have varied arguments themselves, so I can't 
really put anything there. I know that it's got something to do 
with templates so I tried my hand in it and came up with this:


void registerEvent(string event_name,T...)(T delegate() dg);

I know there's something missing in the way I did it, so I'll be 
glad for you folks to tell me what I'm missing.


And for the second part of the question, I can't seem to make a 
Dynamic Array where I could store the delegates taken in the 
"registerEvent" method. Closest thing I have gotten to is this:


private void delegate(T)(T args)[string] event;

which resulted in the compiler screaming Error signs at me.
So how does one do it?