Rendering different cameras

Started by Melssj5, January 30, 2005, 12:27:49 AM

Previous topic - Next topic

Melssj5

Hello I am trying to make a multiplayer game, so I made a class called "Escenario", that have static fields and methods so they can be accesed from anywhere without declaring objects, The problem is that the render that I know how to do, renders the world throught an asigned camera, but I need to render what an specific and not asigned camera is viewing, for example: the examples that came with the api reference the camera to the asigned camera
Camera C=theWorld.getCamera ();

and C is the asigned camera, but if I want to use another camera I can do:

Camera C=new Camera ();
theWorld.setCameraTo (C);

and C is the asigned camera here.

But the camera to render must be always the camera asigned to World. My question is:

Is there any way to render to diferent cameras at the same time, because when I run my applet in my browser, it renders in both web pages the same camera. I dont know if my problem is being understood.

I nned to know how to render the content of a camera without asigning it as the World default camera.
Nada por ahora

EgonOlsen

I don't understand your problem. It's possible to assign a different Camera to a World to render the world from different views. Why doesn't that work for you? I can't see a difference between doing a setCameraTo(camera1)-render()-setCameraTo(camera2)-render and a render(camera1)-render(camera2)...  :?:

Edit: Or are you trying to render the same instance of World using different cams at exactly the same time using different threads? If that's the case...well, that won't work anyway. You have to make sure that the renders take place in a defined order one after the other.

Melssj5

Quote from: "EgonOlsen"
You have to make sure that the renders take place in a defined order one after the other.

Yes, I am trying to render simultaneours cameras, becausse I made the game on applets, but when I run the applet, the same render is always being shown in both web pages, but I need different cameras in every web page, I am not using only one camera for every applet, I made a list called "Participantes" in wich every node is a player with is respective craft and camera, the problem is that when I asign a camera to the world to make a render, the view also cange in the other web page.

Should I use a World for every applet instead from one static World on an unique class to handle all the objects????
Nada por ahora

EgonOlsen

Quote from: "Melssj5"Should I use a World for every applet instead from one static World on an unique class to handle all the objects????
Not necessarely...that would mean that you have to use multiple instances of your objects too, because an Object3D can only belong to one instance of World. But what you can't do, is render one World with multiple Cameras at a time. A World contains for example the VisList, which will be modified in the rendering. If you render one World in multiple threads, the results will be..whatever...even worse: If you switch to OpenGL one day (and away from an applet), your application will simply crash, because only one thread has the right context for rendering in hardware. So i suggest to do the rendering in one thread and one after the other. If that's not an option and you can for sure say that you'll never use OpenGL in your application, you may extend World and add a kind of locking, so that only one thread can do the rendering at a time and all others have to wait for it to finish.

Melssj5

Quote from: "EgonOlsen".

Hello again.
:shock:

I found a way to render what U was looking but I have another problem now, well I hace 3 other pronlems but tgose will be different topics

I made a List with static variables, one of them is the position using a simpleVector, and each applet has a camera, and an aircraft, but the rest of aircarfts are moved by updating the list content, well. The pronlem is that the textures of the other aircafts are not being displayed, only the own texture in each applet.

A craft is displaying its colors but not the others. What can it be?
Nada por ahora

EgonOlsen

Quote from: "Melssj5"I made a List with static variables, one of them is the position using a simpleVector, and each applet has a camera, and an aircraft, but the rest of aircarfts are moved by updating the list content, well. The pronlem is that the textures of the other aircafts are not being displayed, only the own texture in each applet.
I don't get what you are doing there...do you have a screenshot to illustrate the problem?