[QUOTE=robmaister12;32699361]1) try some other values for the blendfunc, here's mine from most projects:
[csharp]GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);[/csharp]
This is a good explanation of BlendFunc: [url]http://www.bigpanda.com/trinity/article2.html[/url]
2) Quaternion.FromAxisAngle(Vector3 axis, float angle) maybe?[/QUOTE]
1. I tried that already, but that's only for normal blending, not for multiply blending. Although, I've fixed it now by simply not using multiply blending :v: (I made the shadow texture transparent)
2. That might be a possibility, but what would I need to enter as angle?
[QUOTE=Dlaor-guy;32699995]1. I tried that already, but that's only for normal blending, not for multiply blending. Although, I've fixed it now by simply not using multiply blending :v: (I made the shadow texture transparent)
2. That might be a possibility, but what would I need to enter as angle?[/QUOTE]
2. I'm not really sure, but just from a quick google, it looks like you just do some vector math to get the axis and the angle: [url]http://forums.create.msdn.com/forums/p/5385/28215.aspx[/url]
[url]http://www.gamedev.net/topic/554980-rotating-a-quaternion-using-a-normal-vector/[/url]
Just to be clear, your normal is [i]not[/i] the same as your axis of rotation. Your axis will be perpendicular to the normal, and you can find it by taking the cross-product of the normal with the vector you're trying to rotate. This will usually be a 'straight down/ahead' vector like <0, 0, 1>, but you need to handle the special case of a normal vector like <0, 0, z> separately (as this will produce an axis of <0, 0, 0>, when any value of <x, y, 0> would work equally well).
You can find the angle with the dot product. Remember that the definition is [i]a dot b = |a||b| cos theta[/i] and solve for theta: [i]theta = arccos[(a dot b) / (|a||b|)][/i].
[i]|a|[/i] and [i]|b|[/i] should be 1, so this simplifies to [i]theta = arccos(a dot b)[/i] for the case where [i]a[/i] and [i]b[/i] are both normalized.
[QUOTE=mechanarchy;32693407]I don't really know much about python and pygame, but you can try checking whether an image is within the view. If it's not, don't bother blitting it. If it is, the player needs to see it, so blit it then. This drastically improved the performance of one of my little test games. I don't have exact figures for the performance increase but it was significantly faster.[/QUOTE]
That's the way my code will work once I get past this and add in a camera. I just need to figure out a way to get rid of the trail, the point of having a background is that it is blitted before my character is so it goes over the character image from the previous blit and then the character is blitted again. I can't keep this system though without blitting my other images again after the background or the boxes will not be seen.
:pwn:*warning* Noob question alert *warning*:pwn:
I try to make a simple installer with C, C++ or C#
However, I don't know which is better to use (and I will use the final result as a template)
+ I don't even know how to make it.
I googled it but all what I can find are installers to install my finalized C project..
What I am trying to find / make is a installer which installs (non-existing or overwrite existing) files in (already existing) folders without registry changes. This should be with a progress bar, some pictures and a fail-safe dialog, if possible. I have Visual Studio 2010 Ultimate in my possion so if there are any other requirements (except working brains, which I clearly do not have :suicide:), please say so.
Thanks for any tips you guys might give me.
P.S. Sorry for my English.
[QUOTE=TDarkShadow;32702427]:pwn:*warning* Noob question alert *warning*:pwn:
I try to make a simple installer with C, C++ or C#
However, I don't know which is better to use (and I will use the final result as a template)
+ I don't even know how to make it.
I googled it but all what I can find are installers to install my finalized C project..
What I am trying to find / make is a installer which installs (non-existing or overwrite existing) files in (already existing) folders without registry changes. This should be with a progress bar, some pictures and a fail-safe dialog, if possible. I have Visual Studio 2010 Ultimate in my possion so if there are any other requirements (except working brains, which I clearly do not have :suicide:), please say so.
Thanks for any tips you guys might give me.
P.S. Sorry for my English.[/QUOTE]
[url]http://nsis.sourceforge.net/Main_Page[/url]
[QUOTE=T3hGamerDK;32702732][url]http://nsis.sourceforge.net/Main_Page[/url][/QUOTE]
Thanks T3h, but I really mean what I say, I want to know exactly how to make your own file installer with C, C++ and/or C#..
Not NSIS or else I wouldn't be in here..
I'm making a textfield in Java and it's taking up the entire window for some reason.
I tried using setSize() to fix it but to no avail.
[code]JTextField Input = new JTextField(8);
frame.add(Input);[/code]
Why?
If this appears nooby and dumb, it's been a while. A long while.
Anyone tried these C# game engines?
tIDE
[url]http://tide.codeplex.com/[/url]
NetGore
[url]http://www.netgore.com/[/url]
Opinions?
Thought they might be fun to mess with.
[QUOTE=TDarkShadow;32704813]Thanks T3h, but I really mean what I say, I want to know exactly how to make your own file installer with C, C++ and/or C#..
Not NSIS or else I wouldn't be in here..[/QUOTE]
That's kind of a dumb question, then. If you know anything about C++ or C, you would KNOW that it's not something you just do.
If you want to make your own file installer, then go ahead and do so. There's no "how-to" guide when it comes to programming languages, as there could be billions of ways to do it, depending on what you want or need.
[QUOTE=Sir Whoopsalot;32710523]I'm making a textfield in Java and it's taking up the entire window for some reason.
I tried using setSize() to fix it but to no avail.
[code]JTextField Input = new JTextField(8);
frame.add(Input);[/code]
Why?
If this appears nooby and dumb, it's been a while. A long while.[/QUOTE]
Whelp, that's fixed. It's amazing how you can fix things in such a small way.
Now I just need to figure out how to make a button print stuff in a text field.
[QUOTE=Sir Whoopsalot;32711335]Whelp, that's fixed. It's amazing how you can fix things in such a small way.
Now I just need to figure out how to make a button print stuff in a text field.[/QUOTE]
Imagine, someone else has the same problem, uses Google and finds your post.
[QUOTE=horsedrowner;32711453]Imagine, someone else has the same problem, uses Google and finds your post.[/QUOTE]
Put JTextField in new panel, use Borderlayout to set said panel someplace else.
[QUOTE=horsedrowner;32711453]Imagine, someone else has the same problem, uses Google and finds your post.[/QUOTE]
Reminds me of people that post links to answer someone and when I have the problem the link is 404'd
[QUOTE=ROBO_DONUT;32701128]Just to be clear, your normal is [i]not[/i] the same as your axis of rotation. Your axis will be perpendicular to the normal, and you can find it by taking the cross-product of the normal with the vector you're trying to rotate. This will usually be a 'straight down/ahead' vector like <0, 0, 1>, but you need to handle the special case of a normal vector like <0, 0, z> separately (as this will produce an axis of <0, 0, 0>, when any value of <x, y, 0> would work equally well).
You can find the angle with the dot product. Remember that the definition is [i]a dot b = |a||b| cos theta[/i] and solve for theta: [i]theta = arccos[(a dot b) / (|a||b|)][/i].
[i]|a|[/i] and [i]|b|[/i] should be 1, so this simplifies to [i]theta = arccos(a dot b)[/i] for the case where [i]a[/i] and [i]b[/i] are both normalized.[/QUOTE]
Thanks, that did the trick!
If anyone is curious, here's the code required to make it work: (C#, OpenTK)
[cpp] public static Quaternion QuaternionFromNormal(Vector3 normal)
{
Vector3 up = Vector3.UnitZ;
Vector3 axis = Vector3.Cross(normal, up);
float angle = Vector3.Dot(normal, up);
return Quaternion.FromAxisAngle(axis, (float)-Math.Acos(angle));
}[/cpp]
[QUOTE=T3hGamerDK;32710934]That's kind of a dumb question, then. If you know anything about C++ or C, you would KNOW that it's not something you just do.
If you want to make your own file installer, then go ahead and do so. There's no "how-to" guide when it comes to programming languages, as there could be billions of ways to do it, depending on what you want or need.[/QUOTE]
Again, if I would know, I wouldn't be in here right? =/
I already tried with some experiments of my own but somehow they are filled with errors..
That's why I try to get the answer here..
[QUOTE=TDarkShadow;32716032]Again, if I would know, I wouldn't be in here right? =/
I already tried with some experiments of my own but somehow they are filled with errors..
That's why I try to get the answer here..[/QUOTE]
If you REALLY must do it in C/C++ or C#, you should AT LEAST learn how the language works.
I'm working with OpenGL, and wanted to make my program multithreaded.
I would like to load all models/materials in a separate thread, so the rendering doesn't interrupt. This has proven to be quite difficult though, because I need an active OpenGL context in the current thread if I want to call OpenGL functions.
Now how would I go about moving that stuff to a separate thread? (or rather, multiple ones)
I've read somewhere that you can create a new context in the thread and share resources with the main one, but how would that work without creating a new window?
[QUOTE=WeltEnSTurm;32716626]I'm working with OpenGL, and wanted to make my program multithreaded.
I would like to load all models/materials in a separate thread, so the rendering doesn't interrupt. This has proven to be quite difficult though, because I need an active OpenGL context in the current thread if I want to call OpenGL functions.
Now how would I go about moving that stuff to a separate thread? (or rather, multiple ones)
I've read somewhere that you can create a new context in the thread and share resources with the main one, but how would that work without creating a new window?[/QUOTE]
Your platform/language matters here.
I'm guessing it's not C/C++ with posix threads because then sharing a context would be trivial.
Also, remember that OpenGL isn't thread-safe. You need a central mutex for all OpenGL usage. Whenever a thread needs to work in OpenGL, lock the mutex, do [i]everything[/i] that needs to be done all at once (don't let other threads interrupt it in the middle), then unlock the mutex.
[QUOTE=ROBO_DONUT;32716821]Your platform/language matters here.
I'm guessing it's not C/C++ with posix threads because then sharing a context would be trivial.
Also, remember that OpenGL isn't thread-safe. You need a central mutex for all OpenGL usage. Whenever a thread needs to work in OpenGL, lock the mutex, do [i]everything[/i] that needs to be done all at once (don't let other threads interrupt it in the middle), then unlock the mutex.[/QUOTE]
C++ with MinGW.
I haven't tried mutexing OpenGL yet, maybe that causes the atioglxx.dll crash.
Going to take a while until I see aresult though, I'll have to rewrite the superbible GLBatch class.
It's been a while since I've used Windows threads (and all I remember was it being an awful experience), but I think it's the same general principle. Each thread has access to everything the other thread does. So if you already have an OpenGL context, both threads should be able to use it.
Just, again, make sure that [i]every[/i] shared resource is locked through a mutex before access. This doesn't just apply to OpenGL contexts.
The other way is to keep all the OpenGL stuff contained in one thread, and simply pass the raw data to the OpenGL thread. I/O and decoding takes a lot more time than loading the data into VRAM, so you'll still get a nice performance boost.
Googling it, there seems to be a lot of information saying that each thread has its own context. I'm not sure how true this is, however. I remember writing a program a while back using OpenGL 1.1 that would decode video with FFMPEG in one thread and draw it to a spinning cube in another. I [i]think[/i] that I was using OpenGL calls in both threads, but I'm not entirely sure.
[QUOTE=ROBO_DONUT;32717178]It's been a while since I've used Windows threads (and all I remember was it being an awful experience), but I think it's the same general principle. Each thread has access to everything the other thread does. So if you already have an OpenGL context, both threads should be able to use it.
Just, again, make sure that [i]every[/i] shared resource is locked through a mutex before access. This doesn't just apply to OpenGL contexts.[/QUOTE]
I know about that, but thanks. I just thought that OpenGL crashes on purpose when accessed from a different thread.
[QUOTE=ROBO_DONUT;32717178]The other way is to keep all the OpenGL stuff contained in one thread, and simply pass the raw data to the OpenGL thread. I/O and decoding takes a lot more time than loading the data into VRAM, so you'll still get a nice performance boost.[/QUOTE]
That was my initial plan, but would complicate a lot of stuff. It will be my second option after I know if mutexing OpenGL works or not.
So I've just started to get back into C++, and I've run into this problem with trimming strings:
[cpp]
// all this code should be fine
#include <string>
using namespace std;
const string whiteSpaces = " \f\n\r\t\v";
void trimRight( string& str,
const string& trimChars = whiteSpaces )
{
string::size_type pos = str.find_last_not_of( trimChars );
str.erase( pos + 1 );
}
void trimLeft( string& str,
const string& trimChars = whiteSpaces )
{
string::size_type pos = str.find_first_not_of( trimChars );
str.erase( 0, pos );
}
void trim( string& str, const string& trimChars = whiteSpaces )
{
trimRight( str, trimChars );
trimLeft( str, trimChars );
}
[/cpp]
so I pulled that code off somewhere to trim strings, and when I try to use it like this,
[cpp]string str = " test "; trim(str);[/cpp]
... I get:
[code]error C2660: 'trim' : function does not take 1 arguments[/code]
even though the 'trimChars' argument is already a default argument.
Any ideas?
Hi! I was wondering if someone could point me towards a good lua interpreter? Thanks.
(probably dosent matter, but I plan to use lua 5.1.1.)
[QUOTE=Garb;32719442]Hi! I was wondering if someone could point me towards a good lua interpreter? Thanks.
(probably dosent matter, but I plan to use lua 5.1.1.)[/QUOTE]
Just use the Lua 5.1.4 one that comes with lua 5.1.4?
[QUOTE=Garb;32719442]Hi! I was wondering if someone could point me towards a good lua interpreter? Thanks.
(probably dosent matter, but I plan to use lua 5.1.1.)[/QUOTE]
What about LuaJIT?
Is there a way to extract a type char substring out of a regular string in C++?
Forgot to mention I can't use arrays (for a class -.- professor is being stubborn)
I'm doing a little game for Visual Basic 2010 for my class in HS, and I need some help
so the player is halted at a point and must press a button multiple times before he is allowed to pass.
So the code for the player is
[code]knight1.left += 10
knight1.left >= 474 then
knight.1left +=0 [/code]
how do I make it so the player has to repetitiveness press a button, say 5 times before ".left += 10" is allowed again?
Sup guys.
I just started learning C with K&R's book.
And I noticed something I found odd.
One line of the example code is like this:
printf("%3d %6.1f\n", fahr, (5.0/9.0)*(fahr-32));
Now, why would one use the %3d and %6.1f thing if you could just put the variables right into printf?
[QUOTE=Feihc;32720197]Is there a way to extract a type char substring out of a regular string in C++?
Forgot to mention I can't use arrays (for a class -.- professor is being stubborn)[/QUOTE]
If by "regular string" you mean std::string, you can use std::string::substr() to get the substring, then std::string::c_str() to get the C-style char* string.
Sorry, you need to Log In to post a reply to this thread.