Skip to main content
deleted 1 character in body
Source Link
Makogan
  • 1.8k
  • 14
  • 31

The way I learnt to send a texture to a shader is more or less

//Use program
//Bind texture to the texture unit to its appropriate target
glActiveTexture(GL_TEXTURE0 + texture_unit);
glBindTexture(target, textureID);
//Get the uniform location in the program and attach the texture unit
GLuint location = /*get the location somewhow*/;
glUniform1i(location,texture_unit);

However when dealing with buffers and SSBOS rather than trying to find a location throughthrough a string anmename, the object is declared as:

layout(std430, binding = 2) buffer texture_meta_data

For example. This means that the SSBO is to ebbe bound at binding point 2

And then on tehthe C++ side one does something like

glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, SSBOID);

To bind the object to tha bidningthe binding point.

How can you do the same with textures?

The way I learnt to send a texture to a shader is more or less

//Use program
//Bind texture to the texture unit to its appropriate target
glActiveTexture(GL_TEXTURE0 + texture_unit);
glBindTexture(target, textureID);
//Get the uniform location in the program and attach the texture unit
GLuint location = /*get the location somewhow*/;
glUniform1i(location,texture_unit);

However when dealing with buffers and SSBOS rather than trying to find a location through a string anme, the object is declared as:

layout(std430, binding = 2) buffer texture_meta_data

For example. This means that the SSBO is to eb bound at binding point 2

And then on teh C++ side one does something like

glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, SSBOID);

To bind the object to tha bidning point.

How can you do the same with textures?

The way I learnt to send a texture to a shader is more or less

//Use program
//Bind texture to the texture unit to its appropriate target
glActiveTexture(GL_TEXTURE0 + texture_unit);
glBindTexture(target, textureID);
//Get the uniform location in the program and attach the texture unit
GLuint location = /*get the location somewhow*/;
glUniform1i(location,texture_unit);

However when dealing with buffers and SSBOS rather than trying to find a location through a string name, the object is declared as:

layout(std430, binding = 2) buffer texture_meta_data

For example. This means that the SSBO is to be bound at binding point 2

And then on the C++ side one does something like

glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, SSBOID);

To bind the object to the binding point.

How can you do the same with textures?

Rollback to Revision 1
Source Link
Makogan
  • 1.8k
  • 14
  • 31

The way I learnedlearnt to send a texture to a shader is more or less

//Use program
//Bind texture to the texture unit to its appropriate target
glActiveTexture(GL_TEXTURE0 + texture_unit);
glBindTexture(target, textureID);
//Get the uniform location in the program and attach the texture unit
GLuint location = /*get the location somewhow*/;
glUniform1i(location,texture_unit);

However when dealing with buffers and SSBOS rather than trying to find a location through through a string nameanme, the object is declared as:

layout(std430, binding = 2) buffer texture_meta_data

For example. This means that the SSBO is to beeb bound at binding point 2

And then on theteh C++ side one does something like

glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, SSBOID);

To bind the object to the bindingtha bidning point.

How can you do the same with textures?

The way I learned to send a texture to a shader is more or less

//Use program
//Bind texture to the texture unit to its appropriate target
glActiveTexture(GL_TEXTURE0 + texture_unit);
glBindTexture(target, textureID);
//Get the uniform location in the program and attach the texture unit
GLuint location = /*get the location somewhow*/;
glUniform1i(location,texture_unit);

However when dealing with buffers and SSBOS rather than trying to find a location through a string name, the object is declared as:

layout(std430, binding = 2) buffer texture_meta_data

For example. This means that the SSBO is to be bound at binding point 2

And then on the C++ side one does something like

glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, SSBOID);

To bind the object to the binding point.

How can you do the same with textures?

The way I learnt to send a texture to a shader is more or less

//Use program
//Bind texture to the texture unit to its appropriate target
glActiveTexture(GL_TEXTURE0 + texture_unit);
glBindTexture(target, textureID);
//Get the uniform location in the program and attach the texture unit
GLuint location = /*get the location somewhow*/;
glUniform1i(location,texture_unit);

However when dealing with buffers and SSBOS rather than trying to find a location through a string anme, the object is declared as:

layout(std430, binding = 2) buffer texture_meta_data

For example. This means that the SSBO is to eb bound at binding point 2

And then on teh C++ side one does something like

glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, SSBOID);

To bind the object to tha bidning point.

How can you do the same with textures?

edited body
Source Link
Nicol Bolas
  • 10k
  • 18
  • 26

The way I learntlearned to send a texture to a shader is more or less

//Use program
//Bind texture to the texture unit to its appropriate target
glActiveTexture(GL_TEXTURE0 + texture_unit);
glBindTexture(target, textureID);
//Get the uniform location in the program and attach the texture unit
GLuint location = /*get the location somewhow*/;
glUniform1i(location,texture_unit);

However when dealing with buffers and SSBOS rather than trying to find a location throughthrough a string anmename, the object is declared as:

layout(std430, binding = 2) buffer texture_meta_data

For example. This means that the SSBO is to ebbe bound at binding point 2

And then on tehthe C++ side one does something like

glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, SSBOID);

To bind the object to tha bidningthe binding point.

How can you do the same with textures?

The way I learnt to send a texture to a shader is more or less

//Use program
//Bind texture to the texture unit to its appropriate target
glActiveTexture(GL_TEXTURE0 + texture_unit);
glBindTexture(target, textureID);
//Get the uniform location in the program and attach the texture unit
GLuint location = /*get the location somewhow*/;
glUniform1i(location,texture_unit);

However when dealing with buffers and SSBOS rather than trying to find a location through a string anme, the object is declared as:

layout(std430, binding = 2) buffer texture_meta_data

For example. This means that the SSBO is to eb bound at binding point 2

And then on teh C++ side one does something like

glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, SSBOID);

To bind the object to tha bidning point.

How can you do the same with textures?

The way I learned to send a texture to a shader is more or less

//Use program
//Bind texture to the texture unit to its appropriate target
glActiveTexture(GL_TEXTURE0 + texture_unit);
glBindTexture(target, textureID);
//Get the uniform location in the program and attach the texture unit
GLuint location = /*get the location somewhow*/;
glUniform1i(location,texture_unit);

However when dealing with buffers and SSBOS rather than trying to find a location through a string name, the object is declared as:

layout(std430, binding = 2) buffer texture_meta_data

For example. This means that the SSBO is to be bound at binding point 2

And then on the C++ side one does something like

glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 2, SSBOID);

To bind the object to the binding point.

How can you do the same with textures?

Source Link
Makogan
  • 1.8k
  • 14
  • 31
Loading