Hi,
I use an HLSL document for my 3D application.
I can set a parameter but i cant get it back. When i call the paramater the value which i send before is returned.
Do you know how can i get parameters from HLSL document. If you want i can send the used code block .
Thanks...
High Level Shader Language(HLSL) getting parameter?
-
erbolat
- Gnoblar
- Posts: 3
- Joined: Sun Mar 13, 2005 1:43 am
- sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
- Contact:
-
erbolat
- Gnoblar
- Posts: 3
- Joined: Sun Mar 13, 2005 1:43 am
I am trying to get a float parameter.
For example;
I have a box. And i give it a color by randomly.
There is a paramater lets say
float x;
At first i set it 0 from my .cpp code( with SetParamater command);
if any of the pixels get a red color the parameter x becomes 1. And of the HLSL running i want to check if there is any red color and according to this i want do something else...
After the setting parameter and HLSL running i call back it with GetParameter command (I know it is an handle). But the value is always 0 which i assign before. I can see that my application has red colors, too.
How can i solve this porblem?
For example;
I have a box. And i give it a color by randomly.
There is a paramater lets say
float x;
At first i set it 0 from my .cpp code( with SetParamater command);
if any of the pixels get a red color the parameter x becomes 1. And of the HLSL running i want to check if there is any red color and according to this i want do something else...
After the setting parameter and HLSL running i call back it with GetParameter command (I know it is an handle). But the value is always 0 which i assign before. I can see that my application has red colors, too.
How can i solve this porblem?
-
nfz
- OGRE Retired Team Member

- Posts: 1263
- Joined: Wed Sep 24, 2003 4:00 pm
- Location: Halifax, Nova Scotia, Canada
-
dorvo
- Halfling
- Posts: 68
- Joined: Tue Nov 02, 2004 8:01 pm
If I understand correctly how shaders work, if you pass a value into the shader and it gets modified in either the vertex shader or the fragment shader, it doesn't get stored anywhere... during the next time the frame is rendered, it still takes the data from the vertex buffer (or where ever you have it stored).
So, what nfz said should hold true. Everything that you pass into the shader, if it gets modified, that modified value is only temporary.
But, I could be completely off. This is just what I've deduced from reading books and articles.
So, what nfz said should hold true. Everything that you pass into the shader, if it gets modified, that modified value is only temporary.
But, I could be completely off. This is just what I've deduced from reading books and articles.
- monster
- OGRE Community Helper

- Posts: 1098
- Joined: Mon Sep 22, 2003 2:40 am
- Location: Melbourne, Australia
- Contact:
I believe that some of the approaches that do this (e.g. collision detection on the GPU) work by getting the fragment shader top write to a special texture then reading that texture back into main memory and decoding the pixel values into return parameters.
What is it that you're trying to do? There's almost certainly a simpler approach.
What is it that you're trying to do? There's almost certainly a simpler approach.