How to use texelFetch with GL_TEXTURE_2D?
source link: https://www.codesd.com/item/how-to-use-texelfetch-with-gl-texture-2d.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
How to use texelFetch with GL_TEXTURE_2D?
I tried:
#version 130
uniform sampler2D texID;
in vec2 texcoord;
out vec4 outcolor;
void main(void) {
vec2 tcoord=texcoord.xy*768.0;
ivec2 tst=ivec2(tcoord.x,tcoord.y);
outcolor=texelFetch(texID,tcoord);
}
And got error on the line with the texelFetch
:
unable to find compatible overloaded function "texelFetch(sampler2D, vec2)".
I didn't putted those parameters from my head here few sources:
TheQuestion: Is there a way to use GL_TEXTURE_2D
with texelFetch
or just direct read pixels from texture when executing shader?
Check the 1.30 spec, page 89.
None of the five texelFetch()
overloads take two arguments:
gvec4 texelFetch (gsampler1D sampler, int P, int lod)
gvec4 texelFetch (gsampler2D sampler, ivec2 P, int lod)
gvec4 texelFetch (gsampler3D sampler, ivec3 P, int lod)
gvec4 texelFetch (gsampler1DArray sampler, ivec2 P, int lod)
gvec4 texelFetch (gsampler2DArray sampler, ivec3 P, int lod)
You need a third parameter.
Related Articles
How to use HttpAsyncClient with a multithreaded operation?
How to use SQLite with libgdx
How to use DeleteFile with the wildcard in c ++
JQuery how to use on () with an if statement
How to use Red5 with Asp.net
How to use ssh2_scp_recv with large files (memory limit)
How to use MarkerClusterer with my maps
How to use OpenGL with gcc on Mac?
How to use singleton with Alamofire using swift 3?
How to use $ in with _id
How to use JodaTime with Spring and Hibernate?
How to use LuaDoc with LuaForWindows
angular 1.5 (components): how to use directives with es6?
How to use logrotate with cluster?
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK