Author Topic: OpenGL - Fullscreen Pixelmanipulation  (Read 3203 times)

0 Members and 1 Guest are viewing this topic.

Offline va!n

  • Pentium
  • *****
  • Posts: 1431
  • Karma: 109
    • View Profile
    • http://www.secretly.de
OpenGL - Fullscreen Pixelmanipulation
« on: April 24, 2007 »
hi guys... atm i would like to try my first little 1k intro fx... I have started a new project with VC++ but still have a lot problems but possible i will meet soon a good friend from the BP2007 party ;)

Back to the topic... for example when want to code a fullscreen effect (lets say 640x480) and manipulate all pixels each frame, like plasma effect... whats the best way (fast and smallest exe) for doing such a thing for an 1k intro?

I thought about something like...

Code: [Select]
   glBegin(GL_POINTS)
   
   For(int x=0; x<639; ++x)
   {
       For(int y=0; y<339; ++y)     
       {
          glColor3i(lRed, lGreen, lBlue)
          glVertex2f(x,y)
       }
   }
   
   glEnd()

Is this a good way or is there any better and even faster way for pixel manipulation in realtime? (cant test / compile the full source atm  ::) )  A friend told me to use a Texture and doing directly on the texture the pixel manipulations... i thought about this too but i am not on the point that i think i could get managed it ;-/

- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: OpenGL - Fullscreen Pixelmanipulation
« Reply #1 on: April 24, 2007 »
Va!n,

I think your friend is right. You see each of your vertices must be transformed and projected to the screen and its a lot fo work. Its going to be slower, even if the drivers are real smart, than drawing in software to a texture and diplaying the texture on a single quad is my guess.

Chris
Challenge Trophies Won:

Offline va!n

  • Pentium
  • *****
  • Posts: 1431
  • Karma: 109
    • View Profile
    • http://www.secretly.de
Re: OpenGL - Fullscreen Pixelmanipulation
« Reply #2 on: April 24, 2007 »
thanks taj! i think i will try to check how to get it work using a texture. btw you are right about vertices and problems... i solved it using a dirty but simple trick.... glPointSize()  ^^ However, i will try to learn the glGenTexture Stuff

Does someone know a d/l link where this technique is used, to learn from? ^^ thx
« Last Edit: April 24, 2007 by va!n »
- hp EliteBook 8540p, 4 GB RAM, Windows 8.1 x64
- Asus P5Q, Intel Q8200, 6 GB DDR2, Radeon 4870, Windows 8.1 x64
http://www.secretly.de
Challenge Trophies Won:

Offline taj

  • Bytes hurt
  • DBF Aficionado
  • ******
  • Posts: 4810
  • Karma: 189
  • Scene there, done that.
    • View Profile
Re: OpenGL - Fullscreen Pixelmanipulation
« Reply #3 on: April 24, 2007 »
Va!n,

Try looking in mycode/release/1k/sf  on the code I sent you , theres something there where I write to textures, then create the texture and wrap it round a sphere.

Chris
Challenge Trophies Won:

Offline Optimus

  • DBF Aficionado
  • ******
  • Posts: 2456
  • Karma: 128
    • View Profile
    • Optimouse Demo Site
Re: OpenGL - Fullscreen Pixelmanipulation
« Reply #4 on: April 28, 2007 »
How I did it in the past was to define a 2d grid of quads, e.g. 64*64 or 128*128 quads fitting exactly the screen (too much will still be slow and you can't reach the per pixel manipulation at good speed easilly (maybe with a texture?)) with smooth colors in between them (gouraud shading (glEnable(GL_SMOOTH),. I don't remember the command but someth8ing like that) and just glColor3f my plasma values to the edges of the polygons and for a plasma because the colors are too close each other even with a small grid it will smooth the colors without seeing artifacts (I think I have seen this in a Plasma screensaver where you could choose the grid size). But I'll have to check the texture solution too and see which is faster to transfer in the gfx card.
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2748
  • Karma: 492
    • View Profile
    • http://www.rbraz.com/
Re: OpenGL - Fullscreen Pixelmanipulation
« Reply #5 on: April 30, 2007 »
Hey Va!n, I guess that this is what you are looking for...

http://dbfinteractive.com/index.php?topic=1847.0

 :cheers:
Challenge Trophies Won: