Crossfading screens...

Started by
14 comments, last by Ninkazu 20 years, 11 months ago
I''m still a n00b to OpenGL, but I can''t find any resources on this. Say I have two bitmaps, both 640*480. Is there a way to make a nice clean transition from one to the other? I was thinking I would have to shrink them to 256*256 and just decrease alpha while increasing the other''s. I downloaded NVidia''s crossfade thing, but it''s kind of a dissolve thing I don''t want to do. Thanks.
Sayonara!~Ninkazu
Advertisement
i don''t see why you''d need to change both alpha''s, you''d only need to change the alpha of the bitmap being drawn on top surely.
Still, that''s not what I''m going for.
Sayonara!~Ninkazu
What are you looking for then? Any examples of the technique you want anywhere?
manually interpolate each pixel over some time t
¿We Create World?
If you want to fade the bitmaps on screen never beats OpenGL (or in general 3DHW)...simply draw overlapped bitmaps as textured quads (in Ortho2D for example).
For the first texture disable BLEND, for the second one enable BLEND and use MODULATE texture parameter with modulating color 1,1,1,alpha where alpha goes from 0.0f to 1.0f.

Or do you want to fade via software? In this case you have to implement your own ALPHABLEND function.
It is simply

c = c1*(1-alpha) + c2*(alpha) alpha=0.0,...,1.0

where c is a component (R,G or B)...

A realistic code dont use floats! So you should use look up tables : are you interested about this?
It doesn''t matter if it''s hardware or software as long as it is easy to do (relatively) and I can use my 640*480 bitmaps.
Here is an example:
Site on Geocities... sorry
Sayonara!~Ninkazu
Ok, its very simple.
I think that you already know how to draw a BMP on your screen using GL_QUAD.

So, simply do it like that :


  glEnable(GL_TEXTURE_2D);  DrawImage2();glDisable(GL_TEXTURE_2D);glEnable(GL_BLEND);  glBlendFunc(GL_ONE_MINUS_DST_COLOR,GL_ONE);  // Fade white to black    glColor4f(Transition,Transition,Transition,1);  //...draw a quad here the size of the screen. (no tex)  glBlendFunc(GL_ONE,GL_ONE);  glEnable(GL_TEXTURE_2D);  DrawImage1();glDisable(GL_BLEND);  
So I can have 640*480 textures? I''m really new at this, why not put in a little more code? (like those DrawImage routines...)
Sayonara!~Ninkazu
hum... you really dont know OpenGl...

First, 640x480 its not a good idea for a texture.
Because old card, like Voodoo or Ati 32Mo, support max 512x512 textures.
And only square of 2.
16,32,64,128,256,512
so you can make texture like : 64x64 , 256x16, shit like that.
So use a image editor, like Photoshop, to resize your 640x480 texture to 512x512.
After you load your BMP in opengl. Do you know how to create texture in Ogl?????? if not, go to see tutorial on ogl first. Because this post will take 5 pages to explain all you want to do.

good site to learn it : Nehe productions
Learn all about ogl in it.
But what you only have to learn (for your need) its texture loading. And probably create an opengl window.

This topic is closed to new replies.

Advertisement