1

How to use texelFetch with GL_TEXTURE_2D?

 2 years ago
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.
neoserver,ios ssh client

How to use texelFetch with GL_TEXTURE_2D?

advertisements

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?

Closely related to this question: How to use HttpClient with multithreaded operation?, I'm wondering if apache HttpAsyncClient is thread safe, or if it, too, requires the use of a MultiThreadedHttpConnectionManager, or a ThreadSafeClientConnManager.

How to use SQLite with libgdx

I was wondering if anyone knows a good tutorial that explains how to use SQLite with libgdx. All the ones I have found don't explain it well and I'm having trouble figuring out how to use it. So if you know of one that explains everything decently pl

How to use DeleteFile with the wildcard in c ++

How to use DeleteFile with wildcard? so c:\myFolder\a*.txt will delete a123.txt and a5555.txt but not b123.txt WIN32_FIND_DATAW fd; HANDLE hFind = FindFirstFileW(L"C:\\myFolder\\a*.txt", &fd); if (hFind != INVALID_HANDLE_VALUE) { do { Delete

JQuery how to use on () with an if statement

I have an if statement that is currently working fine: if ($('div').hasClass('is-sticky')) { $('body').addClass('has-sticky'); } However the class ".is-sticky" is dynamically added to the markup from a different jQuery plugin. So I figured out I

How to use Red5 with Asp.net

I want to record voice online and I guess I need to use FMS or Red5 and I don't know how to use Red5 with Asp.net, actually this is my first attempt to handle such a thing and currently I am a .net developer. So someone please show me a way to handle

How to use ssh2_scp_recv with large files (memory limit)

How to use ssh2_scp_recv with very large files without extending memory limit?! When I try to download very large files I end up hitting the memory limit!? update private function ssh_copy($host, $file_remote, $file_local){ $connection = ssh2_connect

How to use MarkerClusterer with my maps

I want to use MarkerClusterer on my map but I do not know very well JavaScript. How to use MarkerClusterer with my map? i need to add the cluster command but I do not know very well coding. my code is below var LocationData = [ [49.2814064, -123.1025

How to use OpenGL with gcc on Mac?

I'm trying to run this openGL example on my Mac from command line using gcc. The XCode is installed, gcc was used many time with other programs (w\o graphics). Following to this topic I run: g++ 1.cpp -framework OpenGL -lGLU -lglut and get: 1.cpp:12:

How to use singleton with Alamofire using swift 3?

I am new in iOS and I am bit confused that how to use singleton with Alamofire and how singleton is important. Actually I created a networkWrapper class in that I have written Alamofire post and get method, but i didn't use singleton. How can I creat

How to use $ in with _id

How can i use _id in $in. array('name' => array( '$in' => array('name1', 'name2') )) This is how $in is used in mongodb. But i dont know how to use $in with _id. I used array('_id' => array( '$in' => new MongoId(array(My Ids)) )) But it didn't

How to use JodaTime with Spring and Hibernate?

So I'm encountering a problem in my Spring app. The user can enter dates using a date picker tool and these are stored in a Mysql database using Hibernate. The table uses a Date field to store them so it's not saving times. The problem is that the se

How to use LuaDoc with LuaForWindows

The question is all in the title : how to use LuaDoc with LuaForWindows ? In my Lua installation, I have a luadoc_start.bat but the command windows closes as soon as it opens. From there I don't know what else can I do. Any help ? ThanksFor using lua

angular 1.5 (components): how to use directives with es6?

in folder directives i created two files: directives.js and color.js directives i've imported into app.js directives.js: import angular from 'angular'; import ColorDirective from './color'; const moduleName = 'app.directives'; angular.module(moduleNa

How to use logrotate with cluster?

How to use logrotate with cluster node.js module ? What kind of signal logrotate must send to cluster process for reopening log files ?This is not possible yet, it's one of the first issues of cluster: https://github.com/LearnBoost/cluster/issues/5

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK