Jump to content
  • Advertisement
Sign in to follow this  
quaker

OpenGL HLSL Uniforms?

This topic is 4506 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Having experiemented with penGL vertex programs make it somehow not easy to understadn how HLSL works. I wonder when we declare a uniform variable in HLSL, does not neccessarily correspond to a built-in structure like the modelview matrix? And if not hw many varialbes can we declare as uniforms? What make sme ask so is that in OpenGL ARB vertex programs it used to be a built-in time that we fill and access in the vertex program, rather than declaring a special one. Does HLSL allow variables in video/GPU memory? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
HLSL globals get put in Constant registers. The number available is dependent on the vertex and pixel shader version and/or the device's capabilities. For VS_2_0 you would need to check D3DCAPS9.MaxVertexShaderConst. For PS_2_0 it is 32.

I don't know of any variables that are automatically made available. You would need to define one and then use DX interface (like ID3DXEffect for effect files) to set them.

You can read the DX SDK if you want and look at the sample programs in the SDK. Or you can get a good book on DX and HLSL. The latest book by Frank Luna teaches DX from the ground up and uses HLSL for everything. But if you already know DX and just want to understand HLSL, there are various books out by Wolfgang Engel that cover it well.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!