Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

138 Neutral

About now

  • Rank
  1. now

    HLSL Phong shader problem

    In your vertex shader you transform your normal and tangent into world space: mToTangent[0] = mul(inTang, (float3x3)matWorld) ; mToTangent[2] = mul(inNorm, (float3x3)matWorld) ; Why are you doing this? Another thing you have to transform your inNorm into tangent space or just use (0.0f, 0.0f, 1.0f) in your pixel shader for the normal otherwise you are doing calculations with vectors from different spaces.
  2. now

    Small Cg question

    To set a texture for a cg program you have to query the handle of the texture parameter via its name (CGparameter cgGetNamedParameter(CGprogram prog, const char * name)). Then you can use your texture created with OGL and attach it to the shader with cgGLSetTextureParameter(CGparameter handle_of_the_cg_texture_parameter, GLuint opengl_texture_id). To activate your texture that it is used with the program you have to call cgGLEnableTextureParameter(CGparameter handle_of_the_cg_texture_parameter). You can disable the texture with cgGLDisableTextureParameter(CGparameter handle_of_the_cg_texture_parameter). If you don't want to manage cgGLEnableTextureParameter/cgGLDisableTextureParameter calls and want them to be set automatically you can tell this cg with a call to cgGLSetManageTextureParameters(CGcontext ctx, CGbool flag) and flag set to CG_TRUE (it's disabled by default). CG will the enable all textures attached to a certain program when you bind the program. To reset the texture state you should unbind the program again. If you want to manage texture states all by yourself (via OpenGL calls) you can query for the texture stage you have to bind your texture to with a call to cgGLGetTextureEnum(CGparameter handle_of_the_cg_texture_parameter). It returns the proper GLenum that can be used to activate the correct texture stage with glActiveTexture. Instead of querying the texture unit you can use a TEXUNITn semantic when you declare your uniform texture sampler in your cg program but there are some limitations when you want to compile to basic profiles.
  3. Quote:Original post by foniks munkee [...] I guess the point is this is only a concern if you intend to develop for consoles - you can still write a 3D engine, in .NET and if written properly target Win32, Linux and Mac platforms. Not everyone can afford or are in a position to even think about getting into a relationship with the Sony's and Nintendos of this world, so its a moot point unless in your design doc it says "Must work on PS2/3 and Gamecube and Xbox". Why is my point a moot point? I think it's a very valid point to be mentioned. Also the question asked about portability, nowhere was mentioned to exclude console targets. Quote: [...] I'm not saying every person should use C# - thats stupid. But the fact is, it IS possible to do what the OP asked. And if the tool is right for the job, use it. I completely aggree here but then regarding the portability point in the original question I still don't see this as a strength of the .NET framework at all.
  4. The whole discussion is too PC centric. The different console platforms can't left out when you decide which language you want to use for an engine and currently as far as I'm aware no platform (except PC) supports .NET nor has a C# compiler that compiles to native code on consoles. And I doubt that the non Microsoft console platforms will ever support .NET also Microsoft hold patents on the .NET API (link) which makes it even less likely to see it on Microsofts strongest opponents platform in the console market even if it says "for building web applications". Reading the patent you can see it does patent what the API is doing and this so broadly described (and IMHO not related to web applications only) that it seems very easy for me to infringe this patent by providing any implementation of any API for .NET.
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!