Richard T
Richard T

Reputation: 37

Is it possible to create a texture only in Fragment shader?

I have a 2 pass rendering pipeline - Deferred shading - for point cloud rendering. (GLSL 4.30 & c++17)

Shader pipeline:

Pointloud.vertex --> Pointcloud.fragment --> FullscreenQuad.vertex --> Deferred.fragment

What I want to achieve is to gather some data from Pointloud.vertex --> Pointcloud.fragment state and as a texture send it into Deferred.fragment shader.

Datas like: Vertex_ID, Frag-Coord.z and texture coordinates (availible in Pointloud.vertex part )

Basically I want to create 2 texture in Pointcloud.fragment shader,on the given texture coord position store the dept information and in the another texture store the vertex ID on the same coords.

Is it possible to create and write into textures locally in shaders? Important is to solve this without c++ impact.

Upvotes: 0

Views: 651

Answers (1)

Nicol Bolas
Nicol Bolas

Reputation: 474426

Shaders cannot allocate resources like textures and buffers. They can use resources, but they cannot create them ex nihilo. You have to create any such resources in the application. If you don't have the ability to modify the application's code, then there's nothing to be done.

Upvotes: 2

Related Questions