PDA

View Full Version : 2 questions: sqrt and opengl languages



divide
03-10-2004, 10:27 AM
My first question:
I want to use a sqrt function in my fragment program. Is it really slower than a simple op like + or * ? I mean, does it worth doing a precomputed table I would access when I need a square root, or can I use the sqrt function and don't care about a possible slow down ?

My second question:
What is GLslang ? is it Opengl Shading Language (as described in the spec about "Opengl Shading Language" or is it another language ?
More generally, what do you think about the different languages dealing with fragment programs in opengl ? (like GLslang, Cg, etc..)

Corrail
03-10-2004, 11:12 AM
Yes, sqrt may take longer than a simple addition or multiplication.

GLslang (or GLSL, ...) is the OpenGL Shading Language defined by 3DLabs.

GLslang - future high level OpenGL shading language, no assambly suppport, quite beta status (still some bugs in different implementations)
Cg - nVidias high level shading language, similar to DX HLSL
ARB_*_progam - assambly shaders

I think that GLslang is the best choice. It has some disadvantages like no assambly support (shaders are sometimes harder to optimize) and some others. e.g. working with matrices is quite hard for some applications (see http://www.opengl.org/discussion_boards/ubb/Forum11/HTML/000091.html). Further the sampler handling ist quite ugly. But nevertheless there are many other very nice features supported by GLslang.
Additionally I hope that there will be new versions of ARB_*_program too!