Dark Bit Factory & Gravity
PROGRAMMING => C / C++ /C# => Topic started by: va!n 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...
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 ;-/
-
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
-
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
-
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
-
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.
-
Hey Va!n, I guess that this is what you are looking for...
http://dbfinteractive.com/index.php?topic=1847.0
:cheers: