Slashdot Mirror


NVidia announces Cg: "C" for Graphics

mr_sheel writes: "Thresh's FiringSquad has an article about Cg, a new language developed by NVidia in collaboration with Microsoft. 'Up until now,' Brandon Bell writes, 'game developers have had to use complex assembly language to create the lifelike graphics gamers experience in today's latest games.' Cg eases the process of bringing graphics to the screen and compiles for DirectX 8,9 and OpenGL 1.4. Many companies, including 3D Studio Max, Blizzard, and over 100 game developers, have already jumped onto the Cg bandwagon. Will this replace assembly graphics coding once and for all?"

8 of 176 comments (clear)

  1. Isn't this by mcspock · · Score: 5, Informative
    --
    -- Patience is a virtue, but impatience is an art.
    1. Re:Isn't this by Anonymous Coward · · Score: 2, Informative

      Yep. Nothing to see here, folks. These aren't the droids you're looking for. Move along.

  2. Another article by purepower · · Score: 3, Informative

    Extreme Tech also has an article about Cg.

  3. I kan read artical by Enonu · · Score: 5, Informative

    Since Cg is designed specifically for vertex and pixel shader programs, DirectX versions 8 and 9 are supported as well as OpenGL 1.4. The compiler itself is cross platform; in particular programs written for Windows, Linux, Macintosh, and Xbox are supported. And if all that isn't enough, the compiler can create code for all GPUs that support DirectX 8 (or above) and/or OpenGL 1.4, making it very universal. In keeping with Linux tradition, NVIDIA has open-sourced certain components of the compiler, allowing content developers to add their own customizations as well.

  4. Re:Complex assemly language? by SirRichardPumpaloaf · · Score: 2, Informative

    It seems pretty clear to me that what you write in Cg is code for the GPU, not the CPU. Perhaps the OpenGL or DirectX calls that are generated are used to download the GPU code into the chip? Then you would use other OpenGL or DirectX calls that you yourself wrote to draw the objects, which are rendered according to the code written in Cg. The article was pretty skimpy on details, but that's the only way it makes any sense to me.

  5. Re:Complex assemly language? by Anonymous Coward · · Score: 1, Informative

    > I was going to mod people about but I decided to get out the clue stick instead.

    Why don't you give yourself a good whack.

    Pixel Shaders are an extension to OpenGL and DirectX that allow you to load a small gpu assembly routine into the hw. The point of Cg is to write pixel shaders in a c-like language that gets translated into the ogl/dx gpu assembly routines. This lets the programmers focus on the higher level details, rather than worrying about when which register can be used.

  6. Re:Complex assemly language? by 91degrees · · Score: 2, Informative

    Ok sorry, but if you read the article it clearly states it turns this Cg language into a series of OpenGL or DirectX calls.

    Where?

    high performance 3d graphics aren't done in assember. Its done in C with OpenGL calls.

    Or DirectX, with calls to handle an assembly language shader. I don't know how OpenGL does it, but under Direct3D, it is quite possible to produce some GPU assembly language programs in ASCII, and get the API to assemble them.

    The OGL calls are quite high level, nothing as simple as 'put a point at x,y on the screen'

    No, you need to go for this level of complexity:

    glBegin(GL_POINTS);
    glVertex2f(x, y)
    glEnd();

  7. Wow! by be-fan · · Score: 5, Informative

    I'm impressed. This is the second time this has been posted on /., and people are STILL clueless about what Cg is! Incredible!

    Cluestick: Cg is not a language like C/C++. It is not an API like OpenGL/DirectX. Instead, it is a simple, high-level replacement for the assembly language traditionally used to program pixel and vertex shader units on graphics cards. These programs are typically a few dozen instructions long and basically map a small set of inputs to a small set of outputs. So you could write a program to rotate a vertex around a point in Cg, but not something like Quake...

    --
    A deep unwavering belief is a sure sign you're missing something...