|
I'm not so familiar with OpenGL, but perhaps you should take a look at your model again. Lighting will not work properly if the normal vectors of your vertices are not calculated properly and make sure that they have a length of exactly 1.
As a test, you could also load any model and render it with your lighting. This way you can find out wether the model or the lighting is wrong.
And from the clouds a mighty voice spoke: "Smile and be happy, for it could come worse!"
And I smiled and was happy And it came worse.
|
|
|
|
|
Send me all your codez. It's urgentz
Just joking
I do have a little problem, which is not at all unsolvable, but I just don't like to bend and tweak things just to make them fit. And, hopefully, I will not have to provide endless code listings. It's more a matter of making certain that some events happen in the right order.
For a while I have been writing a GUI for XNA and now I have started on the actual game client which is supposed to use it. As expected, there have been numerous smaller and larger bugs and missing features, so that I'm not getting ahead very quickly right now. But the GUI is really getting ahead and is more up to its job every day.
Last I added themes for the GUI. Among other things, the theme contains styles for controls. The styles come in two flavors: Control styles and named styles. Control styles are applied to all controls of a type. Named styles are additionally applied to all controls which explicitly request that style by name. The theme is loaded from XAML and the styles actually are simple data objects with all properties as nullable types. This allows you to incrementally apply a control style and then a named style by changing only those properties of the controls which are not null in the style. And here is where the problem begins.
This would be the best sequence:
1) An instance of a control is created. All its properties are set to defaults in the constructor.
2) Apply the control style according to the type of the control. Overwrite only those properties which are not null in the style.
3) Apply a named style, if any is set, again only overwriting the properties which are not null in the style
4) Controls and forms are also loaded from XAML. If there are any properties set in the markup, they should be set last to give them the highest priority and enable them to override defaults or styles.
This is how it really is:
1) An instance of a control is created. All its properties are set to defaults in the constructor.
2) Controls are instantiated when loading from XAML and the properties from the markup are set right after that. They now have the second lowest priority, not the highest as I would like.
3) Later, when the control is inserted into the GUI, further initialisation is done. At this point the control gets its reference to the loaded theme and now can find and apply its control style and its named style (if any).
As I see it, there is only one way to be faster than the XAML loader: The styles must be applied in the constructor already. The problem is that the theme will not be available to the control until it is inserted into the UI.
Now, I could simply pass the loaded theme as a parameter to the constructor, but that would also make dynamically instantiating controls more awkward. A class factory for the controls would help a little, but still this would be a departure from the way we are accustomed to. That's something I have tried to avoid. I also thought of making the theme a singleton, so that I can access it from the constructors with out having a reference, but this would not work and appears to me like a hack to make fit what does not fit.
So, how do I get a reference to the theme into the constructor without passing it as a parameter? Applying the styles in the constructor is the only way to make sure that things always happen in the right sequence, so there is no way around that. What is the cleanest and least 'hackish' way to accomplish this?
Edit: Constructor parameters are not an option for another reason as well: Any class to be used with XAML must be serializable. This includes having a standard constructor without parameters. Even if there were a second constructor, then XAML would not use it while loading the controls.
Edit^2: Almost a week now and no reply. The title must really have scared everybody
And from the clouds a mighty voice spoke: "Smile and be happy, for it could come worse!"
And I smiled and was happy And it came worse.
|
|
|
|
|
Access it through a singleton.
desired objects will register to the singleton in their ctor.
There might be other ways, if you simplify your question I might know.
For instance when I derive from usercontrol in wpf the answer is to make the control an agregate of a new control and in that way you can better control the auto generated xaml. In other words wrap it with another control is often the way. Is that a hack? Yes, but surely the best way.
I may not understand your question I'm just letting you know what comes to mind.
|
|
|
|
|
A reply! Great! Have some points alone for that.
rj45 wrote: Access it through a singleton.
That's what I also thought. But that's where it really gets complicated. The required object for initialisation would be the user interface object itself. It loads graphics assets, loads configurations, loads themes and styles, sets up the input devices, starts and controls the input thread, starts and controls the rendering thread and also starts and controls the UI thread.
This single object holds everything together and new controls would need a reference to it in its constructor to get acces to the current theme and also some other initialisations. Making this object a singleton would be problematic, but up to now it's also the only way I see.
rj45 wrote: For instance when I derive from usercontrol in wpf the answer is to make the
control an agregate of a new control and in that way you can better control the
auto generated xaml. In other words wrap it with another control is often the
way. Is that a hack? Yes, but surely the best way.
The controls I have up to now form a class hierarchy. Some also use child controls like buttons ore scrollbars internally, so I'm already 'wrapping' them. This also makes it possible to extend this hierarchy as needed.
rj45 wrote: I may not understand your question I'm just letting you know what comes to mind.
That's quite ok. The whole thing has reached some complexity and it's hard to describe the problem at hand without getting into this complexity. I probably already could write a book about it
And from the clouds a mighty voice spoke: "Smile and be happy, for it could come worse!"
And I smiled and was happy And it came worse.
|
|
|
|
|
how can i develope a 3D game????
what are the names of material& programmes i should download ???
what are the best educational web sites in this field i should visit to learn ???
thanks
|
|
|
|
|
If you just want to dip your toes into 3D game creation, then you might want to try out 3D RAD[^]. It's fairly straightforward to use and let's you create games to share with your friends for free.
If you want to program games, you could look at Microsoft XNA or you could look at something like Sandbox[^] or DarkBASIC[^].
|
|
|
|
|
in your opinion .... is the field of game developing :good or not::for money & future point of view ??
does it take a lot of time to be professional ??
what can i do to be excellent &Distinctive؟؟
thanks
|
|
|
|
|
gif2020 wrote: is the field of game developing :good or not::for money & future point of
view
From my POV, no. There's a massive churn of companies/developers in this field. The costs to produce games have become astronomical and require teams comparable to those making films. Pay is historically low in this field because there is such a demand to get into it that the companies do not have to pay that much.
Saying that, I have no idea where you are from, so what I consider low pay you may consider to be a fortune, so it's up to you to look into it based on your own expectations.
Games programming is a hugely complex task, so you need to have a good understanding of maths, preferably physics, etc.
|
|
|
|
|
ok , if u can give me advice .... for the field of programming & developing
& if I like to work at home as some of websites allow us to submit our work homely
what are the main market's demand for pragramming engineer ???????
thanks
|
|
|
|
|
Hi dear firend
to develop a 3D or 3D game first you need to get infortmation about "Open GL" and "Direct X" programming in your language like Visual C++ 2010.
with it you use the GPU power for your code.
take a look at www.opengl.com
good luck
|
|
|
|
|
As Pete had mentioned, XNA is really good to learn from. Microsoft has some good example games developed in XNA for you to look at. There are plenty of good resources on the 'net and here on Code Project for simple game development.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Great 3D physics engine that will handle drawing and everything. Great and wonderful software. Go here.
|
|
|
|
|
I've now released my first (within reason) game for the WP7. As Game Dev section looks a little empty thought I would show. Please forgive me if I burn your eyes, I'm no artist and I haven't even started my Uni course yet :p
Star Side
My next project is going to hopefully going to be a 3D Xbox 360 game
All comments (and criticism) widely accepted
|
|
|
|
|
This is not the place to advertise; this is a technical question and answer forum.
The best things in life are not things.
|
|
|
|
|
Ok if you want technical. In my next release I am building a real time ray-tracer. I'm currently having a problem making it fire the rays in a perspective fashion other than the orthographic fashion it is. It works fine apart from the orthographic look it has :/
Main Draw Sequence:
for (int X = 0; X < Width; X++)
{
for (int Y = 0; Y < Height; Y++)
{
Ray TRay = new Ray(new V3(X - HalfWidth, 0, Y - HalfHeight) - CameraLocation, new V3((X - HalfWidth) * 3f, 100, (Y - HalfHeight) * 3f) );
foreach (SceneModel TempModel in Models)
{
foreach (Triangle TempTriangle in TempModel.Triangles)
{
Intersection TInter = TempTriangle.Intersects(TRay);
if (TInter.Hits) Temp.SetPixel(X, Y, TInter.HitColour);
else Temp.SetPixel(X, Y, BackgroundColour);
}
}
}
}
Its self explanatory.
P.S. I was merely looking for opinions and possible improvements
|
|
|
|
|
Thomas.D Williams wrote: I was merely looking for opinions and possible improvements
I'm sure, but unfortunately that is not the purpose of these forums. If you want people to review and critique your work then write an article round it and post it to the Articles section. And don't forget to read the guidelines[^] first.
The best things in life are not things.
|
|
|
|
|
I have also developed a mobile App. Game.........
modified on Tuesday, September 6, 2011 7:59 AM
|
|
|
|
|
This may very well be one reason why nothing is going on here. I would post something far more often on my progress and to get some opinions if I had not to figure out some important question every time.
"Dark the dark side is. Very dark..." - Yoda
--- "Shut up, Yoda, and just make yourself another toast." - Obi Wan Kenobi
modified on Tuesday, August 30, 2011 7:37 AM
|
|
|
|
|
|
Hi - I know. Don't ask me why! It's all I can afford right now.
However, more to the point, I've a problem that is really weird. I'm trying to attach a movie using the following code:
//this code is associated with the button:
on(press){
_root.attachMovie("MyOldMovieClip", "MyNewMovieClip"+level, level);
_root["MyNewMovieClip"]+level._x = int(Math.random() * 500);
_root["MyNewMovieClip"]+level._y = int(Math.random() * 450);
level++;
}
I've got a movie clip symbol, and a button symbol in the library. The button only is on the stage.
//This code is associated with the stage:
level = 0;
stop();
Pressing the button produces nothing. However when I run a trace i.e.
trace(int(Math.random() * 500));
random values appear.
Please put me out of my misery.
|
|
|
|
|
Wow, it's been a while since I used flash, sometime around when ActionScript 3 came in I think. I can't remember anymore - it's just what I've read:
Example
myButton.onPress = function () {
trace ("onPress called");
};
Got it at Adobe, right here[^].
|
|
|
|
|
plese tell me that how can i protect a cd so that nobody can copy the information
|
|
|
|
|
A couple of things.
First, this is not the forum for asking a question like this. This is the Game Development forum.
Secondly, you will never be able to completely protect a CD so that nobody can access information on it. The closest you could get is to implement a DRM system that meant that it was difficult for others to copy the information; there will always be somebody determined enough to crack the DRM and access the information. If you could come up with a foolproof system, you'll end up being very, very rich.
|
|
|
|
|
You can't.
You could encrypt it and then charge for a key.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
Put the CD into a microwave, set the microwave to full power and then turn it on for a few seconds. Nobody will ever be able to read or copy anything from the CD.
If there is any way at all to read the data, then you can also copy it. There is no way to prevent this unless you completely destroy the CD. DRM and other protections also can't prevent that someone makes a copy. They only try to assure that the copy is worthless. Such protections can be removed, modified or tricked into allowing access to the CD, so they are also not foolproof.
"Dark the dark side is. Very dark..." - Yoda
--- "Shut up, Yoda, and just make yourself another toast." - Obi Wan Kenobi
|
|
|
|