Gaussian Blur for TGB
by Holmida · in Torque Game Builder · 09/05/2011 (9:12 am) · 8 replies
I've been looking for some kind of Gaussian Blur effect to add to my game and prototypes (TGB 1.7.5), and I found this thread in the Resources section of TDN.
I created the necessary files and began the implementation. After compiling the project with visual studio, everything's fine, but when initiating my game prototype, the console.log says "Unable to instantiate non-conobject class t2dBlurEffect", and the error is related to this part of the game.cs code:
Maybe I'm not storing the t2dBlurEffect.h and t2dBlurEffect.cpp within the correct directory? (In the Visual Studio project, I included them in TGBGame-Source-T2D, and the Windows directory is C:Program Files (x86)-Torque-Torque Game Builder 1.7.5 Pro-engine-source-T2D. My game test directory is C:\Program Files (x86)\Torque\Torque Game Builder 1.7.5 Pro\games\Platformer)
I created the necessary files and began the implementation. After compiling the project with visual studio, everything's fine, but when initiating my game prototype, the console.log says "Unable to instantiate non-conobject class t2dBlurEffect", and the error is related to this part of the game.cs code:
new t2dBlurEffect() {
Position = "37.500 -0.000";
size = "25.000 75.000";
BlurFactor = "2.0";
};Maybe I'm not storing the t2dBlurEffect.h and t2dBlurEffect.cpp within the correct directory? (In the Visual Studio project, I included them in TGBGame-Source-T2D, and the Windows directory is C:Program Files (x86)-Torque-Torque Game Builder 1.7.5 Pro-engine-source-T2D. My game test directory is C:\Program Files (x86)\Torque\Torque Game Builder 1.7.5 Pro\games\Platformer)
About the author
#2
"Unable to instantiate non-conobject class t2dBlurEffect"
Maybe is some kind of file executing in my game.cs file (the Windows directory for those files is C:Program Files (x86)-Torque-Torque Game Builder 1.7.5 Pro-engine-source-T2D)? This is how I coded it:
09/09/2011 (11:07 am)
I did so, and it still gives me the same command line error."Unable to instantiate non-conobject class t2dBlurEffect"
Maybe is some kind of file executing in my game.cs file (the Windows directory for those files is C:Program Files (x86)-Torque-Torque Game Builder 1.7.5 Pro-engine-source-T2D)? This is how I coded it:
exec( "./Box2dScene.cs" );
exec( "~/engine/source/T2D/t2dBlurEffect.h" );
exec( "~/engine/source/T2D/t2dBlurEffect.cpp" );
function startGame(%level)
{
exec("./playerClass.cs");
Canvas.setContent(mainScreenGui);
Canvas.setCursor(DefaultCursor);
new ActionMap(moveMap);
moveMap.push();
$enableDirectInput = true;
activateDirectInput();
enableJoystick();
sceneWindow2D.loadLevel(%level);
%new = new t2dBlurEffect() {
Position = "37.500 -0.000";
size = "25.000 75.000";
BlurFactor = "2.0"; };
}
#3
09/09/2011 (11:35 am)
After adding them to the directory, did you add them to the project within Visual Studio? Just putting the files in the directory won't get them compiled and added to the exe. And you need to make sure you copy the compiled exe to your game directory and use that exe so it has the new code in it.
#4
"In the Visual Studio project, I included them in TGBGame-Source-T2D"
09/09/2011 (12:14 pm)
Yes, I did. Quoting myself from the 1st post:"In the Visual Studio project, I included them in TGBGame-Source-T2D"
#5
Edit: Maybe for debugging sake, try creating a new project to test it? I'm not sure at this point : (
09/09/2011 (2:23 pm)
I believe that you need to add the files to two different project's T2D directories and compile in order for the object to work both in the scene editor and the simulation. Look for the other project with a T2D directory.Edit: Maybe for debugging sake, try creating a new project to test it? I'm not sure at this point : (
#6
EDIT:
09/10/2011 (9:29 am)
Yeah, my Visual Studio solution has 2 projects with T2D directories: TGBGame and Torque Game Builder. I added the files to both of them, and when compiling it gives me no errors, although the console.log of my game executable keeps saying "unable to instantiate non-conobject class t2dBlurEffect".EDIT:
Quote:Maybe for debugging sake, try creating a new project to test it? I'm not sure at this point : (I'll try this, just to check this is not only related to my current project.
#7
09/11/2011 (7:10 am)
Just to make it clear - do you have your new executable under game directory?
#8
Edit: Fixed my problem.
Essentially, it was pretty much as Justin Proffitt said. There are two separate projects in the solution that need to have the source added to them. Once I did so and recompiled, it worked.
10/06/2011 (3:24 pm)
Did you ever get any resolution on this? I'm having a similar problem, but not with the blur resource. I just posted about it here.Edit: Fixed my problem.
Essentially, it was pretty much as Justin Proffitt said. There are two separate projects in the solution that need to have the source added to them. Once I did so and recompiled, it worked.
Torque Owner Robert Fritzen
Phantom Games Development
You are not setting this to anything.
Either do %new = new t2dBlurEffect() {for local function scope use
or provide it a name so you can globally use it: new t2dBlurEffect(MyBlur) {