How to apply a shader to a specific object

I have several objects on my stage. I want to apply my shader to only one of them. Environment: OpenGL 2.0, C ++, GLUT, GLEW.

+3
source share
2 answers

The shader program is valid only as long as it is installed. Only the drawing calls that you make during the installation of the program will use the shader. You have to install the shader, draw your object, and then remove the shader.

Change . By "setting" a shader, I mean using it glUseProgramwith your shader descriptor. By "uninstall" I mean either installing another shader or calling glUseProgramwith an argument 0. See glUseProgram . My terminology "install / uninstall" comes from there.

+6
source

drawcall .. , : P , , , ... , , , . , .

+2

Source: https://habr.com/ru/post/1742865/


All Articles