Jump to content

OpenGL ( why wont my shader compile? )

Hello ive spent a long amount of time trying to figure out why my shader wont compile. It should draw the triangle, but not how it is now.

 

Im just starting in openGL. This has me completely stumped. Thanks for the time of whoever understands this stuff, i know its probably less common.

 

Console and window

received_528411524316710.png.729e1ca15c554824254824c4ddde98c0.png

 

Shader in GLSL

received_673553436379992.png.8e1e55de930859589956b1ac99a74ad0.png

 

AddShader()

received_2239766506312140.png.b65a7a3221bbb6ceb956ac471a7fd4dd.png

 

CompileShaders()

received_386021362148218.png.c7a504b3c8b002c01eea8960c24704b7.png

 

The whole program is still under 200 lines, i can post it if needed.

Link to comment
Share on other sites

Link to post
Share on other sites

Wow i feel like an absolute idiot. The vertex shader i wrote inline in GLSL had "gl_Position" spelled as "gl_Postion"... 

and.. (location 0) instead of (location = 0).. sigh

 

Can a mod delete this. this is embarrassing lol....

Link to comment
Share on other sites

Link to post
Share on other sites

Get a nice glsl plugin for your IDE and move your shaders to separate files. The added code highlighting and inspection is invaluable for bigger shaders and mistakes like these can be found much faster.

My boring Github   /人◕ ‿‿ ◕人\

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, Timotheus2 said:

Get a nice glsl plugin for your IDE and move your shaders to separate files. The added code highlighting and inspection is invaluable for bigger shaders and mistakes like these can be found much faster.

Thanks! i figured id setup something like that down the line. But im taking an online course, and the guy wanted me to write them in line for simplicity learning until i learn the basics. Which i think i agree with at the moment, because openGL feels like a whole new complicated world.

 

Got any recommendations? I like to stick with visual studio on more complicated stuff.

 

58 minutes ago, James Evens said:

A tipp for later: If you have multiple system with different gpu (generation or manufacturer) and you don't find any mistake in your code try it on them. it could be a driver problem.

Another tipp for posting code online: use the code tag and not pictures.

Yeah im using 3.3, and apparently what im learning is forward compatible. sadly until i can actually get a software engineering job, ill have to stick with my 9 year old single gpu computer. I thought the picture might be easier to read, but ill keep it in mind. thanks!

 

i got the 3gb 7970 vapor-x sapphire card im pretty sure, think its newer than the rest.

 

Link to comment
Share on other sites

Link to post
Share on other sites

I don't use visual studio myself, so just try a few of the more popular glsl plugins.

My boring Github   /人◕ ‿‿ ◕人\

Link to comment
Share on other sites

Link to post
Share on other sites

4 hours ago, Timotheus2 said:

I don't use visual studio myself, so just try a few of the more popular glsl plugins.

Thanks, will do. 

 

Also... side note, i realized why it was spelled wrong. i got a new keyboard, and its wireless.... but its the best thing for my pc layout right now. so sometimes key strokes dont quite make it to the computer.

Link to comment
Share on other sites

Link to post
Share on other sites

  • 4 weeks later...

For future, try to post the actual code (i.e. text) instead of screenshots of code - will make it easier for people to copy/paste snippets if they want to help you out.

Link to comment
Share on other sites

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

×