Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Ninkazu

Crossfading screens...

This topic is 5649 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
What are you looking for then? Any examples of the technique you want anywhere?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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);

Share this post


Link to post
Share on other sites
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...)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!