Dealing with conflicting Init's for effects :/
Okay... here''s my latest and hopefully last problem.
I have a whole load of effects in my program, and each one works great on its own.
However... for each effect, different things need to be initialised yada yada (i.e GL_DEPTH_TEST, enabling GL_TEXTURE_2D, e.t.c).
And some of these things conflict with other inits for other effects.
The only thing I''ve thought of thus-far is to init the feature IN its drawing loop. (enable things, disable things, then draw e.t.c), but I''m not sure if that''s "expensive" during run time.
Does anyone have any other ideas? or would enabling/disabling things in the drawing loop be okay?
~Cobra~
"Build a man a fire, and he will be warm for a day. Set a man on fire, and he will have warmth for the rest of his life"
Order them. Such that everything that needs something to be enabled are all batched together, therefore that something can be enabled before the batch and disabled afterwards.
Death of one is a tragedy, death of a million is just a statistic.
Death of one is a tragedy, death of a million is just a statistic.
If at first you don't succeed, redefine success.
:/ argh... even when I do that, my particle system refuses to draw if I have the world loaded on screen.. O_O damn thing.
"Build a man a fire, and he will be warm for a day. Set a man on fire, and he will have warmth for the rest of his life"
Okay.... heres my problem in a nutshell.... I need to be able to do this.
ParticleInit() - set up all particle bits.
DrawTestParticles() - draw them.
WorldInit() - change all enables e.t.c to suit the world data.
WordDraw() - draw the world using these new settings.
and so on and so forth.
The problem is.... HOW? at the moment its like this.
Particle Init()
WorldInit()
DrawTestParticles()
WorldDraw()
because all the init stuff has to be done outside of the drawing loop.. :/, and are thusly done together... in this case DrawTestParticles() wont work because the enables/disables have already been changed to suit world-drawing. :/
It''s probably a stupidly simple problem but for some unknown reason I cant get my head around it.
~Cobra~
ParticleInit() - set up all particle bits.
DrawTestParticles() - draw them.
WorldInit() - change all enables e.t.c to suit the world data.
WordDraw() - draw the world using these new settings.
and so on and so forth.
The problem is.... HOW? at the moment its like this.
Particle Init()
WorldInit()
DrawTestParticles()
WorldDraw()
because all the init stuff has to be done outside of the drawing loop.. :/, and are thusly done together... in this case DrawTestParticles() wont work because the enables/disables have already been changed to suit world-drawing. :/
It''s probably a stupidly simple problem but for some unknown reason I cant get my head around it.
~Cobra~
"Build a man a fire, and he will be warm for a day. Set a man on fire, and he will have warmth for the rest of his life"
quote:
at the moment its like this.
Particle Init()
WorldInit()
DrawTestParticles()
WorldDraw()
Why do whe world-init right after the particle-init? Shouldn''t it be :
Particle Init()
DrawTestParticles()
WorldInit()
WorldDraw()
If you take your own method, you first make settings to suit the particle-system, but right after that, you set ''em to suit the world, so that the settings for the particle system are overwritten.
Newbie programmers think programming is hard.Amature programmers think programming is easy.Professional programmers know programming is hard.
lol.... thats the problem!
you cant do it in that order!
glInit()
{
all init stuff handled here;
}
MainDrawingLoop()
{
all drawing stuff handled here;
}
so how would I do init-draw-init-draw ?
you cant do it in that order!
glInit()
{
all init stuff handled here;
}
MainDrawingLoop()
{
all drawing stuff handled here;
}
so how would I do init-draw-init-draw ?
"Build a man a fire, and he will be warm for a day. Set a man on fire, and he will have warmth for the rest of his life"
Well, I can''t make out of your post WHY it doesn''t work,
1. Do all your settings you need for the world. The GL_enable calls etc.
2. Do all drawing for your world-objects, but DON''T send it to the screen yet.
3. Make all settings needed for the particle-system (GL-enable calls etc)
4. Do all drawing for your particle system.
5. Draw the scene to the screen.
In order to do this, you simply need to make your settings for the world, and then use the drawing loop to ONLY draw your world. exit the drawing loop, make your settings for the particle-sys, and then use the drawing loop to ONLY draw the particle-system. Then you''ve got a new frame ready to flush to the screen
1. Do all your settings you need for the world. The GL_enable calls etc.
2. Do all drawing for your world-objects, but DON''T send it to the screen yet.
3. Make all settings needed for the particle-system (GL-enable calls etc)
4. Do all drawing for your particle system.
5. Draw the scene to the screen.
In order to do this, you simply need to make your settings for the world, and then use the drawing loop to ONLY draw your world. exit the drawing loop, make your settings for the particle-sys, and then use the drawing loop to ONLY draw the particle-system. Then you''ve got a new frame ready to flush to the screen

Newbie programmers think programming is hard.Amature programmers think programming is easy.Professional programmers know programming is hard.
i had the same problem as you did.
my solution was using bool like this:
bool scene1=false;
bool scene2=false;
bool scene3=false;
in main draw loop
if(scene1 and timeforscene1)
{ draw stuff}
else
{prepare scene1
scene1 =true
}
if(scene2 and timeforscene2)
{ draw stuff}
else
{prepare scene2
scene2 =true}
if(scene3 and timeforscene3)
{ draw stuff}
else
{prepare scene3
scene3 =true}
This worked fine for me, if anyone knows a better way please post.
my solution was using bool like this:
bool scene1=false;
bool scene2=false;
bool scene3=false;
in main draw loop
if(scene1 and timeforscene1)
{ draw stuff}
else
{prepare scene1
scene1 =true
}
if(scene2 and timeforscene2)
{ draw stuff}
else
{prepare scene2
scene2 =true}
if(scene3 and timeforscene3)
{ draw stuff}
else
{prepare scene3
scene3 =true}
This worked fine for me, if anyone knows a better way please post.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement