Sign in to follow this  
Beaverbutt8

Un - rendering

Recommended Posts

Beaverbutt8    100
Hey guys - if i am using one function to render my scene - how can i "unrender" so to speal, an object in it? Also, when a the game, or something in the game is loading - how can i display a bitmap saying something like "Loading" or "Please wait". Thanks :) Mike

Share this post


Link to post
Share on other sites
CTar    1134
Quote:

Hey guys - if i am using one function to render my scene - how can i "unrender" so to speal, an object in it?


That will be very hard without re-rendering the scene, if you need to remove an object just don't render it, if you already have rendered it you need to re-render the scene (some other techniques may exist, but they will likely either take up GBs of memory and/or require seconds of processing, which is not acceptable for a game). Why do you need to remove an object once it is rendered? If you are talking about a game you should re-render your scene for at least 30 times a second and you can just not render it next time then.

Quote:

Also, when a the game, or something in the game is loading - how can i display a bitmap saying something like "Loading" or "Please wait".


You can do this in multiple ways, the simplest would be to load a texture and use glOrtho to render the texture to the whole screen.

Share this post


Link to post
Share on other sites
Beaverbutt8    100
Quote:
Original post by CTar
Quote:

Hey guys - if i am using one function to render my scene - how can i "unrender" so to speal, an object in it?


That will be very hard without re-rendering the scene, if you need to remove an object just don't render it, if you already have rendered it you need to re-render the scene (some other techniques may exist, but they will likely either take up GBs of memory and/or require seconds of processing, which is not acceptable for a game). Why do you need to remove an object once it is rendered? If you are talking about a game you should re-render your scene for at least 30 times a second and you can just not render it next time then.

Quote:

Also, when a the game, or something in the game is loading - how can i display a bitmap saying something like "Loading" or "Please wait".


You can do this in multiple ways, the simplest would be to load a texture and use glOrtho to render the texture to the whole screen.





Exactly what i want to do is this -
I have loaded a 3ds model of a castle couryard.
Now, when my player collides with the door, which is at a certain position, i want to render a different scene ( which is another .3ds model ), and un render the previous scene

Share this post


Link to post
Share on other sites
ZoomBoy    162
Quote:
Original post by Beaverbutt8
Exactly what i want to do is this -
I have loaded a 3ds model of a castle couryard.
Now, when my player collides with the door, which is at a certain position, i want to render a different scene ( which is another .3ds model ), and un render the previous scene

What you need in your scenegraph is a switching variable or Node. You have to load both Open and Closed Door models. In the original mapping you'd mark the model as Closed on your Display-List. When the player-door collision occurs, you'd have to mark it as OPEN and put the OPEN model onto your display list.

What's your display-list like?

Share this post


Link to post
Share on other sites
Kalasjniekof    246
You can't. You most likely want to do something like this:

void RenderScene()
{
for(/*each object*/)
{
object.Render();
}
}

class SceneObject
{
public:
bool m_shouldBeVisible;
//all your other object data

void Render()
{
if(m_shouldBeVisible == true)
{
//all your rendering goes here
}
}
};





Your scene tells every object to render itself, while the object desides if it should be visible.

Share this post


Link to post
Share on other sites
lightbringer    1070
I think the wording "display list" was a bit unfortunate due to the overloading of the original meaning that happened here.

Beaverbutt8, in case you have not figured this out yet, ZoomBoy was in fact not referring to OpenGL display lists, but to a "list of all objects to be rendered this frame".

As the others have pointed out already, what you want to do is, roughly, each frame:
1) decide what objects are visible (switching/level of detail, culling, whatever else)
2) put these objects into a list (probably sorting by texture or similar, but sorting can be added later on)
3) pass this list to your "DrawGLScene"
4) in your "DrawGLScene", render every object in that list

Thus, your objects don't necessarily have to know about how to render themselves, your rendering code is kept to your DrawGLScene method/object. What the scene objects do need to know is the lighting/texture/material/whatever needed to render them. On the other hand, the rendering routine does not need to know about the objects it renders, only about how to get the needed info from them to render them.

Edit: As to how you render the objects, whether it's using immediate mode, display lists, vertex arrays, or vertex buffer objects - that's up to you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this