Advanced C++/Graphics Tutorial 10: Uniform Variables!

preview_player
Показать описание

Today we make cool colors using a uniform variable! Post pictures/gifs/videos of your trippy shader creations :D

Рекомендации по теме
Комментарии
Автор

and over 7 years later, this is still the best tutorial i could find on youtube

leonardoasaro
Автор

Ive been watching this entire tutorial at 1.5 speed, and pausing whenever I do stuff. I really like the tutorial, its clean and helpful! :)

llaapk
Автор

I can see fade to black in games or fade into the game or space travel, only if I had this in high school math would be even more fun thank you Ben

Sagitta
Автор

Back in the time where we created the error code (Error.cpp) we used a string called tmp to handle the press "any key to quit" pause, i suggest to use instead the _getch(); from "conio.h" library, wich is really usefull for that.

The difference? with our string we need to write something and the press Enter to actually quit in the console, with _getch(); instead we just press a key.

attichicco
Автор

Guys if you got issues, open the Source code! Capitalized for a reason, that thing is god given (or rather Ben given). I just fixed in 2-3 minutes what i had tried to do alone for hours. Stupidly recreated the object basically nulling all i did with it hence nothing rendered...

jovanrakocevic
Автор

These shaders are amazing! I wrote one that renders julia fractals :) Pastebin /J3qeB7NA 

doyc
Автор

dude please keep on. really appreciate the work you do. as a guy who barely knows about programming this stuff is very useful to me.
PS: i think i need to say i am german, so grammar could not be as you are used to :D

Drauchris
Автор

I think I may have found the most psychedelic shader.
fragmentColour = vec4(tan(fragmentPosition.y/fragmentPosition.x*time), tan(fragmentPosition.y/fragmentPosition.x*time), tan(fragmentPosition.y/fragmentPosition.x*time), fragmentColour.a + time);
Alternatively, a similar shader with trippy colours as well:
fragmentColour = vec4(cos(fragmentPosition.y/fragmentPosition.y*time), tan(fragmentPosition.x/fragmentPosition.y *time), sin(fragmentPosition.y/fragmentPosition.x*time), fragmentColour.a + time);

insert_name_here
Автор

Just a note, in case some didn't realize it, you can play around with your shader code without recompiling your program, that is, if you're not changing any variable names, just messing with the calculations for effects.

NeilRoy
Автор

Can't wait for the next tutorial! This is starting to get good :)

pancakesimone
Автор

instead of constantly putting GLSLProgram:: in front of your voids, you can just put "using namespace GLSLProgram" at the top of the GLSLProgram.cpp

azzy
Автор

This tutorial blew my mind! It makes me very excited, and I am glad that my trig class finally came in handy. One question, though. When I incremented "_time" by 0.01 like you did in the video, mine seemed to be going a lot faster. Can you think of why this would be?

patrickayres
Автор

Will you be going over how to load models and their textures made in things like Blender at some point in the future?

If not I'll still be following these tutorials through, but would it be possible for you to say at what point we should find a different tutorial to follow briefly to get that done before returning to your series again?

If you are then of course not a problem and I shall look forward to these tutorials even more XD

Oh, and thank you for explaining shaders, your last few videos have explained and taught me exactly what shaders are and how they work in a way that has worked perfectly for my way of learning :)

benjamindrury
Автор

Coolbeans!

I get a slightly different result, with only vertical and horizontal bars, but trippy nonetheless.

larsk
Автор

At the 13:51 point in the video when you tell the shader to make the colors change out with time, my program runs and has a magenta square with a white corner bleeding into the square, but doesn't change the colors as yours does. This a common problem? I'm looking into it now but I just want to know if this is something you know of off the top of your head.

Zephemus
Автор

"Hopefully you understand cosign if not your probably young"

I am 29 and only just learnt this at university lol. I failed school back in 2002, however I have been in Software engineering courses for 4 years now and have 3 more to go.

kanebrennan
Автор

I had to add `SDL_GL_SetSwapInterval(1);` before initShaders() to enable vsync: otherwise  GPU became too loud especially once I added mod(time, 50) to clamp time.

My shader is not too fancy, it's basically two waves coming at each other: 

etopowertwon
Автор

You can also use SDL_GetTicks( ) to get current time in milliseconds.
I am using glfwGetTime() and its the same thing (I am GLFW not SDL)
great tutorials! you are very clear. Thanks on the extra tips, really helpful

daserstereichen
Автор

I have no clue what I've done, just messed around with vars since I lack color algebra skills:

Yay, a nosense mess that looks like... something?

paulocbbf
Автор

I'm writing an engine on ubuntu, and my hardware supports 3.3, glsl 330, but now that i want to draw something, glGetUniformLocation() returns -1 (i guess the invalid index). I loaded the shader, no errors, everything checked, and yet it doesnt work. I cannot use glBindAttribLocation(), because the loader is generic, but i set layout(location= ...) in the shader. [ubuntu 12.04, ati 3200gpu] Any advice?

bialkoistvan