Sign in to follow this  
TTT_Dutch

Segmentation Fault

Recommended Posts

Well I have been trying to find what has been causing this segmentation fault all night and I finally decided that I needed help.

Here is my main: [url="http://pastebin.com/Vg7qMc4S"]http://pastebin.com/Vg7qMc4S[/url]
Shader.h: [url="http://pastebin.com/0TMquZTr"]http://pastebin.com/0TMquZTr[/url]
Shader.cpp: [url="http://pastebin.com/T4i7ReTg"]http://pastebin.com/T4i7ReTg[/url]
And Valgrind verbose output: [url="http://pastebin.com/mmYYNSif"]http://pastebin.com/mmYYNSif[/url]

Thanks ahead,
Brent

Share this post


Link to post
Share on other sites
[quote name='fastcall22' timestamp='1307254916' post='4819649']
Random shot in the dark: Try moving line 16 in main.cpp after line 20. I don't think it's a good idea to be compiling and linking shaders without first properly initializing an OpenGL context and extensions.
[/quote]

Nah that didn't work but thanks anyway.

Share this post


Link to post
Share on other sites
You need line 16 [i]AND[/i] 18 after line 20, and you also need line 16 after line 18. Not only can you not compile and link your shader without a context, but you cannot even load the function pointers before the context, nor can you compile and link your shader until you have loaded the functions.

The three steps are exactly backwards: you're calling GL-functions before they are loaded, and then you're loading them, but before the context is set up. These threes steps must be performed the other way around.

Share this post


Link to post
Share on other sites
[quote name='Brother Bob' timestamp='1307265624' post='4819681']
You need line 16 [i]AND[/i] 18 after line 20, and you also need line 16 after line 18. Not only can you not compile and link your shader without a context, but you cannot even load the function pointers before the context, nor can you compile and link your shader until you have loaded the functions.

The three steps are exactly backwards: you're calling GL-functions before they are loaded, and then you're loading them, but before the context is set up. These threes steps must be performed the other way around.
[/quote]

Ok thanks that worked but now I am trying to bind the shader and I get a seg fault again.

Share this post


Link to post
Share on other sites
If you have changed the code and gotten different results, you need to post the new code. The GameDev Crystal Ball is broken, so we can't see what you did without you showing us [img]http://public.gamedev.net/public/style_emoticons/default/wink.gif[/img]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this