RE: GL_ARB_FRAGMENT_PROGRAM vs CG_PROFILE_FP30

"Pat Brown \(OpenGL\)" <[email protected]>
Newsgroups gmane.games.devel.opengl
Organization Fat City Network Services, San Diego, California
Message-ID <[email protected]>
BTW, I just tested this out, and it appears to work.

I think what is happening with your original code is that "(fc,bc)" is treated as a parenthesized expression that includes a comma operator, which is the C sequential evaluation operator.  This evaluates "fc", then "bc", and the result is simply the scalar "bc".  This gets cast up to a float2 in the assignment.  There probably should be a warning here, and I've filed a bug report.

-----Original Message-----
Sent: Tuesday, March 15, 2005 3:27 PM
To: [email protected]
Cc: Pat Brown (OpenGL)

I think you need to use a constructor to build your vector:

  float2 dependcoor = float2(fc,bc);

Does that fix the problem?

Pat

-----Original Message-----
Sent: Tuesday, March 15, 2005 2:46 PM
To: Multiple recipients of list OPENGL-GAMEDEV-L

Thx.... Stephen


how could this code

const char PCG_CODE[] =
"float4 main(float4 FrontCoords : TEXCOORD0, float4 BackCoords : TEXCOORD1, 
const uniform sampler3D FrontTexture : TEXUNIT0, const uniform sampler3D 
BackTexture : TEXUNIT1, const uniform sampler2D DependentTexture : 
TEXUNIT2): COLOR\n\
{\n\
 float4 OUT;\n\
  float fc,bc;\n\
  fc = tex3D(FrontTexture, FrontCoords).r;\n\
  bc = tex3D(BackTexture, BackCoords).r;\n\
  float2 dependcoor = (fc,bc);\n\
  OUT = f4tex2D(DependentTexture, dependcoor);\n\
 return OUT;\n\
}";

generates this crap code???...


!!FP1.0
# cgc version 1.3.0001, build date Jan  7 2005 14:01:35
# command line args: -q -profile fp30 -entry main
#vendor NVIDIA Corporation
#version 1.0.02
#profile fp30
#program main
#semantic main.FrontTexture : TEXUNIT0
#semantic main.BackTexture : TEXUNIT1
#semantic main.DependentTexture : TEXUNIT2
#var float4 FrontCoords : $vin.TEX0 : TEX0 : 0 : 1
#var float4 BackCoords : $vin.TEX1 : TEX1 : 1 : 1
#var sampler3D FrontTexture : TEXUNIT0 : texunit 0 : 2 : 1
#var sampler3D BackTexture : TEXUNIT1 : texunit 1 : 3 : 1
#var sampler2D DependentTexture : TEXUNIT2 : texunit 2 : 4 : 1
#var float4 main : $vout.COL : COL : -1 : 1
TEX   R0.x, f[TEX1], TEX1, 3D;
TEX   o[COLR], R0.x, TEX2, 2D;
END
# 2 instructions, 1 R-regs, 0 H-regs


We r crear the they are not equivalents...
Now, how to fix it?...
I prefer the compiler says "error" instead of give me this crap code... and 
running it... It think, I am not using the commands properly...
THX
Mr. RIX



----- Original Message ----- 
To: "Multiple recipients of list OPENGL-GAMEDEV-L" 
<[email protected]>
Sent: Tuesday, March 15, 2005 10:11 AM


> Rhadamés Carmona wrote:
>> Hello Guy
>>
>> I tested arb_fragment program and CG fragment program, and the results 
>> are not the same. I kept the rest of the code. CG looks darker. Any 
>> clue?. I am using pre-integration volume rendering with 3D textures. 
>> Texture0 and 1 are the same source 3D texture... texture2 is the 
>> dependent 2D texture.
>
> Have you compiled the Cg code with the stand-alone compiler and looked at
> the machine-code it generates?  I'm sure that would give you a clue.
>
> -----------------------------------------------------------------------
> The second law of Frisbee throwing states: "Never precede any maneuver
> by a comment more predictive than "Watch this!"...it turns out that
> this also applies to writing Fragment Shaders.
> -----------------------------------------------------------------------
> Steve Baker                      (817)619-2657 (Vox/Vox-Mail)
> L3Com/Link Simulation & Training (817)619-2466 (Fax)
> Work: [email protected]           http://www.link.com
> Home: [email protected]       http://www.sjbaker.org
>
> ----- 
> FAQ and OpenGL Resources at:
>  http://www.geocities.com/SiliconValley/Hills/9956/OpenGL
>
> -- 
> Author: Stephen J Baker
>  INET: [email protected]
>
> Fat City Hosting, San Diego, California -- http://www.fatcity.com
> ---------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: [email protected] (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
> (or the name of mailing list you want to be removed from).  You may
> also send the HELP command for other information (like subscribing). 

----- 
FAQ and OpenGL Resources at:
  http://www.geocities.com/SiliconValley/Hills/9956/OpenGL

-- 
Author: =?iso-8859-1?Q?Rhadam=E9s_Carmona?=
  INET: [email protected]

Fat City Hosting, San Diego, California -- http://www.fatcity.com
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [email protected] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
----- 
FAQ and OpenGL Resources at:
  http://www.geocities.com/SiliconValley/Hills/9956/OpenGL

-- 
Author: Pat Brown \(OpenGL\)
  INET: [email protected]

Fat City Hosting, San Diego, California -- http://www.fatcity.com
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [email protected] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB OPENGL-GAMEDEV-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.