So if you get it to work on XP it also works on 98?
So if you get it to work on XP it also works on 98?
So far that's been the case.
I've been developing mainly on a win98 machine and a bit on an xp machine.
But now I'm purely going XP, so let's fully test this theory when my game is finished
Huhuhu
I came up with another problem.
I know I can do blending with a mask layer and make parts of a polygon transparent.
Now I want to do a "fade to nothingness" effect.
This means I have a picture I show (partially transparent using a mask layer). I want the whole to become more and more transparent overall until it disappears because it's reached a maximum transparency.
Example:
I know there's something possible to make the whole more transparent, but how?Code:glEnable(GL_BLEND); glDisable(GL_DEPTH_TEST); glBlendFunc(GL_DST_COLOR,GL_ZERO); glBindTexture(GL_TEXTURE_2D,backmask[z]); glBegin(GL_QUADS); glTexCoord2f( 0.001, 0.99); glVertex3f( i*20-60.0001,-j*20+40.0001, -30.0); glTexCoord2f( 0.001, 0.01); glVertex3f( i*20-60.0001,-j*20+19.9999, -30.0); glTexCoord2f( 0.999, 0.01); glVertex3f( i*20-39.9999,-j*20+19.9999, -30.0); glTexCoord2f( 0.999, 0.99); glVertex3f( i*20-39.9999,-j*20+40.0001, -30.0); glEnd(); glBlendFunc(GL_ONE,GL_ONE); glBindTexture(GL_TEXTURE_2D,backtex[z]); glBegin(GL_QUADS); glTexCoord2f( 0.001, 0.99); glVertex3f( i*20-60.0001,-j*20+40.0001, -30.0); glTexCoord2f( 0.001, 0.01); glVertex3f( i*20-60.0001,-j*20+19.9999, -30.0); glTexCoord2f( 0.999, 0.01); glVertex3f( i*20-39.9999,-j*20+19.9999, -30.0); glTexCoord2f( 0.999, 0.99); glVertex3f( i*20-39.9999,-j*20+40.0001, -30.0); glEnd(); glEnable(GL_DEPTH_TEST); glDisable(GL_BLEND);
Let's say I want to give it 25% visibility, which is 75% transparency.
Huhuhu
Look into:
where rgba are byte values.Code:glColor4ub(R,G,B,A);
In your case its probably glColor4ub(255,255,255,[0..255]);
Traveller: after having your avatar roll its eyes at me thousands of times, I appreciate the change
Smotsholle: I think you may be going about this the wrong way..
First, you should use alpha channels, they make your life a lot easier. Creating the art will be a *little* trickier since you have to use TGA or PNG images.
There is a TGA file loader here which loads a TGA and it's Alpha channel:
http://www.sulaco.co.za/opengl_proje...ure_loader.htm
With simple instructions.
You can download a TGA picture to test out here:
http://www.sulaco.co.za/nitrogen/junk/map.tga
Ok, once you have a texture with an alpha channel, this is how you draw it with a 'fade-to-nothing' effect:
Code:glBindTexture(GL_TEXTURE_2D, MyTexture); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); //this does the alpha blending. glcolor4f(1,1,1, FadeAmount); //This does the fading, set FadeAmount to 0 for total transparency, and 1 for full opacity. glBegin(GL_QUADS); glTexCoord2f(0,1); glVertex2f(X-Size, Y-Size); glTexCoord2f(1,1); glVertex2f(X+Size, Y-Size); glTexCoord2f(1,0); glVertex2f(X+Size, Y+Size); glTexCoord2f(0,0); glVertex2f(X-Size, Y+Size); glEnd;
There's actually a way, using multipass rendering, supports virtually unlimited number of lights :Originally Posted by Smotsholle
http://www.delphi3d.net/download/lightaccum.zip
Amnoxx
Oh, and this code appears to be an approximate replacement for return(random() & 0x01);
Phoenix Wiki
http://www.phoenixlib.net/
Phoenix Forum
http://www.pascalgamedevelopment.com/viewforum.php?f=71
I've changed the rules of the game a bit so I only need one light.
About the alpha layer. I managed to get it working using the first rule.
But I might be able to use the second advice for future projects.
I'll certainly keep the extra lighting tip in store too for future projects.
Huhuhu
Hello everyone, I'm back again after a long time.
Had a 6 week vacation and I've been gone so much I haven't been online in that time.
Now I'm back working on this project again.
Glad to say the game itself is just about bug-free.
I've found 6 bugs now and I'm able to fix two of them.
The other 4 bugs are related (Same bug occurs in different parts of the game).
I've copied the game on a central network disk. This means everyone on this network plays the same game.
I've allowed 6 children to play this game simultaneously and starting the game didn't seem to be too much of a problem. Just encountered a slow-down because all 6 of them were loading the same images(BMP files) from a subdirectory in the game.
The real bug is file reading/writing:
There are some binary files (saved records) which store the important data (levels, highscore lists, accounts, etc....).
As they played the game it could suddenly begin to crash when they tried to read from those files or write to them (not certain about the writing though).
When creating this game I assumed that the time between opening and closing the file would be a fraction of a second. I thought this would make it nearly impossible to get any kind of bug there. Obviously I was mistaken.
The children tried it stand alone, so no delphi error, just a generic error with the "Send" and "Don't send" button (you know what I mean).
I've thought of a sollution myself, but I don't know this will work or how to implement it.
I'll show you a file read function first to explain:
I thought of catching the read/write error, should it occur.Code:function LoadFromVrgFile(filename:string):TMySaveRecord; var myFile : File of TMySaveRecord; tv: TMySaveRecord; begin AssignFile(myFile, filename); Reset(myFile); Read(myFile, tv); result := tv; CloseFile(MyFile); end;
If it does, just try again (with a max of 20 times, should be enough).
If it goes wrong more than 20 times I'll assume the file itself is bad.
Is this the right way to go about things or not?
If so, is this the right way to implement this?
Made this code from the top of my head, would this work?Code:function LoadFromVrgFile(filename:string):TMySaveRecord; var myFile : File of TMySaveRecord; tv: TMySaveRecord; i:integer; begin AssignFile(myFile, filename); i := 0; Error := True; while (i < 20) AND (Error) do begin Error := False; Reset(myFile); {$I-} Read(myFile, tv); {$I+} If IOResult <> 0 then begin Error := True; inc(i); end else result := tv; CloseFile(MyFile); end; end;
Huhuhu
1. Hmmm... Shouldn't it generate an error on Reset first...?
2. Add some Sleep()/Wait() between retries...?
3. Would FileMode work in this case, to make file access exclusive?
4. Use TFileStream in pair with Try/Except?..
1. I'm not sure where the error occurs. I've tested this with the compiled EXE only.
2. I've managed to put the loop on hold for a while due to the 3rd point you mentioned.
3. I'm trying the file mode thing right now. Gonna test it soon. I'll let you know how it turns out.
4. Don't really understand this one. Do you have a piece of example code?
Huhuhu
Bookmarks