473,242 Members | 1,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,242 software developers and data experts.

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.settexture(0,texA)
and
PvDev.settexture(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 1361
x
Better mention that I am using VB DotNet 2005 too.
thanks.

"x" <si**********@yahoo.co.ukwrote in message
news:5x******************@fe1.news.blueyonder.co.u k...
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.settexture(0,texA)
and
PvDev.settexture(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 : InverseZRotWorld;
float4x4 matWorldViewProjection;
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,matWorldViewProjection);

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_ps_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_ps_main();
}

}

"x" <si**********@yahoo.co.ukwrote in message
news:5x******************@fe1.news.blueyonder.co.u k...
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.settexture(0,texA)
and
PvDev.settexture(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
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...
0
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
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
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...
22
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...
2
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...
2
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...
4
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...
7
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.