Manipulating a specific pixel

Started by
10 comments, last by Kalasjniekof 17 years, 1 month ago
hmm neural nets you say, ok, to change a single pixel, if you only need to owerwrite the pixel without knowing whats under it you can use one of two pretty fast methods

1. use glTexSubImage2D(GL_TEXTURE_2D, textureid,0,x,y,1,1,GL_RGB,GL_UNSIGNED_BYTE,pixeldata); to change a single pixel(or many if you want).
2. if bound as a FBO you can just draw a pixel with glVertex3f while it is bound as a render buffer if you have the correct glOrtho mode set up.

If you need readback then it becomes a bit more difficult and definitely slower.
First you could just read the entire texture using glGetTexImage, but if you use that you might just as well store the whole thing on the cpu.
the other method requires you to use a combination of FBO and glReadPixels.

But the by far fastest and most flexible is the use of GPGPU shader programs to do all the processing, i am pretty sure that some of that pattern recognition stuff can be done on the gpu at blazing speeds, you could make a program that reads from one texture, compares it with another and then outputs the result to a third one
Advertisement
Quote:Original post by baykalsa
Well, I don't why it is sooooo important for you, but I will make a pattern recognition program(neural nets). I need to know how to change a pixel.

It's sooooo important for me because having a context for your problem can help us a lot in finding a solution for you, or for providing alternate approaches as I will do.

I take it that you will use this pixel changing to draw connections between the nodes? This is a wild guess as you still did not provide a lot of information.

Anyway, if the above scenario is correct a better option would be to use glLines to draw them (obviously).

Another guess would be that you want to use the technique to render some sort of 'action-potential' effect. In that case your initial approach (ps) should be the best option.

As you can see from the above, more information is absolutely a good thing if you want us to help you. Reread your first post. It doesn't give us much of a context, does it?

This topic is closed to new replies.

Advertisement