473,657 Members | 2,432 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB Dotnet Shader passing textures from VB to shader help.

x
Still fairly new at this, I have been trying to find out how to compile and
effect with multiple samplers.

Been able to find loads of examples that show the HSL code once the samplers
are loaded, but not how to get the textures from VB into the shader.

If i set up two samplers in the shader with no associated texture then when
I compile the shader from string works fine.

but when the shader actually runs both sample the same texture rather than
different ones.

I can pass a texture in as a parameter but get told I cant sample it
intrinsically.

All the examples I can find seem to assume you know how to do this already.
Very frustrating.

I know you can use the commands:
PvDev.settextur e(0,texA)
and
PvDev.settextur e(1.texB)
and that this presumably sets up two samplers but as mentioned, both sample
texA. Obviously I am missing something any ideas?

thanks in advance.
Aug 21 '06 #1
3 1385
x
Better mention that I am using VB DotNet 2005 too.
thanks.

"x" <si**********@y ahoo.co.ukwrote in message
news:5x******** **********@fe1. news.blueyonder .co.uk...
Still fairly new at this, I have been trying to find out how to compile
and effect with multiple samplers.

Been able to find loads of examples that show the HSL code once the
samplers are loaded, but not how to get the textures from VB into the
shader.

If i set up two samplers in the shader with no associated texture then
when I compile the shader from string works fine.

but when the shader actually runs both sample the same texture rather than
different ones.

I can pass a texture in as a parameter but get told I cant sample it
intrinsically.

All the examples I can find seem to assume you know how to do this
already. Very frustrating.

I know you can use the commands:
PvDev.settextur e(0,texA)
and
PvDev.settextur e(1.texB)
and that this presumably sets up two samplers but as mentioned, both
sample texA. Obviously I am missing something any ideas?

thanks in advance.


Aug 21 '06 #2
x
If I change the value indicated between TEXCOORD0 and TEXCOORD1 i get it
sampling the different textures.
Is it not possible to use the same texture coordinates to sample two
different textures?
Changing the other TEXCOORDn values doesnt seem to make any difference, just
the one in the vertex shader.

float4x4 matInvZRotWorld : InverseZRotWorl d;
float4x4 matWorldViewPro jection;
float4x4 matPosObj;
float4x4 matInvRot;
float4x4 matZRot;
float Timer;
float Param;

sampler2D MainTex;
sampler2D Lookup;

struct VS_INPUT
{
float4 Position : POSITION;
float4 Normal : NORMAL;
float4 Color : COLOR;
float2 Texture : TEXCOORD1; // ****** IF I CHANGE HERE *******
};

struct VS_OUTPUT
{
float4 Position : POSITION0;
float2 TexC0 : TEXCOORD0;
float2 TexC1 : TEXCOORD1;
};

VS_OUTPUT main( VS_INPUT Input )
{
VS_OUTPUT Output;
// Rotate around the origin by an inverse of all the rotations to be
done.
float4 NewPos = Input.Position;

// Position it correctly in world space
NewPos = mul(NewPos,matW orldViewProject ion);

Output.Position = NewPos;
Output.TexC0 = Input.Texture;
Output.TexC1 = Input.Texture;

return( Output );
}

struct PS_INPUT
{
float2 Texc0 : TEXCOORD0;
float2 Texc1 : TEXCOORD1;
};
float4 Textured_Pass_0 _Pixel_Shader_p s_main( PS_INPUT Input ) : COLOR0
{
float4 Color = tex2D(Lookup, Input.Texc1);
return Color;
};


//--------------------------------------------------------------//
// Technique Section for Textured
//--------------------------------------------------------------//
technique Effect1
{
pass Pass_0
{
VertexShader = compile vs_2_0 main();
PixelShader = compile ps_2_0 Textured_Pass_0 _Pixel_Shader_p s_main();
}

}

"x" <si**********@y ahoo.co.ukwrote in message
news:5x******** **********@fe1. news.blueyonder .co.uk...
Still fairly new at this, I have been trying to find out how to compile
and effect with multiple samplers.

Been able to find loads of examples that show the HSL code once the
samplers are loaded, but not how to get the textures from VB into the
shader.

If i set up two samplers in the shader with no associated texture then
when I compile the shader from string works fine.

but when the shader actually runs both sample the same texture rather than
different ones.

I can pass a texture in as a parameter but get told I cant sample it
intrinsically.

All the examples I can find seem to assume you know how to do this
already. Very frustrating.

I know you can use the commands:
PvDev.settextur e(0,texA)
and
PvDev.settextur e(1.texB)
and that this presumably sets up two samplers but as mentioned, both
sample texA. Obviously I am missing something any ideas?

thanks in advance.


Aug 21 '06 #3
x
Bah further investigation shows that even though I get a different result
using TEXCOORD1 it is erroneous data, probably because i don't pass a
TECOORD1 in my vertex structure. so back to square one.
Aug 21 '06 #4

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

Similar topics

58
10121
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of code... TCHAR myArray; DoStuff(myArray);
0
1095
by: Michael Schneider | last post by:
Just curious, is anyone using python for OGL 2.0 shader language development? Which lib are you using? Thanks, Mike
5
1577
by: Michael Sgier | last post by:
Hello i don't understand the visibility/passing of variables. I've in texture.h: class CTexture { public: unsigned int texID; GLuint texture;
6
2457
by: varkey.mathew | last post by:
Dear all, Bear with me, a poor newbie(atleast in AD).. I have to authenticate a user ID and password for a user as a valid Active Directory user or not. I have created the IsAuthenticated function exactly as outlined in the below link. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT02.asp
22
25575
by: Arne | last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart from a pocket PC to a webservice. What is the right datatype? II have tried dataset as a datatype, but I can't get it to compile. <WebMethod()> _ Public Function VerifySku(ByVal skus As XmlDataDocument) As DataSet Test program : Dim cartSet As DataSet cartSet = ws.VerifySku(cartSet)
2
3006
by: MR | last post by:
i am looking into how to pass information between two applications. one is a java app (not java.net) and the other is dotNet based v1.1 (c#). both apps will probably run on the same machine. i don't know very much about java or its capabilities. normally i would use queues or even windows messages, but because the other app is java none of this is available, or is it? what tools are available that would enable the IPC? are there any...
2
1921
by: Feniks | last post by:
Hi, perhaps You know how to use volume textures in DirectX with c# ? I need an example in c#. As I was looking through directx's classes there is such class as VolumeTexture, in connection with TextureLoader.FromVolumeFile loading seems to be quite simple. But how to enforce CustomVertex to use 3 tex coordinates ? Regards Bartek
4
5281
by: darrell | last post by:
I recently wrote a program in Access VBA that contains this snippet of code: For i = 1 to TotalBanks With Me("txtBank" & Chr(i + 64)) .BackColor = vbBlue .ForeColor = vbWhite End With Next i The above code was tested and works.
7
2073
by: Peted | last post by:
Hi, im hoping someone cane provide or point to a definitive accurate explantion of dotnet compilation when run and the best way to optimise peformace when dotnet code is run first time and execution speed after compliation. Ive searched the net and seem to find various opinions on what actually happens when you compile and run a c# dotnet application. What im looking for is basicly how to make dotnet dlls load as fast as
0
8395
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...
0
8826
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7330
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4155
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
4306
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1615
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.