<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>Tagged with cg - NVIDIA Developer Forums</title>
      <link>http://forums.developer.nvidia.com/devforum/discussions/tagged/cg/feed.rss</link>
      <pubDate>Wed, 16 May 12 17:30:05 -0400</pubDate>
         <description>Tagged with cg - NVIDIA Developer Forums</description>
   <language>en-CA</language>
   <atom:link href="/devforum/discussions/taggedcg/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>Cg.framework 3.1 not working on XCode 3.2.6</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/8196/cg-framework-3-1-not-working-on-xcode-3-2-6</link>
      <pubDate>Mon, 14 May 2012 17:57:01 -0400</pubDate>
      <dc:creator>jdxjohn</dc:creator>
      <guid isPermaLink="false">8196@/devforum/discussions</guid>
      <description><![CDATA[I'm totally pulling my hair out on this one... I've installed Cg framework using the installer on my Snow Leopard Intel MacBook and from the command line running "gcc -c test.cpp" on the following works fine:<br /><code><a href="/devforum/search?Search=%23include&amp;Mode=like">#include</a> &lt;Cg/cg.h&gt;<br /><br />void f() {<br /> CGContext context = cgCreateContext();<br />}</code><br />But in Xcode 3.2.6 I simply cannot get it to work, it cannot find <em></em>. I've created a C++ console app and simply added <a href="/devforum/search?Search=%23include&amp;Mode=like">#include</a>  to the hello world cpp file. I tried adding the framework to the target but it makes no difference.<br />If I start typing <em><a href="/devforum/search?Search=%23include&amp;Mode=like">#include</a> </em> Xcode auto-suggests the file, or for any other installed framework, but not Cg.<br /><br />I'm totally out of ideas why gcc with no command line parameters can find the framework but Xcode can't. I even tried moving the framework from /Library/Frameworks to System/Library/Frameworks but no change... it also doesn't show up in the default list of frameworks to add to the project.<br /><br />I'm not an experienced Mac developer and I don't know if thre's any magic about frameworks, but to all intensive purposes XCode simply doesn't seem to think /Library/Frameworks/Cg.framework <em>is</em> a framework.<br /><br />If anyone can shed some light on this I'd be hugely grateful, I've been banging my head on this wall for days now and can find nothing on the web about it and am basically sitting here with code I can't build for no obvious reason!!<br /><br />I am using CG 3.1, v3.1.0010 installed on MacOSX 10.6 with XCode 3.2.6.]]></description>
   </item>
      <item>
      <title>Cg Runtime : CG_FILE_READ_ERROR</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/8126/cg-runtime-cg_file_read_error</link>
      <pubDate>Sun, 13 May 2012 08:34:27 -0400</pubDate>
      <dc:creator>eliyam30</dc:creator>
      <guid isPermaLink="false">8126@/devforum/discussions</guid>
      <description><![CDATA[Hi all, <br />Im having a trouble with CG context error: <br />when trying to create an effect I get :<br />err = "Cg runtime error: The file could not be read."<br />What Is necessarily needed for the success of creating an effect?<br /><br />Im trying to create the effect from the lump code i pasted down, <br />but for some reason it fails.<br />(The problem occurs only when trying to compile it from a specific call stack order)<br /><br />std::string test= <br />"// Vertex attribute interface:\n"<br />"struct APP2VP\n"<br />"{\n"<br />"  float4 position : POSITION;\n"<br />"  float4 Normal	: NORMAL;\n"<br />"  float4 UV		: TEXCOORD0;\n"<br />"};\n"<br />"// Varyings interface:\n"<br />"struct VP2FP \n"<br />"{\n"<br />"  float4 position : POSITION;\n"<br />"  float2 UV : TEXCOORD4;\n"<br />"};\n"<br /><br />"// VERTEX PROGRAM\n"<br />"VP2FP vp(APP2VP IN)\n"<br />"{\n"<br />"  VP2FP OUT;\n"<br />"  OUT.position = IN.position;\n"<br />"  OUT.UV = IN.UV.xy;\n"<br />"  return OUT;\n"<br />"}\n"<br />"// FRAGMENT PROGRAM\n"<br /><br /><br />"float4 fp(VP2FP IN) : COLOR\n"<br />"{\n"   <br />"  \n"<br />"  return float4(1,0,0,0);\n"<br />"}\n"<br />"technique render\n"<br />"{\n"<br />"  pass both\n"<br />"  {\n"<br />"    VertexProgram   = compile latest vp();\n"<br />"    FragmentProgram = compile latest fp();\n"<br />"  }\n"<br />"}\n";<br /><br />Thanks!<br /><br />Update:<br />If I paste the create from lump call :<br /><br /><code><br />cgfxHdl = CgFx::createFromLump( test ,m_searchPaths,err,failOnTexLoad );<br /></code>	<br /><code><br />cgfxHdl = CgFx::createFromLump( test ,m_searchPaths,err2,failOnTexLoad );<br /></code>	<br /><br />Than the second call succeeds! ]]></description>
   </item>
      <item>
      <title>How can I precompile a shader?</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/7911/how-can-i-precompile-a-shader</link>
      <pubDate>Sat, 05 May 2012 13:12:59 -0400</pubDate>
      <dc:creator>blitowitz</dc:creator>
      <guid isPermaLink="false">7911@/devforum/discussions</guid>
      <description><![CDATA[I want to precompile my shaders into a binary format so that I can load them up with my application later. When I use cgc.exe, I can only get it to output the shaders as assembly instructions in text, which seems much less efficient to process than raw binary data. Is this possible?]]></description>
   </item>
      <item>
      <title>texture sampling in a CG vertex shader</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/8036/texture-sampling-in-a-cg-vertex-shader</link>
      <pubDate>Thu, 10 May 2012 10:39:13 -0400</pubDate>
      <dc:creator>nicoteen</dc:creator>
      <guid isPermaLink="false">8036@/devforum/discussions</guid>
      <description><![CDATA[Hi guys,<br /><br />I am trying to access a texture in the vertex shader. So I need the tex2D-function. But the compiler says, that this function is not supported in my profile, which is vs_3_0(Dirext3d). In the internet I get two contradicting results on this topic:<br /><a href="http.developer.nvidia.com/Cg/tex2D.html">CG documentation</a> says that tex2D is supported in fragment programs. But for vertex programs it names only OpenGL-profiles. Nothing about Direct3D. <br />In the <a href="http://www.nvidia.in/object/General_FAQ.html#t3">General FAQ</a> it says "tex2D will be supported in the vs_3_0 vertex profile and beyond in HLSL and in Cg, as it is a requirement of Vertex Shaders 3.0 and beyond. Similar functionality will be available in Cg's OpenGL profiles."<br />I am using vs_3_0 but the compiler says, that tex2D is not supported. Am I doing something wrong?<br /><br />Using tex2D in a CG vertex shader compiled for OpenGL is working with the vp40 profile. So my hardware is definitely capable of doing a vertex texture fetch. But there are some reasons for using DirectX in my project.<br /><br />I also found the similar function tex2Dlod which is supported in vs_3_0. But it always returns zero and I am sure that the colors in the tetxure are not zero, because I use them in the pixel shader afterwards.<br /><br />So, what is the right way to acces a texture in a vertex shader on d3d?<br /><br />Greetings,<br />nicoteen]]></description>
   </item>
      <item>
      <title>Correct order of operations when enabling/disabling Cg shaders in OpenGL</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/7646/correct-order-of-operations-when-enablingdisabling-cg-shaders-in-opengl</link>
      <pubDate>Fri, 27 Apr 2012 15:12:43 -0400</pubDate>
      <dc:creator>redneon</dc:creator>
      <guid isPermaLink="false">7646@/devforum/discussions</guid>
      <description><![CDATA[I've started writing an Effect class which uses Cg shaders in OpenGL and I'm a bit confused about the order of operations when creating and rendering using Cg.<br /><br />Currently, my Effect class contains CGprogram, CGprofile and an array of CGparameter variables which get populated on loading the Effect similar to this:<br /><br /><code><br />m_vertexProfile = cgGLGetLatesProfile(CG_GL_VERTEX);<br />cgGLSetOptimalOptions(m_vertexProfile);<br />m_vertexProgram = cgCreateProgramFromFile(g_cgContext, CG_SOURCE, fileName, m_vertexProfile, entryPointName, NULL);<br />cgGLLoadProgram(m_vertexProgram);<br /><br />CGparameter param = cgGetFirstParameter(m_vertexProgram, CG_PROGRAM);<br />while (param)<br />{<br />	const char* paramName = cgGetParameterName(param);<br />	m_vertexParameters[m_vertexParamNum++] = param;<br />	param = cgGetNextParameter(param);<br />}<br /></code><br /><br />It's not exactly like this and this is only using a vertex shader but it contains the important code. Anyway, that's how I create the Effect and then when I want to use it during a render I use Enable() and Disable() functions before and after I draw the verts etc.<br /><br /><code><br />void Effect::Enable()<br />{<br />	cgGLBindProgram(m_vertexProgram);<br />	cgGLEnableProfile(m_vertexProfile);<br />}<br /><br />void Effect::Disable()<br />{<br />	cgGLUnbindProgram(m_vertexProfile);<br />	cgGLDisableProfile(m_vertexProfile);<br />}<br /></code><br /><br />I'm not sure if this is the correct way to do it, though. Is it correct to enable and disable the profile for each shader? More to the point, do I actually want a profile per shader? I'm using the same profile for each shader so surely I could just have a global one and use that?<br /><br />Any advice would be much appreciated.<br />]]></description>
   </item>
      <item>
      <title>Define multiple vertex output streams in geometry shader using CG</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/7451/define-multiple-vertex-output-streams-in-geometry-shader-using-cg</link>
      <pubDate>Tue, 24 Apr 2012 03:03:15 -0400</pubDate>
      <dc:creator>MCP</dc:creator>
      <guid isPermaLink="false">7451@/devforum/discussions</guid>
      <description><![CDATA[Hello,<br /><br />i want to stream out vertex attributes to different output streams in a cg geometry shader. Therefore i use the glTransformFeedbackStreamAttribsNV function (<a href="http://www.opengl.org/registry/specs/ARB/transform_feedback3.txt">http://www.opengl.org/registry/specs/ARB/transform_feedback3.txt</a>) to set output attributes and target streams . Now i need to define which data goes to which stream in the geometry shader. As described in the spec we can use something like:<br /><code><br />layout(stream = 0) out vec4 position;<br />layout(stream = 0) out vec4 texcoord;<br />layout(stream = 1) out vec4 normal;<br /></code><br />in glsl. How can we define the output streams in cg(fx)?<br /><br />- MCP<br />]]></description>
   </item>
      <item>
      <title>DirectX 11 Tesselation shaders in Cg</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/7411/directx-11-tesselation-shaders-in-cg</link>
      <pubDate>Mon, 23 Apr 2012 05:08:52 -0400</pubDate>
      <dc:creator>Knuckledust</dc:creator>
      <guid isPermaLink="false">7411@/devforum/discussions</guid>
      <description><![CDATA[I am working on a DirectX11 engine with Cg, but there are no details online on how the hull and domain shader syntax works in and no examples, at least none I could find.<br />Can anyone give me an example or a link to the shader syntax?]]></description>
   </item>
      <item>
      <title>I need a shader</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/6641/i-need-a-shader</link>
      <pubDate>Tue, 03 Apr 2012 07:52:38 -0400</pubDate>
      <dc:creator>Kamlah</dc:creator>
      <guid isPermaLink="false">6641@/devforum/discussions</guid>
      <description><![CDATA[Hi All,<br />I would like to get some help. I work in a TV as a graphic artist. Here we use a virtual studio system, where I need to create or somehow solve the problem showing frozen glass like material. The point is that the objects behind need to be blured. I found a good example here: <a href="http://www.polycount.com/forum/showthread.php?t=87743" target="_blank" rel="nofollow">http://www.polycount.com/forum/showthread.php?t=87743</a><br />The first picture shows  some teapots behind a glasslike surface. Thats what I need.<br />My biggest problem is that iam a total lama for the Cg topic. I started to learn and go into deep into the topic, but now i see that it is much more complex as i thought.<br />So i would be really thankful ...<br />The studio render engine use Nvidia cards but I dont know the exact parameters now. If necessary i look for it.<br />thx <br />KG  ]]></description>
   </item>
      <item>
      <title>PrimitiveID in CG Tessellation Shader</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/7191/primitiveid-in-cg-tessellation-shader</link>
      <pubDate>Tue, 17 Apr 2012 13:35:26 -0400</pubDate>
      <dc:creator>Henry Schaefer</dc:creator>
      <guid isPermaLink="false">7191@/devforum/discussions</guid>
      <description><![CDATA[Hello,<br /><br />i need access to the currently processed primitive in the tessellation control/domain shader. HLSL provides SV_PrimitiveID and GLSL gl_PrimitiveID for that purpose. What is the CG equivalent?<br /><br />Henry]]></description>
   </item>
      <item>
      <title>Geometry Shader CG</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/7161/geometry-shader-cg</link>
      <pubDate>Tue, 17 Apr 2012 05:01:56 -0400</pubDate>
      <dc:creator>oppid</dc:creator>
      <guid isPermaLink="false">7161@/devforum/discussions</guid>
      <description><![CDATA[Hi all, where can I find a great tutorial on CG geometry shader??? Thanks]]></description>
   </item>
      <item>
      <title>Questions about Cg UBO&#039;s</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/5956/questions-about-cg-ubos</link>
      <pubDate>Thu, 15 Mar 2012 10:36:26 -0400</pubDate>
      <dc:creator>Rick16bit</dc:creator>
      <guid isPermaLink="false">5956@/devforum/discussions</guid>
      <description><![CDATA[Hi again, some questions about UBO's (uniform buffer objects). Currently I'm doing many "cgSetParameter" calls, so I'm trying to move things to the GPU side and limit the calls to win a bit speed.<br />-------------------------------<br />* Does it matter <strong>how big</strong> the UBO is? <br />I mean does a large UBO consume more performance, bandwidth or passing time? Or maybe fixed sizes like 64 or 128 bytes fits better for caching purposes?<br /><br />* How big can a UBO be anyway? 4096 x 16 bytes or something?<br /><br />* Does the <strong>amount of UBO's applied at the same time </strong>matter? <br /><br />* For the dynamic UBO's (containing current cycle info such as the camera position), is it faster to change each individual field with cgSetBufferSubData, or just change the whole data at once with cgSetBufferData? Or, should updates be done different anyway?<br /><br />* Is it possible to <strong>share</strong> UBO's amonst multiple shaders? <br />For example, the "CameraPosition" is the same for all shaders / objects to be rendered. So if possible, I'd just like to push the UBO once at the renderCycleStart, then share amongst all shaders that need it, so I don't have to call "cgSetUniformBufferParameter" each time I switch<br />materials. A bit like "cgConnectParameter"...<br /><br />* The biggest "problem" is the huge amount of materials I have. If there are 100 different objects, I need to make switches between 100 different texture/parameter values as well. AFAIK there is not much I can do about the textures, but the (few) parameters per material could be combined into 1 UBO of course. However, that still requires 1 cgSetUniformBufferParameter per material. Is it still recommended to use a UBO for just a few parameters?<br /><br /><br />Cheers,<br />Rick]]></description>
   </item>
      <item>
      <title>Cg UBO problems, Compiling time &amp; Memory consumption.</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/6871/cg-ubo-problems-compiling-time-memory-consumption-</link>
      <pubDate>Tue, 10 Apr 2012 18:49:08 -0400</pubDate>
      <dc:creator>Rick16bit</dc:creator>
      <guid isPermaLink="false">6871@/devforum/discussions</guid>
      <description><![CDATA[Right, I asked about this before but no answers so I'll just do it again. Recently I started using UBO's in my shaders. All cool, but there are a few serious issues:<br />* Compiling of the shaders takes much longer<br />* Shaders seem to use a lot more RAM memory (big code I guess)<br />* Can't find UBO parameters with the cgGetNamedProgramUniformBuffer() function when loading pre-compiled shader code (to avoid the extreme compiling times)<br /><br />Not being able to find the parameter is annoying as I can't load pre-compiled shaders then. When loading raw code and compiling by hand, it works though.<br /><br />As for the compiling time and memory consumption, the problem is most probably the UBO having a large array being unrolled into thousands of code lines. And it's not just 1 shader, multiple shaders are using the same UBO, but redefine the whole code again and again nonetheless.<br /><br /><br />To give some numbers: <br />- There are 242 different shaders<br />- 17 of them are using UBO's<br />- Most of them have less than 1kb compiled code (textfiles)<br />- Those with the UBO's can be up to 330 kb though<br />- All compiled shaderfiles togeter, as text, take 2.3 MB harddrive diskspace.<br />- Compiling time increased from less than a minute to several minutes<br />- Memory grew a few 100 MB after loading all those shaders, about 100 MB more with UBO's now.<br /><br />It surprises me it takes so much RAM though. I have the feeling I'm doing something terribly<br />wrong with UBO's.<br /><br />Rick]]></description>
   </item>
      <item>
      <title>Crash in CgFx DX10 when assigning texture</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/1671/crash-in-cgfx-dx10-when-assigning-texture</link>
      <pubDate>Sat, 19 Nov 2011 04:08:06 -0500</pubDate>
      <dc:creator>JoakimD</dc:creator>
      <guid isPermaLink="false">1671@/devforum/discussions</guid>
      <description><![CDATA[If you try to assign a texture to a sampler that isn't used in the shader CgFx will crash with 'trying to access memory at 0x00000040'.<br /><br />Start the DX10 CgFx sample called 'cgfx_texture'.<br />In the shader, comment out the line "OUT.color = tex2D( decal, input.tex0 );" and run it.<br />It will crash.<br /><br />This causes some problem for me since knowing exactly if a texture is used or not is difficult because I have built a <a href="http://www.plane9.com">realtime shader editor</a> using CgFx but want to move to DX10 instead of OpenGL. I'm using the Feb 2011 Cg version<br /><br />Any time scale when this will be fixed?]]></description>
   </item>
      <item>
      <title>Pixel shader warning/info</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/6171/pixel-shader-warninginfo</link>
      <pubDate>Wed, 21 Mar 2012 19:47:29 -0400</pubDate>
      <dc:creator>terjeloe</dc:creator>
      <guid isPermaLink="false">6171@/devforum/discussions</guid>
      <description><![CDATA[I got a basic setup, where I've followed the cgfx_bump example, but I'm getting the info/warnings below which the example code doesn't get.. As I've designed it into my engine that was drawing with normal d3d code earlier its abit difficult to post all the code as its spread out.. what can cause this?<br /><br />I've set cgD3D11SetManageTextureParameters(cgContext, CG_TRUE). I'm creating the texture from file with no errors(this worked with the pure D3D renderer), I use cgD3D11SetTextureParameter( cgParameter, m_d3dTexture ) and cgSetSamplerState(cgParameter) to set the texture.<br /><br />The example do use Draw on the device context, while I'm using DrawIndexed.. could that cause the warning/info message? <br /><br />D3D11: WARNING: ID3D11DeviceContext::DrawIndexed: The Pixel Shader unit expects a Sampler to be set at Slot 0, but none is bound. This is perfectly valid, as a NULL Sampler maps to default Sampler state. However, the developer may not want to rely on the defaults.  [ EXECUTION WARNING #352: DEVICE_DRAW_SAMPLER_NOT_SET ]<br /><br />D3D11: INFO: ID3D11DeviceContext::DrawIndexed: The Pixel Shader unit expects a Shader Resource View at Slot 0, but none is bound. This is OK, as reads of an unbound Shader Resource View are defined to return 0. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Shader Resource View here.  [ EXECUTION INFO #353: DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET ]]]></description>
   </item>
      <item>
      <title>FXAA in SceniX?</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/6241/fxaa-in-scenix</link>
      <pubDate>Fri, 23 Mar 2012 02:20:45 -0400</pubDate>
      <dc:creator>jules123</dc:creator>
      <guid isPermaLink="false">6241@/devforum/discussions</guid>
      <description><![CDATA[Hi,<br /><br />For performance reasons, I wish to implement FXAA anti-aliasing in a CgFX shader to run in SceniX as a final pass.<br /><br />I can get the outputBuffer with:<br /><br />RTBufferSharedPtr buffer = renderTargetRT-&gt;getBuffer( "outputBuffer", renderTargetRT-&gt;getStereoTarget() );<br /><br />RTBufferGLTextureWriteLock bufferLock( sharedPtr_cast(buffer) );<br />bufferLock-&gt;updateTexture();<br /><br />Now I assume I've got to get the texture in the RTBuffer to become a COLOR_ATTACHMENT to a RendererGLFSQ, RendererGLFSQ-&gt;setCgFX to the FXAA shader, then set the texture to a sampler in the CgFX code.<br /><br />Not sure if this is the correct approach? Not sure how to get the texture to become a COLOR_ATTACHMENT? And is this the fastest way?<br /><br />Thanks for any help,<br />Jules]]></description>
   </item>
      <item>
      <title>cgGetNamedProgramUniformBuffer problem</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/6216/cggetnamedprogramuniformbuffer-problem</link>
      <pubDate>Thu, 22 Mar 2012 14:24:10 -0400</pubDate>
      <dc:creator>Rick16bit</dc:creator>
      <guid isPermaLink="false">6216@/devforum/discussions</guid>
      <description><![CDATA[For some reason, I can't find my UBO's anymore when loading precompiled shaders instead of first compiling it manually with cgCompileProgram, and then loading it with cgGLLoadProgram(). Other normal uniform parameters still can be found though. When looking in the precompiled code, the UBO does appear like this:"<br /><a href="/devforum/search?Search=%23semantic&amp;Mode=like">#semantic</a> shUBO_Lights._shUBO_Lights : BUFFER[0]<br /><br />Followed by many, many lines. Seems the whole struct (containing a big array) is "unrolled". Is that normal? Either way, I can't find the parameter handle anymore. Is this a bug, or am I doing something wrong? <br /><br /><br />BTW, is it possible to set the contents of an UBO for all programs that refer to it via an alternative route, like I can bind a texture on a specific unit:<br /><code><br />glActiveTextureARB( GL_TEXTURE2_ARB );<br />glBindTexture( GL_TEXTURE_2D, texHandle );<br />... then in the shader<br />uniform sampler2D myTexture : TEXUNIT2<br /></code><br />If something like that can be done with UBO's as well, would be nice. All shaders are using the same one, so now I need to find the parameter handle and pass the buffer for each program.<br /><br />Using Cg 3.1, OpenGL<br />Rick]]></description>
   </item>
      <item>
      <title>Getting into CgFX and fx composer</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/6066/getting-into-cgfx-and-fx-composer</link>
      <pubDate>Sun, 18 Mar 2012 09:57:07 -0400</pubDate>
      <dc:creator>terjeloe</dc:creator>
      <guid isPermaLink="false">6066@/devforum/discussions</guid>
      <description><![CDATA[Hi,<br /><br />I'm getting into shaders and using CG with CgFX and fx composer 2.5. I've written a basic shader that compiles with no warnings, but when I apply it to a teapot object, rendering with directx9/10 I only see a wireframe mesh?  With the default effect its fine though.<br /><br />If I render my effect with OpenGL the object becomes black and it show up black in the material preview. The default effect is also black in the material preview, but if I apply it to the teapot it renders it fine.<br /><br />My program have code fore transforming the object aswell.. how do I get fx composer to send the viewPerspective matrix from the camera and the model matrix so I can test that my transformations are right?<br /><br /><code><br />void mainVS(float4 position : POSITION,<br />			float3 normal 	: NORMAL,<br />			float2 texCoord	: TEXCOORD0,<br /><br />			out float4 oPosition : POSITION,<br />			out float2 oTexCoord : TEXCOORD0,<br />			uniform float4x4 viewProjection,<br />			uniform float4x4 world)<br />{<br />	oPosition = mul(world, position); <br />	oPosition = mul(viewProjection, position);<br />}<br /><br />void mainFS(float2 texCoord	: TEXCOORD0,<br />			out float4 color 	: COLOR,<br />			uniform sampler2D texSampler)<br />{<br />	color = tex2D(texSampler, texCoord);<br />}<br /><br /><br />float4x4 world : World;<br />float4x4 viewProjection : ViewProjection;<br /><br />sampler2D texSampler = sampler_state<br />{<br />	generateMipMap = true;<br />	minFilter = LinearMipMapLinear;<br />	magFilter = Linear;<br />};<br /><br />technique basic_textured<br />{<br />	pass<br />	{<br />		FragmentProgram = compile fp40 mainFS(texSampler);<br />		VertexProgram = compile vp40 mainVS(viewProjection, world);<br />	}<br />}<br /></code>]]></description>
   </item>
      <item>
      <title>Problem with Cg 3.1 and GeometryShaders</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/5696/problem-with-cg-3-1-and-geometryshaders</link>
      <pubDate>Fri, 09 Mar 2012 04:21:49 -0500</pubDate>
      <dc:creator>Rick16bit</dc:creator>
      <guid isPermaLink="false">5696@/devforum/discussions</guid>
      <description><![CDATA[Just upgraded from Cg 3.0 to 3.1 for my OpenGL game. Everything still works, except 1 important thing... I get "invalid item" crashes when I use a geometry program. If I simply disable this line<br /><strong>cgGLBindProgram( myGeomProg );</strong><br />The program works again. Thus that means I can compile/load geometryPrograms and enable the profile. Just binding the program makes things crash.<br /><br />For the info, the profile is set on CG_PROFILE_GPU_VP/FP/GP  (getLatestProfiel).<br />Furthermore, using OpenGL2.x, windows Vista 32 bit, and a GeForce 9800M GTS. ]]></description>
   </item>
      <item>
      <title>Why Setting Matrix in Cg is slow? (cgGLSetMatrixParameterfc)</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/5481/why-setting-matrix-in-cg-is-slow-cgglsetmatrixparameterfc</link>
      <pubDate>Tue, 06 Mar 2012 01:10:07 -0500</pubDate>
      <dc:creator>Marson Mao</dc:creator>
      <guid isPermaLink="false">5481@/devforum/discussions</guid>
      <description><![CDATA[Hi:<br /><br />I test the APEX sample code (SimpleClothing), and when I increase the actors to about 24, the FPS drops down a lot.<br />Then I examine the code and found it costs a lot of time on <code>cgGLSetMatrixParameterfc/cgGLSetMatrixParameterArrayfc</code> call.<br />The <code>void OGLRenderer::bindMeshContext(const RendererMeshContext &amp;context)</code> did some matrix set calls, each of it takes about 0.05ms.<br />So if there are 24 actors with lots of bones, then the total time is long.<br /><br />Is it normal to cost 0.05ms for setting matrix?<br /><br />Or is there anyway that not to set matrix each frame? <br />The sample code did <code>bindMeshContext </code> for each mesh in each frame; Is it redundant if the mesh is not moving?<br /><br />Update: <br />My program also runs CUDA code, will CUDA slows down Cg's speed? Maybe CUDA occupies all GPUs so that Cg can not compute in full power and rendering is slowed down?<br />]]></description>
   </item>
      <item>
      <title>Cg equivalents to HLSL functionality</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/5601/cg-equivalents-to-hlsl-functionality</link>
      <pubDate>Wed, 07 Mar 2012 18:39:59 -0500</pubDate>
      <dc:creator>keithoconor</dc:creator>
      <guid isPermaLink="false">5601@/devforum/discussions</guid>
      <description><![CDATA[We have used Cg to great success as a common shading language for our previous cross-platform titles. We're in the middle of upgrading our PC renderer to D3D11, and I'm starting to come across SM5 HLSL functionality that doesn't seem to have any equivalents in Cg. <br /><br />For example, in DX11 HLSL there is a Texture2D function GatherRed() - <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ff471558%28v=vs.85%29.aspx" target="_blank" rel="nofollow">http://msdn.microsoft.com/en-us/library/windows/desktop/ff471558(v=vs.85).aspx</a>. However I can't find any equivalent in Cg. Similarly, HLSL allows switch statements but Cg doesn't according to the documentation. <br /><br />These are just a couple of examples, but it's making me concerned that in sticking with Cg we might be backing ourselves into a corner and that we will eventually come across a case where we want to do something that would work in HLSL, but just isn't exposed in Cg. Am I just missing something, or are HLSL and Cg starting to diverge?]]></description>
   </item>
      <item>
      <title>Strange packing and unpacking problem with CgFx in SceniX</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/5491/strange-packing-and-unpacking-problem-with-cgfx-in-scenix</link>
      <pubDate>Tue, 06 Mar 2012 03:22:12 -0500</pubDate>
      <dc:creator>jules123</dc:creator>
      <guid isPermaLink="false">5491@/devforum/discussions</guid>
      <description><![CDATA[Hi,<br /><br />I'm struggling to get pack_4ubyte() and unpack_4ubyte() to work properly in CgFx across fragment programs.<br /><br />I want to pack e.g. diffuse color (a float4) into a texture using a fragment program during the geometry pass and then later retrieve and unpack it from the texture to return the pixel (diffuse) color in another fragment program. I have it working when I'm not packing e.g. like this test<br /><br />float4 fragment( float3 worldPos  : TEXCOORD0) : COLOR<br />{<br />return float4(1,0,0,1);  // in red<br />}<br /><br />Then in a second fragment program:<br /><br />float4 fragment2(float4 position  : WPOS) : COLOR<br />{<br />  return texRECTproj(TEX0, position);<br />}<br /><br /><br />Now if I pack and unpack like this:<br /><br />float4 fragment( float3 worldPos  : TEXCOORD0) : COLOR<br />{<br />float4 Colr.x =  pack_4ubyte(float4(1,0,0,1));<br />return Colr;<br />}<br /><br />samplerRECT TEX0 : RT0_COLOR_ATTACHMENT0 = sampler_state { MagFilter = Nearest; MinFilter = Nearest; };<br />float4 fragment2(float4 position  : WPOS) : COLOR<br />{<br />  float4 Colr = unpack_4ubyte(texRECTproj(TEX0, position).x);<br />  return Colr;<br />}<br /><br />The geometry I'm rendering using QtMinimal has the nearest cube red and all the other cubes blue instead of all being in red, as when I not using any packing.<br /><br />N.B. I attach the texture like this:<br />  m_GLtoRenderTargetGLFBO-&gt;setAttachment(nvgl::RenderTargetGLFBO::COLOR_ATTACHMENT0,<br />                                nvgl::TextureGLRectangle::create(GL_RGBA32F, GL_BGRA, GL_FLOAT));<br /><br />Anyone know what I might be doing wrong, why packing and unpacking is not working for me?<br /><br />Thanks for any help,<br />Jules]]></description>
   </item>
      <item>
      <title>cgc / glslf profile error</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/3111/cgc-glslf-profile-error</link>
      <pubDate>Thu, 05 Jan 2012 16:30:16 -0500</pubDate>
      <dc:creator>Scott MacHaffie</dc:creator>
      <guid isPermaLink="false">3111@/devforum/discussions</guid>
      <description><![CDATA[Compiling the following fragment shader with cgc using the glslf profile produces fatal error C9999: exception during compilation.<br /><br />Should this work? What am I doing wrong?<br /><br />Fragment shader:<br /><code><br /><a href="/devforum/search?Search=%23version&amp;Mode=like">#version</a> 120<br /><br />void main(void)<br />{<br />    vec2 zw = gl_ProjectionMatrix[3].zw;<br />    float z = gl_ProjectionMatrix[3].z;<br />}<br /></code><br /><br />This code is cut down from a larger example. I get the exception with either or both of the vec2 and float lines in there. If they are both commented out, no exceptions.]]></description>
   </item>
      <item>
      <title>something about cg example in the installed program</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/5476/something-about-cg-example-in-the-installed-program</link>
      <pubDate>Mon, 05 Mar 2012 20:53:40 -0500</pubDate>
      <dc:creator>buuer</dc:creator>
      <guid isPermaLink="false">5476@/devforum/discussions</guid>
      <description><![CDATA[there are some mistakes as i program it in the visual studio 2008, for example ,as like 15_particle_system ,the result shows that we can't find  ___GLEW_VERSION_1_3 ,as there just adds  another underline .how can i correct this error, and i just want to know which Platform you use.thank you! ]]></description>
   </item>
      <item>
      <title>Multi Vendor CGFX Profiles OpenGL</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/5451/multi-vendor-cgfx-profiles-opengl</link>
      <pubDate>Mon, 05 Mar 2012 09:44:48 -0500</pubDate>
      <dc:creator>-Raven-</dc:creator>
      <guid isPermaLink="false">5451@/devforum/discussions</guid>
      <description><![CDATA[Hello there,<br />I was wondering if there is any way to use more recent *lol* features like the tex2DArray which requires at least the gp4fp profile on a multi vendor profile like glslf. Apparently the glsf profile has the "version=x" that says <br /><br />version=val<br />    GLSL version to target. Supported versions are 100, 110, 120, 130, 140, 150, 330, 400 and 410. <br /><br />but even when setting that on &gt;= 330 the FX-Composer won't compile it, probably given the fact that is only supports glsl up to 120 ???<br /><br />I am currently on a project that is forced on an old engine and on OpenGL and I hate to be forced some fancy alternative methods on non-NVIDIA GPUs. While I do understand that NVIDIA will only focus on NVIDIA cards, the lack of multi-vendor support on the OpenGL-side of CGFX is really a devastating downside :-( Any help would be appreciated - and no I don't want to use 3D Textures instead of texture arrays.]]></description>
   </item>
      <item>
      <title>NVIDIA Parallel Nsight 2.1 Release Candidate 2 now available!</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/2171/nvidia-parallel-nsight-2-1-release-candidate-2-now-available</link>
      <pubDate>Mon, 05 Dec 2011 19:16:15 -0500</pubDate>
      <dc:creator>Sebastien Domine</dc:creator>
      <guid isPermaLink="false">2171@/devforum/discussions</guid>
      <description><![CDATA[<br /><p class="MsoNormal">NVIDIA Parallel Nsight 2.1 Release Candidate 2 now available! </p><br /><p class="MsoNormal">Dear Parallel Nsight User,</p><br /><p class="MsoNormal">Building on the NVIDIA Parallel Nsight™ 2.1 Release Candidate 1 release with multiple bug fixes and stability improvements, we are proud to announce the release of <b>NVIDIA Parallel Nsight™ 2.1 Release Candidate 2</b>. This release<br />brings support for the new <b>CUDA Toolkit 4.1 </b>Release Candidate 2, which can be downloaded under the CUDA Registered Developer Program (<a href="http://www.developer.nvidia.com/join">www.developer.nvidia.com/join</a>). Parallel Nsight 2.1 adds a number of new features to enhance debugging and profiling capabilities. </p><br /><p class="MsoNormal">This release requires <b>NVIDIA Display Driver Release 285.86</b>, available on the same download site. </p><br /><ul style="list-style-type:disc;margin-top:0in;"><li class="MsoNormal" style="margin-bottom:.0001pt;"> Traced workloads can now <b>navigate the dependencies and call stack</b> to allow the developer to follow through GPU workloads, corresponding API calls and host code that was the cause of the activity.</li><li class="MsoNormal" style="margin-bottom:.0001pt;"><b>CUDA warp watch</b> visualizes variables and expressions across an entire CUDA warp.</li><li class="MsoNormal"></li></ul>]]></description>
   </item>
      <item>
      <title>for - break issue</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/4836/for-break-issue</link>
      <pubDate>Sat, 18 Feb 2012 06:39:20 -0500</pubDate>
      <dc:creator>thefonzy0</dc:creator>
      <guid isPermaLink="false">4836@/devforum/discussions</guid>
      <description><![CDATA[Hi all. Please, can anyone help me with my puzzle?<br />I write a CG Vertex/Fragment program for 3D real time medical data visualization. Until I changed my PC and operating system (from Windows 7 32 bit to Windows 7 64 bit), the program worked correctly, but now I have strange display errors. I have isolated and identified the portion of code that does not work, trial and error (since there is no a debugger for CG ... this thing is really absurd!!). This is my code:<br /><code> 		    <br />	float3  Position;<br />	float3  Position1;<br />        int vidx1 ;<br />	int vidx2;<br />	float3 vecV1;<br />	float3 vecV2;<br />	float3 vecStart;<br />	float3 vecDir;<br />	float  denom;<br />	float  lambda ;<br />	int e;<br />	bool Test0, Test1, Test2,Test3,Test4,Test5;<br />	float   dPlane = dPlaneStart + Vin.y * dPlaneIncr;<br />	for (e = 0; e &lt; 4; ++e) {<br />		vidx1 = nSequence[int(frontIdx * 8 + v1[Vin.x*4+e])];<br />		vidx2 = nSequence[int(frontIdx * 8 + v2[Vin.x*4+e])];<br />		vecV1=vecVertices [vidx1];<br />		vecV2=vecVertices [vidx2];<br />		vecDir=vecV2-vecV1;<br />		vecStart=vecV1+vecTranslate;<br />		denom= dot(vecDir,vecWiew);<br />		lambda = (denom!=0.0)?(dPlane - dot(vecStart,vecWiew))/denom : -1.0;<br />&lt;strong&gt;		if ((lambda &gt;=0.0) &amp;&amp; (lambda&lt;=1.0)){<br />			Position= vecStart + lambda * vecDir;<br />			break;<br />	 	 }<br />&lt;/strong&gt;	   }<br />	  Test0=(Vin.x==0)&amp;&amp; Position.x==-1;  // OK<br />	  Test1=(Vin.x==1);  // OK<br />	  Test2=(Vin.x==2);  // OK<br />	  Test3=(Vin.x==3);  // OK<br />	  Test4=(Vin.x==4);  // OK<br />	  Test5=(Vin.x==5);  // OK<br />	  ... </code><br /><br />The portion of code that does not work is that of the if block: if I split that :<br /><code>           <br />	if ((lambda &gt;=0.0) &amp;&amp; (lambda&lt;=1.0))<br />		 Position= vecStart + lambda * vecDir;<br />	if ((lambda &gt;=0.0) &amp;&amp; (lambda&lt;=1.0))<br />		break;<br /></code><br />All appear to work.<br /><br />Am I doing something wrong?<br /><br />regards,<br />TheFonzy]]></description>
   </item>
      <item>
      <title>Is it possible to store the iso-surface generated in OpenGL SDK sample?</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/5406/is-it-possible-to-store-the-iso-surface-generated-in-opengl-sdk-sample</link>
      <pubDate>Sun, 04 Mar 2012 18:08:47 -0500</pubDate>
      <dc:creator>dartwing17</dc:creator>
      <guid isPermaLink="false">5406@/devforum/discussions</guid>
      <description><![CDATA[So i've been looking at the NVIDIA Graphics SDK - OpenGL version 10.6, at the Cg Isosurf sample.<br />I want to extract the iso-surface which is creating with the shader into a file which I can open in a 3d modelling tool, ex. 3ds max.<br /><br />Is it possible to do so?]]></description>
   </item>
      <item>
      <title>CG Toolkit and DirectX 9 AlphaRef and AlphaFunc (Bug?)</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/5051/cg-toolkit-and-directx-9-alpharef-and-alphafunc-bug</link>
      <pubDate>Thu, 23 Feb 2012 13:09:56 -0500</pubDate>
      <dc:creator>pfeifers</dc:creator>
      <guid isPermaLink="false">5051@/devforum/discussions</guid>
      <description><![CDATA[<span style="text-decoration:underline;">Background:</span><br />I am using the latest CG Toolkit (3.1, issue occurs with 3.0, haven't tested previous versions) with DirectX 9.  DX9 is a hard requirement for this project, so switching versions is not a possible solution.  I am loading and running HLSL and CgFX shaders using CG Toolkit, with shaders that may or may not be supplied by users of my engine.<br /><br /><span style="text-decoration:underline;">Issue:</span><br />AlphaRef and AlphaFunc CgFX pass states do not seem to set the proper alpha reference values in DX9.  When specifying these values for a pass, strange alpha blending artifacts occur (white rim around the edge of alpha-blended textures).<br />D3DRS_ALPHAREF calls for "an 8-bit value placed in the low 8 bits of the DWORD render-state value. Values can range from 0x00000000 through 0x000000FF" (<a href="http://msdn.microsoft.com/en-us/library/windows/desktop/bb172599#d3drs_alpharef">D3DRS_ALPHAREF reference</a>).<br />The issue is that if I call cgSetPassState() with any value set for AlphaRef or AlphaFunc, the CG Toolkit will pass a <strong>float</strong> to the D3DRS_ALPHAREF state assignment, rather than the requested <strong>DWORD</strong>.<br /><br /><span style="text-decoration:underline;">Example:</span><br /><code>AlphaRef = 127;</code><br />If I debug in PIX, I see the call to set D3DRS_ALPHAREF:<br /><code>IDirect3DDevice9::SetRenderState( D3DRS_ALPHAREF, 0x42FE0000 )</code><br />Which is float 127.0 on a function whose valid range is 0x00000000 through 0x000000FF. Same issue occurs with 0.5f (0x3F000000).<br /><br />I can get the proper 127 (0x0000007F) int value using an AlphaRef value of 1.780e-043f, however this solution is not feasible, as other users are expected to be able to write shaders for my engine (and pull in shaders from FX Composer and the like).<br /><br />Unfortunately, it seems as though the CG Toolkit is directly passing the float representation of my values to the IDirect3DDevice9::SetRenderState call.  Is there some way around this issue that I am missing?]]></description>
   </item>
      <item>
      <title>CG Max Instruction issue or bug</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/3966/cg-max-instruction-issue-or-bug</link>
      <pubDate>Wed, 25 Jan 2012 16:19:20 -0500</pubDate>
      <dc:creator>djethernet</dc:creator>
      <guid isPermaLink="false">3966@/devforum/discussions</guid>
      <description><![CDATA[I reproduced the issue in the vanilla Nvidia CG example.<br /><br />The CG max instruction seems to generate unexpected gl assembler code for valid change to the C5E7_light_attenuation.cg  (OpenGL_Basic_2008 project CG Febuary 2011 ) <br /><br />the profile it compiles for is "gp4vp"<br /><br /><code><br />float diffuseLight = max(dot(L, N),0); //(A) works <br /><br />float diffuseLight = max(0,dot(L, N)); //(B) does not work (always truncated -zero for this example)<br /><br />float diffuseLight = max(0.0f,dot(L, N)); //(C) works, same code as A<br /><br /></code><br /><br />running the CGC compiler shows that the assembly of  A and C is the same. B generates different code . Based on the generated assembler code having TRUNC placed on the second param in example B. it looks like it's using int max(int a, int b) when cg says it only has a float max(float a, float b) version, also if that's the case then it seems like A would produce the same code as B.<br /><br />compile line is <br /><code><br />cgc -q -profile gp4vp -entry C5E7_attenuateLighting C5E7_attenuateLighting.cg<br /></code>]]></description>
   </item>
      <item>
      <title>TextureGL2DMultisample</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/4491/texturegl2dmultisample</link>
      <pubDate>Thu, 09 Feb 2012 10:29:29 -0500</pubDate>
      <dc:creator>eliyam30</dc:creator>
      <guid isPermaLink="false">4491@/devforum/discussions</guid>
      <description><![CDATA[Hi all,<br />Can you please show how one can use TextureGL2DMultisample  with a CGFX effect? <br />Do I need a special sampler ? <br />how do I fetch texels in the shader? <br />I didnt find any information/examples showing its usage.<br /><br />thanks!]]></description>
   </item>
      <item>
      <title>Debugging a cg shader via FX Composer</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/3566/debugging-a-cg-shader-via-fx-composer</link>
      <pubDate>Tue, 17 Jan 2012 14:38:44 -0500</pubDate>
      <dc:creator>shenjoku</dc:creator>
      <guid isPermaLink="false">3566@/devforum/discussions</guid>
      <description><![CDATA[I've searched for this for a long time and I've never managed to find a decent solution to the problem. Now before you say anything, I already know about the shader debugger that comes with FX Composer, but you can only load CG FX files into FX Composer, NOT CG files. So my question is how would I go about debugging a CG shader, NOT a CG FX shader. Do I have to convert all of my shaders to FX shaders or something? And if I do, does anyone have any tutorials on how to do that? I've never worked with CG FX and I would have no idea how to do it. Thanks!<br /><br />Also, is there a way to debug CG shaders on Mac? We're not currently working on Mac but when we port the game to the Mac platform being able to debug the shaders in that environment is going to be very important. The only download I can find for FX Composer + Shader Debugger is windows only.]]></description>
   </item>
      <item>
      <title>mutitexturing in nvidia cg</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/4186/mutitexturing-in-nvidia-cg</link>
      <pubDate>Tue, 31 Jan 2012 18:26:00 -0500</pubDate>
      <dc:creator>siddharthuniv</dc:creator>
      <guid isPermaLink="false">4186@/devforum/discussions</guid>
      <description><![CDATA[hi guys,<br /><br />I need some clarifications with regards to multitexturing with nvidia cg and opengl. I figure that there are two ways of doing this. <br /><br />One way is to bind each texture object with activating each texture units using glactivetexture(TEXTURE0+i) and specifying the texture unit as a semantic in cg code. <br /><br />The otherway is to let cg do automatic texture unit handling. I.e, enable the texture parameter using cgGLEnableTextureParameter().Looking at its docs, tells that the texture object for the texture parameter is enable for its texture unit. How does cg automatically determine the texture unit for the texture object? Is it the order in which the samplers are defined(input parameters) in the cg code? For example, i have multiple 1D and 2D textures that i would like to use, but i am also interested in cg's way of handling texture units where you dont need to specify the texture units explicitly in cg code.<br /><br />Any insight is very much appreciated.<br /><br />thanks<br />]]></description>
   </item>
      <item>
      <title>Bake is not working in maya? How to bake apex cloth into keyframes?</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/3736/bake-is-not-working-in-maya-how-to-bake-apex-cloth-into-keyframes</link>
      <pubDate>Thu, 19 Jan 2012 20:42:19 -0500</pubDate>
      <dc:creator>sandeep3250</dc:creator>
      <guid isPermaLink="false">3736@/devforum/discussions</guid>
      <description><![CDATA[When i press bake all or bake selected button located into phy-x tab in maya, the time slider run once but nothing happens. Any solutions?.... plz i need help because i am working on my graduation film...]]></description>
   </item>
      <item>
      <title>OpenGL 3.3 Sampler Objects with CG Fragment Shader</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/3786/opengl-3-3-sampler-objects-with-cg-fragment-shader</link>
      <pubDate>Sat, 21 Jan 2012 22:08:08 -0500</pubDate>
      <dc:creator>atuyo60</dc:creator>
      <guid isPermaLink="false">3786@/devforum/discussions</guid>
      <description><![CDATA[Hi, I have been trying to get my CG fragment shader working with the sampler objects introduced in OpenGL 3.3 but the shader does not seem to be associating my OpenGL sampler with the texture unit.<br /><br />I generate my sampler during initialisation as follows<br /><code>GLuint glsampler = 0;<br />glGenSamplers (1, &amp;glsampler);<br />glSamplerParameteri (glsampler, GL_TEXTURE_WRAP_S, GL_REPEAT);<br />glSamplerParameteri (glsampler, GL_TEXTURE_WRAP_T, GL_REPEAT);<br />glSamplerParameteri (glsampler, GL_TEXTURE_MAG_FILTER, GL_NEAREST);<br />glSamplerParameteri (glsampler, GL_TEXTURE_MIN_FILTER, GL_NEAREST);<br /></code><br />I have tried using cgGLSetTextureParameter and cgGLEnableTextureParameter as well but they do not work and my understanding is that if I do not set these and if I just call glBindTexture(GL_TEXTURE_2D, gltexture); it will bind to the appropriate uniform sampler2D on my fragment program. In my rendering loop, I followed the OpenGL way of binding my texture to the proper texture image unit:<br /><code>glActiveTexture(GL_TEXTURE0 + 0);<br />glBindTexture(GL_TEXTURE_2D, gltexture);<br />glBindSampler(0, glsampler);<br /></code><br />My fragment shader is just:<br /><code>struct FragOutput<br />{<br />	float4 color : COLOR0;<br />};<br /><br />void main (float4 color : COLOR0, float2 texcoord : TEXCOORD0, uniform sampler2D decal : TEXUNIT0, out FragOutputoutput)<br />{<br />	output.color = tex2D(decal, texcoord);<br />}<br /></code><br />As seen above I have bounded my uniform sampler2D to TEXUNIT0 hoping that it would read my OpenGL sampler object from the texture unit but it does not and no filtering is done. My initial code did not include TEXUNIT0 semantic and it also failed to work.<br /><br />I have been searching for a solution for 2 days and all I could find were old examples and code for GLSL which I tried porting and did not work. Could someone explain to me how should I be associating OpenGL sampler objects with my shader uniforms so that the appropriate filtering is done? Thank you!]]></description>
   </item>
      <item>
      <title>SceniX on AMD/ATI hardware</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/3251/scenix-on-amdati-hardware</link>
      <pubDate>Tue, 10 Jan 2012 08:59:53 -0500</pubDate>
      <dc:creator>AlHadr</dc:creator>
      <guid isPermaLink="false">3251@/devforum/discussions</guid>
      <description><![CDATA[We've had some problems with our SceniX based application on AMD/ATI hardware because Cg reports that only arbvp1 profile is supported. I've read somewhere that one has to use GLSL inside Cg in order for it to work on ATI cards. Does anybody have more information about this and how can it be done in within the SceniX/CgFX framework? I have not found any relevant examples on how to do this.<br /><br />Thanks]]></description>
   </item>
      <item>
      <title>Efficiently passing shader parameters (Cg &amp; OpenGL)</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/3466/efficiently-passing-shader-parameters-cg-opengl</link>
      <pubDate>Sat, 14 Jan 2012 07:21:50 -0500</pubDate>
      <dc:creator>Rick16bit</dc:creator>
      <guid isPermaLink="false">3466@/devforum/discussions</guid>
      <description><![CDATA[Looking for a more efficient to set large amount of parameters for my Cg Shaders. I read about t- and cbuffers in DirectX, but I have no idea how to implement such a thing in OpenGL &amp; Cg.<br />Saw a "cgGLCreateBuffer()" function, but I don't know how to use it further.<br /><br />Typically, I have lot's of maps, objects, particle generators or whatsoever, each linked with a "material". Then this material is a collection of<br />- Vertex/fragment and sometimes a geometry shader<br />- Textures (diffuse, normal, specular, ...)<br />- Vector parameters (specularColor, factorXYZ, ...)<br /><br /><br />Although I try to sort &amp; group as much as possible on material, there are still hundreds of parameters switched/passed each cycle, resulting in performance loss. A nicer idea would be:<br />- Create 1 (BIG) buffer that contains ALL required vector/texture parameters<br />- Load that parameter buffer in the GPU memory<br />- Let the shaders refer to that buffer somehow<br /><br />AFAIK, that's basically the idea of t-cbuffers in DirectX. <br /><br />Rick]]></description>
   </item>
      <item>
      <title>Defines available in CG?</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/3416/defines-available-in-cg</link>
      <pubDate>Fri, 13 Jan 2012 01:41:11 -0500</pubDate>
      <dc:creator>szerbst</dc:creator>
      <guid isPermaLink="false">3416@/devforum/discussions</guid>
      <description><![CDATA[Hi<br /><br />as we proceed in developing CG shaders for our application we have stumbled across an apparently simple problem which we cannot solve with our current knowledge. <br /><br />We are using the same CG shader code and compile it with the latest profiles for D3D11 and OpenGL. However, now that we start integrating textures for various effects such as depth peeling we require a shader to sample either a samplerRECT on OpenGL or a sampler2D on D3D11. <br /><br />Obviously the shader won't compile on D3D due to the profile not supporting samplerRECT or it won't work in OGL when using sampler2D because we are dealing with a NPOT texture here.<br /><br />Furthermore the sampler call resides in a sub-function included to the actual shader. So its not as easy as duplicating a fragment shader with two flavors. Is there a way to have a C-line DEFINE for kinda precompilation in CG so what we can use <a href="/devforum/search?Search=%23if&amp;Mode=like">#if</a> directives to guard the sampling calls without duplicating all of our shader code?<br /><br />We feel like loosing the overall benefit of using CG in the first place if we have to duplicate about 75 % of our shader code anyway. Then we could just fall back to use native GLSL and HLSL.<br /><br />regards,<br />Stefan]]></description>
   </item>
      <item>
      <title>CgFx Validation</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/3316/cgfx-validation</link>
      <pubDate>Wed, 11 Jan 2012 15:12:05 -0500</pubDate>
      <dc:creator>Paranaix</dc:creator>
      <guid isPermaLink="false">3316@/devforum/discussions</guid>
      <description><![CDATA[Is there a way to obtain error messages why a validation of a technique failed in Cg-Runtime?]]></description>
   </item>
      <item>
      <title>type cast when using double-precision vbo with vert_program(float4 position : POSITION)</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/3296/type-cast-when-using-double-precision-vbo-with-vert_programfloat4-position-position</link>
      <pubDate>Wed, 11 Jan 2012 11:53:59 -0500</pubDate>
      <dc:creator>luotingfu</dc:creator>
      <guid isPermaLink="false">3296@/devforum/discussions</guid>
      <description><![CDATA[So i have this big triangular mesh with double-precision vertex positions. i am trying to render it with a solid wireframe cgfx that is declared with float3 vertex position inputs. i am a bit unsure about the performance impact of the possible double-to-float cast here.<br /><br />first, suppose i am using a non-quadro, gl 4.1 capable Fermi card. generally speaking, if i upload vertices via SceniX as a double vbo to my video card, and render it with a cg vertex program that is declared to take float4 position : POSITION:<br /><br />1) is a type-cast/truncation incurred every time the vertex program accesses elements of the vbo? i mean does the gpu have to type-cast double to float on-the-fly when rendering such a double vbo using a float vp? does the gpu, by any chance, intelligently cache the truncated float for the next frame?<br /><br />2) is such on-the-fly type-cast (double to float) expensive? am i better off offload the conversion from double to single to the CPU before uploading the vertices to the video card?<br /><br />then, alternatively, if i am using a good-old quadro fx 880m (gl 3.3), with the same double vbo, and the same float vp,<br /><br />3) would the lack of double-precision support trigger a software-based rendering code path that dooms me tremendously? or would it trigger a one-time cast at the time of vbo creation that truncates doubles into floats for storage on the video card?]]></description>
   </item>
      <item>
      <title>Tessellation, eg. Aliens vs triangles, performance expectations</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/2096/tessellation-eg-aliens-vs-triangles-performance-expectations</link>
      <pubDate>Fri, 02 Dec 2011 18:02:04 -0500</pubDate>
      <dc:creator>psionprime</dc:creator>
      <guid isPermaLink="false">2096@/devforum/discussions</guid>
      <description><![CDATA[I'm coming back to nVidia programming and getting up to speed on the 500 series capabilities. I liked the Alien vs Triangles demo and have been looking for a tutorial or other follow up on the techniques to do some performance tests. I haven't found any yet and am dreading the learning curve.<br /><br />Is there a plateau any at nVidia is allowed to release on expected performance ? I don't want to spend time/$$$ on an unachievable goal. Is the Alien vs Triangles max out a GTX 570 ? I am basically asking is that sort of detail in that fairly simple environment pretty max it ? I realize I don't know what is going on behind the scenes but it looks like a simple background and terrain. If so, okay that is cool for cut scenes or single focus items though I'd like to stick 20ish instances of that alien in the scene.<br /><br />I was looking for a tutorial or something examining that sort of tessellation techniques then see about making as many instances of the alien as my dev machine can handle and work out a base line. Afterward add to the environment some PhysX environmental effects etc. them more and see what I can get away with.<br /><br />Thanks for your time !<br />]]></description>
   </item>
      <item>
      <title>BoneMatrices semantics or similar using cgfx (scripting version)</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/1421/bonematrices-semantics-or-similar-using-cgfx-scripting-version</link>
      <pubDate>Thu, 10 Nov 2011 14:01:45 -0500</pubDate>
      <dc:creator>MatteNybbe</dc:creator>
      <guid isPermaLink="false">1421@/devforum/discussions</guid>
      <description><![CDATA[Hey all,<br /><br />I just recently started looking at cgfx (scriptification of hlsl/glsl i guess) scripting possibilities that application developers start to integrate here and there in 3d applications. So far i have found this really useful for creating my own shaders etc for everything from objects to characters. <br /><br />I have hit some snags with the using the cgfx scripting though. And more specifically regarding skinned animated characters. It seems that in some cases, depending on the application you are working against, skinned geo distorts the normals when and animated mesh moves. Which, of course, if does, so no surprises there really.<br /><br />Having C/C++ background i could probably write an API shader that fixes this instead of a script version, since that allows for access of the actual bone matrices that deforms the mesh/normals. I have found some of examples of this online as well, which seems to make sense. But those obviously require an API implementation, using HLSL/GLSL depending on your situation.<br /><br />However i was wondering if anyone knows if there is a way to get the bones/transforms (or any "outside" transform for that matter) that deforms a mesh using the script version of this, being ".cgfx"? So far i haven't found any information about this anywhere. The advantage of a script is of course huge, in your average case anyway, the portability/speed of changeability improves dramatically. As well as not having to deal with dependency issues going from application to application etc.<br /><br />Anyone have any insight?<br /><br />/Matte]]></description>
   </item>
      <item>
      <title>Complile Cg Shaders to GLSL profiles (more specific: does VERTEXID binding semantic exist in glslv)?</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/1006/complile-cg-shaders-to-glsl-profiles-more-specific-does-vertexid-binding-semantic-exist-in-glslv</link>
      <pubDate>Fri, 14 Oct 2011 08:08:50 -0400</pubDate>
      <dc:creator>Bitjuggler</dc:creator>
      <guid isPermaLink="false">1006@/devforum/discussions</guid>
      <description><![CDATA[Hi!<br /><br />I was trying to compile several cg shaders (we have already more than 100) to the glsl profile. We use OpenGL. It seams to work quite ok, but currently there is one issue: in some shaders we have a vertex attribute binding to VERTEXID. This binding is ok for the gp4vp, gp5vp etc. Nvidia OpenGL profiles, but when compiling the shaders for the glslv profile, I get an error message when compiling with cgc (3.0 February version):<br /><br />error C5108: unknown semantics "VERTEXID" specified for "vertexID"<br /><br />I looked up the GLSL documentation, and there is a corresponding GLSL input variable "gl_VertexID", supported since GLSL 1.1:<br /><a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/gl_VertexID.xml" target="_blank" rel="nofollow">http://www.opengl.org/sdk/docs/manglsl/xhtml/gl_VertexID.xml</a><br /><br />I would like to ask, is this binding semantic really unavailable in GLSL profiles? How to access the vertex id from a cg shader that is compiled for the glsl profile?<br /><br />Thank you very much!<br /><br />Claus]]></description>
   </item>
      <item>
      <title>Cg OpenGL varying input parameter assignment</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/946/cg-opengl-varying-input-parameter-assignment</link>
      <pubDate>Wed, 12 Oct 2011 11:34:09 -0400</pubDate>
      <dc:creator>krauthaufen</dc:creator>
      <guid isPermaLink="false">946@/devforum/discussions</guid>
      <description><![CDATA[Hi there,<br /><br />I'd like to know if there is a way to "map" OGL-VertexAttribute-Indices to a varying CGparameters...<br /><br />I'm binding my VertexAttributes like:<br /><br /><br /><br />glEnableVertexAttribArray(index);<br />glBindBuffer(ArrayBuffer, buffer);<br />glVertexAttribPointer(index,...)<br /><br />Is there any way to tell the CGprogram which VertexAttributeIndex should be used for which CGparameter?<br />I know it's possible to hard-code the Semantics (ATTR1, ...) directly in the Shader-Code but i want to manage the mapping (i.e. Attribute 5 -&gt; NORMAL, etc.) myself for some optimizations...<br /><br />It would for example be possible that for one DrawCall the normals are in attribute 4 and for another DrawCall in Attribute 5<br /><br /><br />So what I'm looking for is something like:<br />cgGLSetParameterAttributeIndex(param, index)]]></description>
   </item>
      <item>
      <title>Cg 3.0 VIEWPORT INDEX, semantic does it exist?</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/841/cg-3-0-viewport-index-semantic-does-it-exist</link>
      <pubDate>Wed, 05 Oct 2011 11:33:47 -0400</pubDate>
      <dc:creator>brianf</dc:creator>
      <guid isPermaLink="false">841@/devforum/discussions</guid>
      <description><![CDATA[Does Cg profile gp5gp support a binding semantic for VIEWPORT_INDEX(OpenGL 4.1)? Does cgc have output flag for profile binding semantics?<br /><br />I want to render primitives from my Cg geometry program to multiple viewports. GLSL supports this as gl_ViewportIndex. I feel like NV_gpu_program_4_1 would mention this but I can't find the document for it.]]></description>
   </item>
      <item>
      <title>Using COLOR semantic with OpenGL 3</title>
      <link>http://forums.developer.nvidia.com/devforum/discussion/656/using-color-semantic-with-opengl-3</link>
      <pubDate>Thu, 22 Sep 2011 18:37:03 -0400</pubDate>
      <dc:creator>redneon</dc:creator>
      <guid isPermaLink="false">656@/devforum/discussions</guid>
      <description><![CDATA[I've recently started porting an old demo I wrote using OpenGL 2 and CG to OpenGL 3 to expand on it. In the OpenGL 2 version I was using vertex arrays like this:<br /><br /><code><br />	 glEnableClientState(GL_VERTEX_ARRAY);<br />	 glEnableClientState(GL_COLOR_ARRAY);<br />	 glVertexPointer(3, GL_FLOAT, 0, triVerts);<br />	 glColorPointer(3, GL_FLOAT, 0, triColors);<br />	 glDrawArrays(GL_TRIANGLES, 0, 9);<br />	 glDisableClientState(GL_COLOR_ARRAY);<br />	 glDisableClientState(GL_VERTEX_ARRAY);<br /></code><br /><br />This worked fine but I noticed when I changed my code to use vertex buffer objects for OpenGL 3 that only the position worked. The colour data wasn't being applied. This is how I'm using the VBOs now:<br /><br /><code><br />	 GLuint vao, vbo[2];<br />	 glGenVertexArrays(1, &amp;vao);<br />	 glBindVertexArray(vao);<br />	 glGenBuffers(2, vbo);<br /><br />	 glBindBuffer(GL_ARRAY_BUFFER, vbo[0]);<br />	 glBufferData(GL_ARRAY_BUFFER, 9 * sizeof(GLfloat), triVerts, GL_STATIC_DRAW);<br />	 glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);<br />	 glEnableVertexAttribArray(0);<br /><br />	 glBindBuffer(GL_ARRAY_BUFFER, vbo[1]);<br />	 glBufferData(GL_ARRAY_BUFFER, 9 * sizeof(GLfloat), triColors, GL_STATIC_DRAW);<br />	 glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, 0);<br />	 glEnableVertexAttribArray(1);<br /><br />	 glDrawArrays(GL_TRIANGLES, 0, 3);<br /><br />	 glDisableVertexAttribArray(0);<br />	 glDisableVertexAttribArray(1);<br /><br />	 glDeleteBuffers(2, vbo);<br />	 glDeleteVertexArrays(1, &amp;vao);<br /></code><br /><br />I tried changing the semantic for the colour paramter in my vertex shader from COLOR to ATTR1 and now the colours work but I'm wondering if that's the correct way to be doing it.<br /><br />Is there any way to use the COLOR semantic with OpenGL 3.0 VBOs?<br />]]></description>
   </item>
      </channel>
</rss>
