PDA

View Full Version : Particle engine problem



thasadams
08-23-2003, 04:43 PM
I am using a particle bitmap to render a blaster shot texture. So I get in the game, and it starts out working fine, with the shots being rendered according to their RGB, but after a while, the texture stops showing up and I get a quad with the RGB value!!! Is is losing the texture somehow?

1234!
08-24-2003, 11:56 AM
It sure sound like a resource leak of some sort.

Without further information it's impossible to tell.

thasadams
08-24-2003, 01:34 PM
I tried using a different texture and it didn't work. The images render perfectly for a while, then at a point in the game (after an amount of time), it just stops binding the texture, and I get a colored polygon. It only happens with the blaster shots, everything else works perfectly. The strange thing is that this didn't happen on VC++ 97, but with VC .net it happens.

hkyProgrammer88
08-24-2003, 02:28 PM
Hello

Narrow down the cause. Write out a log file and check the state of textures (every frame) to see if it is bound or not. Also check your enabling and disabling of textures. The problem should not be too hard to find.

Also, how do you handle your blaster shots. Do you have to bind and enable a texture for them every cycle? Is the binding/enabling conditional? Does your blaster shot code and OpenGL agree on which texture is currently bound and at what time?

I am not sure what VC .Net did that VC 97 did not do, but if you are sure your code is correct then it looks like an MS or OpenGL bug.

If the problem occurs at the same time all the time then it will be easy to determine if it is a code or driver bug.

[This message has been edited by hkyProgrammer88 (edited 08-24-2003).]

thasadams
08-24-2003, 02:30 PM
hey ur right. How do I check to see if texture binding is enabled and what the current texture is? Also, yes, texture mapping is enabled and disabled for each shot, I tried simply enabling, drawing everything, and disabling, but it didn't work.

hkyProgrammer88
08-24-2003, 03:28 PM
Use glGet(). You can use GL_TEXTURE_2D and GL_TEXTURE_2D_BINDING to get the current state. I am thinking that there may be a point where some conditional test causes your program to stop binding the textures. Go through your code and disable all references to glDisable( GL_TEXTURE_2D). That is, keep your textures enabled all the time and see if that helps. If it does, then there is a point in your code where it decides to stop binding or enabling due to a certain condition.

thasadams
08-24-2003, 04:16 PM
Well, I used glGet(), and there is no point at where texture mapping is disabled, even when the images don't show up, meaning that there is either a resouce leak or this is a horrible .net compatibilty bug.

thasadams
08-24-2003, 04:23 PM
Im just gonna forget the stupid texture and compaitibilty problems and draw a few little transparent RGB squares in place, so it will sort of look like a particle.

hkyProgrammer88
08-24-2003, 05:33 PM
No don't give up!

Anyway, you should archive that code so that the bug could later be tracked.

Are you sure there isn't something in the particle code logic?

Actually, what colour is your particle. Is glColor masking out the texture (i.e. the texture is visible but has its color component "washed out").

[This message has been edited by hkyProgrammer88 (edited 08-24-2003).]

thasadams
08-24-2003, 06:11 PM
hey yo.

It is not a particle engine, and any texture I use does the same thing. Yes, I have a mask. I draw the mask, then set the color using glColor3f, then draw the image, which is a white star looking thing in a black background.

See this is a game, and when I play it I have fun, but I am also a bit frustrated. Yeah im gonna archive the code, but for now, I wanna get my frustration out.