473,804 Members | 3,638 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to pass a float4 to hlsl using vb

Hi,

This is a Direct3D-related question but I am posting it in here as it
is more VB-specific.

I have an effect file that I am trying to set the values for. For
example:

fx.SetValue("ma tView", _viewMatrix)
fx.SetValue("ma tViewProjection ", _projectionMatr ix)
fx.SetValue("fS pecularPower", 25)
fx.SetValue("ba se_Tex", t._texture(0))
That all works fine, but I cannot for the life of me get a float3 or
float4 across, example:

Dim diffuse(3) As Single
diffuse(0) = 0 : diffuse(1) = 1 : diffuse(2) = 0 : diffuse(3) = 0
fx.SetValue("fv Diffuse", diffuse)

I've also tried setting diffuse to an upperbound of 4.

This all fails with the meaningless "Error in the application". I
thought a Float4 was simply an array of four floating point (type
Single) numbers? I have the same issue with a Float3, I've tried all
I
can think of to pass the information over but no luck. Here is how
fvDiffuse is set up in the .fx file:

float4 fvDiffuse
<
string UIName = "fvDiffuse" ;
string UIWidget = "Color";
bool UIVisible = true;
= float4( 0.89, 0.89, 0.89, 1.00 );
Isn't this just an array of four values of type Single?

Thanks in advance,

Richy

Feb 18 '07 #1
5 2263
"Richy" <mo*********@gm ail.comschrieb
Hi,

This is a Direct3D-related question but I am posting it in here as
it is more VB-specific.

I have an effect file that I am trying to set the values for. For
example:

fx.SetValue("ma tView", _viewMatrix)
fx.SetValue("ma tViewProjection ", _projectionMatr ix)
fx.SetValue("fS pecularPower", 25)
fx.SetValue("ba se_Tex", t._texture(0))
I looked at the MDX documentation but I don't find a single method called
SetValue that takes a string as the first argument. What is fx? If it's an
Effect then the first arg is always an EffectHandle, not a String. Maybe I
missed something.

That all works fine, but I cannot for the life of me get a float3 or
float4 across, example:

Dim diffuse(3) As Single
diffuse(0) = 0 : diffuse(1) = 1 : diffuse(2) = 0 : diffuse(3) = 0
fx.SetValue("fv Diffuse", diffuse)

I've also tried setting diffuse to an upperbound of 4.

This all fails with the meaningless "Error in the application".
In the MDX group the default questions are:
Debug runtime installed? Unmanaged debugging enabled? What does the debug
output say?

I you won't get a solution here, there is also
m.p.win32.progr ammer.directx.m anaged.
I
thought a Float4 was simply an array of four floating point (type
Single) numbers? I have the same issue with a Float3, I've tried all
I
can think of to pass the information over but no luck. Here is how
fvDiffuse is set up in the .fx file:

float4 fvDiffuse
<
string UIName = "fvDiffuse" ;
string UIWidget = "Color";
bool UIVisible = true;
= float4( 0.89, 0.89, 0.89, 1.00 );

Isn't this just an array of four values of type Single?

Thanks in advance,

Richy
Feb 18 '07 #2
>
I looked at the MDX documentation but I don't find a single method called
SetValue that takes a string as the first argument. What is fx? If it's an
Effect then the first arg is always an EffectHandle, not a String. Maybe I
missed something.
Weird I know, the doco says the first parameter is of type
Microsoft.Direc tX.Direct3D.Eff ectHandle, but one can supply the name
of the property as a string and it works fine.
>
In the MDX group the default questions are:
Debug runtime installed? Unmanaged debugging enabled? What does the debug
output say?

I you won't get a solution here, there is also
m.p.win32.progr ammer.directx.m anaged.
Yeah I tried that but they suggested a VB group as it's more related
to VB, as in it is the data structure itself and how it can be passed
to the subroutine. One of the parameter types (for the second
parameter) is a Single() array but that does not work for me, I
thought somebody might be able to help with this. I've created a
structure containing three singles (which should be the equivalent of
a FLOAT3) but it cannot be passed across.

Thanks anyway :)

Feb 18 '07 #3
"Richy" <mo*********@gm ail.comschrieb

I looked at the MDX documentation but I don't find a single method
called SetValue that takes a string as the first argument. What is
fx? If it's an Effect then the first arg is always an
EffectHandle, not a String. Maybe I missed something.

Weird I know, the doco says the first parameter is of type
Microsoft.Direc tX.Direct3D.Eff ectHandle, but one can supply the name
of the property as a string and it works fine.
Strange. I can not even compile it.

In the MDX group the default questions are:
Debug runtime installed? Unmanaged debugging enabled? What does
the debug output say?

I you won't get a solution here, there is also
m.p.win32.progr ammer.directx.m anaged.

Yeah I tried that
In the group mentioned? I only see one posting in the other (unmanaged)
group.
but they suggested a VB group as it's more related
to VB, as in it is the data structure itself and how it can be
passed to the subroutine. One of the parameter types (for the second
parameter) is a Single() array but that does not work for me, I
thought somebody might be able to help with this. I've created a
structure containing three singles (which should be the equivalent
of a FLOAT3) but it cannot be passed across.

Thanks anyway :)
You said you get an "error in application". Is this a runtime error? And
again: Debug runtime installed? Unmanaged debugging enabled? What does the
debug output say?
Armin

Feb 18 '07 #4
>
I you won't get a solution here, there is also
m.p.win32.progr ammer.directx.m anaged.
Yeah I tried that

In the group mentioned? I only see one posting in the other (unmanaged)
group.
Oops I did it to the .graphics not the .managed, I'll try the .managed
>
You said you get an "error in application". Is this a runtime error? And
again: Debug runtime installed? Unmanaged debugging enabled? What does the
debug output say?

Armin
I am using DirectX version .Net 1.0.900.0 but I don't think I am using
the Debug run-time, how can I tell and if I am not where do I get it
from? It is all included in the SDK I would have downloaded to get
DirectX?

The "error in the application" is a run-time error [5]

Thanks,

Richy

Feb 18 '07 #5
"Richy" <mo*********@gm ail.comschrieb
I you won't get a solution here, there is also
m.p.win32.progr ammer.directx.m anaged.
Yeah I tried that
In the group mentioned? I only see one posting in the other
(unmanaged) group.

Oops I did it to the .graphics not the .managed, I'll try the
.managed

You said you get an "error in application". Is this a runtime
error? And again: Debug runtime installed? Unmanaged debugging
enabled? What does the debug output say?

Armin

I am using DirectX version .Net 1.0.900.0
Of which file is this the version? I have several versions installed (over
the time) but the oldest I have is 1.0.2902.0. I suggest to download the
latest SDK if you haven't already. (be aware that un-/reinstalling resets
your customized IDE settings like toolbars and menus :-(
but I don't think I am
using the Debug run-time, how can I tell and if I am not where do I
get it from? It is all included in the SDK I would have downloaded
to get DirectX?

The "error in the application" is a run-time error [5]

If you install the SDK, it integrates in the IDE. In menu
Tools->Options->Debugging->DirectX you can switch between the Debug and
Retail version. You can do this also either in the control panel
("DirectX"), or, in the newest version (Dec 2006), it's in the start
menu -DirectX SDK -Utilities -DirectX Control panel.

In addition, you must enable "unmanaged debugging" in the project
properties. (configuration properties -debugging: [X] unmanaged debugging)

More see the DirectX Documentation: DirectX Software Development Kit ->
DirectX SDK Programming Guide -Programming DirectX with C/C++ -Debugging
DirectX Applications

(the unmanaged documentation is no real help because it's totally incomplete
(and will never be completed))
If you enabled the above, you will get additional information in the output
window in the IDE if a directX error occurs. Don't know if this is one, but
you can this first.

More about it in the MDX group. :-)
Armin

Feb 19 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

110
9972
by: Mr A | last post by:
Hi! I've been thinking about passing parameteras using references instead of pointers in order to emphasize that the parameter must be an object. Exemple: void func(Objec& object); //object must be an object instead of
7
21643
by: Zlatko Matiæ | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the server ? Is it possible to use parameters in pass-through queries ? An additional question: Is it possible to connect to a database on MySQL or PostgreSQL using ADO ? Is it possible to execute pass-through queries with parameters, using ADO...
3
1620
by: Chris | last post by:
I have a modal (yes it must be modal) web page. I do this by having an empty frame that points to my main page (so that I can repost without new popups) I have to pass data to the child page from the parent and the only way I can figure to do it by the url. Please correct me if I'm wrong on that. When the data get to my frame I then have to pass the data to my child form, again through the url (i think). The only way I found to do...
3
12611
by: ILCSP | last post by:
Hello, I'm fairly new to the concept of running action pass through queries (insert, update, etc.) from Access 2000. I have a SQL Server 2000 database and I'm using a Access 2K database as my front end. I'm using a blank pass through query which gets the Transact-SQL part inserted from a button in my form. After inserting the Transact-SQL code into the pass through query, I 'open the recordset' to make the query run. However,...
5
7823
by: David++ | last post by:
Hi folks, I would be interested to hear peoples views on whether or not 'pass by reference' is allowed when using a Web Service method. The thing that troubles me about pass-by-reference into a WebService is that essentially we are passing an address of an object which resides on the 'local machine' i.e. a local machine object address. Surely when the WebService method is called and run 'on the server', the reference type will be...
1
5352
by: gouse | last post by:
Hi Friends, when I have convert the float4 data type to float8 data type it was lossing the value. The following are the commands i Have used. Plaese go through it. (1) TE TABLE tab1(id int PRIMARY KEY,val float4); (2) INSERT INTO tab1 VALUES(1,1.1); INSERT INTO tab1 VALUES(2,1.2); INSERT INTO tab1 VALUES(3,1.3);
13
3739
by: magickarle | last post by:
Hi, I got a pass-through query (that takes about 15 mins to process) I would like to integrate variables to it. IE: something simple: Select EmplID from empl_Lst where empl_lst.timestamp between !! And !! Not sure how to do so (should it be a query in Access or a macro) The connection would be ODBC.
12
11118
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms. Here is a newbie mistake that I found myself doing (as a newbie), and that even a master programmer, the guru of this forum, Jon Skeet, missed! (He knows this I'm sure, but just didn't think this was my problem; LOL, I am needling him) If...
21
1896
by: raylopez99 | last post by:
In the otherwise excellent book C# 3.0 in a Nutshell by Albahari et al. (3rd edition) (highly recommended--it's packed with information, and is a desktop reference book) the following statement is made: (p. 39: "The ref modifier is essential in implementing a swap method") This is untrue. The following program demonstrates it. See how method "func4Swap" does a swap of two int variables without using ref, but using a 'helper' class and...
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10076
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7616
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4297
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.