473,320 Members | 1,936 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,320 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 1364
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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...
1
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...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.