#### Archived

This topic is now archived and is closed to further replies.

# OpenGL OpenGL 1.5's "Shader Language"

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

## Recommended Posts

quote:
Suppose, instead of taking months to create, the breathtaking computer-graphics-generated scenes from any of this summer’s blockbuster movies could be rendered with cinematic quality in real time. Suppose a car designer could model a car that’s indistinguishable from a photograph. Or imagine a jet fighter training simulation that could look not “just pretty good,” but be so exact that you couldn’t distinguish the simulated scenery from the real thing. Or suppose a physician could see tumors one-third the size of what could previously be identified. These things are not only possible-they have already begun. The new frontier in graphics realism has been established with developments to the OpenGL® application programming interface (API), released by SGI (NYSE: SGI) and the OpenGL Architecture Review Board (ARB). The OpenGL® 1.5 specification includes the revolutionary OpenGL® Shading Language, official ARB extensions that are expected to form the foundation of the upcoming OpenGL® 2.0 version of this cross-platform, open-standard API for advanced 3D graphics.
How is this "revolutionary OpenGL(r) Shading Language" any different than Cg or, better still- freakin HLSL? Plus, these are ARB extensions, not additions to the core (well yet, but still). Is it just me or was this press release written by either Scott McNeally or the Iraqui Minister of Information?
quote:
“OpenGL 1.5, and the OpenGL Shading Language in particular, does for the next generation of graphics what OpenGL did for the first generation in the early ’90s. It will fundamentally change the industry,” said Shawn Underwood, director of marketing, Visual Systems Group, SGI.

Brian J
DL Vacuum - A media file organizer I made | Mumbling Miles - A band I was the guitarist/vocalist for

##### Share on other sites
Methinks it''s just a stepping stone and something to whet appetites. It''s written by a marketing director, so what can you expect?

I dont know anything about this openGL shading language, however. I doubt it''s any different than cg, or any other hlsl for that matter...they all let you do the same thing in the end, don''t they? Maybe it''s easier to set up than CG (hopefully, even though I managed to do it while, er, intoxicated, so it''s not that hard hehe)

I guess I''ll have to check it out once i get out of work.

##### Share on other sites
LOL! Thanks Brian, I needed that! I'm now much happier this morning.

I have not looked at it in detail yet but I hope this is the same as what was planned for the so-called OpenGL 2.0. I'd hate to see it go in two different ways.

[edited by - mauman on July 28, 2003 10:14:58 AM]

##### Share on other sites
In terms of syntax, it''s very similar to Cg or HLSL. One of the fundamental differences is that both Cg and HLSL are compiled to the lower level assembly language before being passed to the driver. With OGLSL, the high level code is passed directly to the driver. The advantage of this is that it gives IHVs more freedom to innovate under the hood, since they aren''t limited to a (relatively narrow) assembly interface. It also allows for greater portability.

I''ll know much more about it after the course on it today at SIGGRAPH.

Incidentally, NVIDIA will be adding an OGLSL profile to the Cg compiler; i.e. you''ll be able to compile Cg into OGLSL. This is to take advantage of what I just mentioned.

##### Share on other sites
When can we expect an implementation?

[My site|SGI STL|Bjarne FAQ|C++ FAQ Lite|MSDN|Jargon]
Ripped off from various people

##### Share on other sites
quote:
Original post by wild_pointer
When can we expect an implementation?

Catalyst 3.4 drivers were OpenGL2.0 ''compatible'', in the sense that I did run the OpenGL 2.0 examples on my RadeOn 8500 with those drivers. (even if it failed to render most things)

Later ATI drivers don''t support OpenGL2.0 anymore.

-* So many things to do, so little time to spend. *-

##### Share on other sites
I''ve seen it running on ATI hardware, so they must have a prototype driver at least. I''ve also seen it on 3D Labs hardware, and they have a publically available driver.

##### Share on other sites
I have the catalyst 3.6 drivers, and they still expose the old GL2 glslang interface, and that still works.. its some differences between GL2 and the ARB version, so you cannot run the example exe from 3dlabs, but it was pretty easy to set it up and test it. but i guess that a ''real'' implementation should come with the next set of drivers (3.7) but maybe not exposed in the extensionstring, just like VBO was at the beginning.

##### Share on other sites
sounds like its only going to create more problems as the drivers will get incredibly complex, and will stuff up even more than they do now, causing huge ammounts of frustration and confusion for all of us writing accelerated apps.
yay.

and this whole point of "being able to optimize it more" sounds like a whole load of B$to me. if this were true, wouldnt intels next pentium execute C code natively as it would be sooooomuch faster... [sorry for the deliberately inflametery statements, but it had to be said...] #### Share this post ##### Link to post ##### Share on other sites quote: Original post by aboeing and this whole point of "being able to optimize it more" sounds like a whole load of B$ to me.
if this were true, wouldnt intels next pentium execute C code natively as it would be sooooomuch faster...
[sorry for the deliberately inflametery statements, but it had to be said...]

The C program will be compiled by the driver when loaded. The hardware will not execute C code natively, it will still run machine code/asm (however it [the driver] can freely choose which asm/machinecode to run).

A more appropriate analogy would be to that of open-source software where you compile it as a part of the installation process. If you were to choose intel''s own compiler, you would get more optimized code. (although as a run-time vs. install-time comparison, slightly flawed)

I do believe that some speed-improvements are to be had over Cg for non nvidia-cards, but that is more due to the fact that no closely matching assembler exist for most cards, and the Cg compiler was optimized for nvidia''s cards in mind. It would be nice if vendors still expose up-to-date assembler implementations though.

##### Share on other sites
so now every gfx card manufacturer will get to write thier own compiler..
given that i have already found a number of bugs with nVidia''s CG compiler, and im sure we have all encountered bugs with MSVC, and other compilers, what are the odds of anyone being able to produce a decent system?

writing a good, optimized compiler is no easy task.

why not make graphics cards just like all other processors out there? they have thier own assembly language, and you use whatever-companies compiler to compile programs for thier cards.
I dont like the idea of being stuck with some higher level language.. its like saying, you can only code for the pentium5 in C#, it wont compile C,pascal,fortran,whatever code...

my whole point with the pentium thing, is that optimizing for one processor is also optimizing for others, and there isnt much need for seperate assmebly languages from my viewpoint. besideswhich, games are not like other products, they only stick around for a year or two. (so it doesnt matter (asmuch) if a new assembly language is introduced every year..) [iirc, when intel added thier complete outoforderexecution to thier compiler, they also found around a 20% speed increase when the code was run on 486''s.]

also, consider the increased effort factor in developing drivers for new graphics cards, and even worse, for any company trying to enter the industry, they would have to, not only build a complex processor, but also a top-notch compiler.

might aswell rename opengl to ATI_NVIDIA_GL..
(incidentily, i wonder who proposed this extension...)

oh and one last thing, as vember pointed out, the compile time issue, which actually doesnt seem so bad now, because CG programs tend only to be a few lines, but what about when CG programs get more complex, like some of the Renderman codes for movies, and even worse, optimizing compilers have a lot more thinking to do..

##### Share on other sites
Do we really need this debate here as well?

The GLSlang is approved and will be implemented, a few meaningless threads in some forums wont change that..

If the vendors like, they can use the Opensource frontend compiler that 3dlabs gives away for free, then all the vendors fixes the bugs in the front end. The backend compiler is still up to each vendor to implement, but that shoudnt be much harder than ''compiling'' the asm language we have now, so i dont think it will introduce more bugs, and it alone wont cure the drivers either ( there are plenty of bugs in the ARB_*_programs of both vendors)

And gfx cards works a bit like all other processors. so you can take a C program and compile it to SPAC, motorola, and Intel. but you cant take ASM and do the same thing.. In that sence C language is a good thing.

I dont have a real opinion on whatever it should be in the driver or not, but i do know that the Opengl API is there to allow us to write the same program for all graphicscard, an exposed lowlevel vendor specific ASM language wont do that ( a highlevel ARB asm language might, but then you got compile problems in the drivers again)..

For more flamed information, please read the Advanced openglforum on www.opengl.org ( you find a thread with ~80 messages in the top 10 right now )

##### Share on other sites
true true, we don''t need a flamewar here as well, especially since we all want the same thing in the end. So we should keep it clean and intelligent.

"also, consider the increased effort factor in developing drivers for new graphics cards, and even worse, for any company trying to enter the industry, they would have to, not only build a complex processor, but also a top-notch compiler."

Is there actually anything that would prevent third-party compilers that could be integrated in the drivers? (if the vendor allows of course) One could as an example make a glslang to ARB_VP/ARB_FP-compiler which would bring support to current cards.

##### Share on other sites
sorry guys, this was just the first place i heard about it..
to me, this just seems really stupid, but yeah, anyway.

and since most vendors dont have open-source drivers, i wouldnt imagine that making your own compiler for their cards would be easier (iirc there was some thread here recently about programming the GPU directly - i think the conclusion was : you dont have a chance)

quote:

And gfx cards works a bit like all other processors. so you can take a C program and compile it to SPAC, motorola, and Intel. but you cant take ASM and do the same thing.. In that sence C language is a good thing.

anywho, all im saying, is that it would be great if that was the case for gfx cards too. that is, all video cards would have their own assemblies, and that you could then use some compiler to compile your Cg code to thier assembly languages, or if someone invents Pascalg you could use that, or whichever language ever comes along.

anyway, im working myself up again, so ill just shut up.
sorry guys.

edit:
the opengl topic that MazyNoc sugested covers all this except better, so if anyone else is interested/concerned i highly suggest reading it:
http://www.opengl.org/discussion_boards/ubb/Forum3/HTML/010071.html

[edited by - aboeing on July 31, 2003 12:21:11 AM]

• 9
• 10
• 12
• 10
• 10
• ### Similar Content

• Good Evening,
I want to make a 2D game which involves displaying some debug information. Especially for collision, enemy sights and so on ...
First of I was thinking about all those shapes which I need will need for debugging purposes: circles, rectangles, lines, polygons.
I am really stucked right now because of the fundamental question:
Where do I store my vertices positions for each line (object)? Currently I am not using a model matrix because I am using orthographic projection and set the final position within the VBO. That means that if I add a new line I would have to expand the "points" array and re-upload (recall glBufferData) it every time. The other method would be to use a model matrix and a fixed vbo for a line but it would be also messy to exactly create a line from (0,0) to (100,20) calculating the rotation and scale to make it fit.
If I proceed with option 1 "updating the array each frame" I was thinking of having 4 draw calls every frame for the lines vao, polygons vao and so on.
In addition to that I am planning to use some sort of ECS based architecture. So the other question would be:
Should I treat those debug objects as entities/components?
For me it would make sense to treat them as entities but that's creates a new issue with the previous array approach because it would have for example a transform and render component. A special render component for debug objects (no texture etc) ... For me the transform component is also just a matrix but how would I then define a line?
Treating them as components would'nt be a good idea in my eyes because then I would always need an entity. Well entity is just an id !? So maybe its a component?
Regards,
LifeArtist
• By QQemka
Hello. I am coding a small thingy in my spare time. All i want to achieve is to load a heightmap (as the lowest possible walking terrain), some static meshes (elements of the environment) and a dynamic character (meaning i can move, collide with heightmap/static meshes and hold a varying item in a hand ). Got a bunch of questions, or rather problems i can't find solution to myself. Nearly all are deal with graphics/gpu, not the coding part. My c++ is on high enough level.
Let's go:
Heightmap - i obviously want it to be textured, size is hardcoded to 256x256 squares. I can't have one huge texture stretched over entire terrain cause every pixel would be enormous. Thats why i decided to use 2 specified textures. First will be a tileset consisting of 16 square tiles (u v range from 0 to 0.25 for first tile and so on) and second a 256x256 buffer with 0-15 value representing index of the tile from tileset for every heigtmap square. Problem is, how do i blend the edges nicely and make some computationally cheap changes so its not obvious there are only 16 tiles? Is it possible to generate such terrain with some existing program?
Collisions - i want to use bounding sphere and aabb. But should i store them for a model or entity instance? Meaning i have 20 same trees spawned using the same tree model, but every entity got its own transformation (position, scale etc). Storing collision component per instance grats faster access + is precalculated and transformed (takes additional memory, but who cares?), so i stick with this, right? What should i do if object is dynamically rotated? The aabb is no longer aligned and calculating per vertex min/max everytime object rotates/scales is pretty expensive, right?
Drawing aabb - problem similar to above (storing aabb data per instance or model). This time in my opinion per model is enough since every instance also does not have own vertex buffer but uses the shared one (so 20 trees share reference to one tree model). So rendering aabb is about taking the model's aabb, transforming with instance matrix and voila. What about aabb vertex buffer (this is more of a cosmetic question, just curious, bumped onto it in time of writing this). Is it better to make it as 8 points and index buffer (12 lines), or only 2 vertices with min/max x/y/z and having the shaders dynamically generate 6 other vertices and draw the box? Or maybe there should be just ONE 1x1x1 cube box template moved/scaled per entity?
What if one model got a diffuse texture and a normal map, and other has only diffuse? Should i pass some bool flag to shader with that info, or just assume that my game supports only diffuse maps without fancy stuff?
There were several more but i forgot/solved them at time of writing
• By RenanRR
Hi All,
I'm reading the tutorials from learnOpengl site (nice site) and I'm having a question on the camera (https://learnopengl.com/Getting-started/Camera).
I always saw the camera being manipulated with the lookat, but in tutorial I saw the camera being changed through the MVP arrays, which do not seem to be camera, but rather the scene that changes:
#version 330 core layout (location = 0) in vec3 aPos; layout (location = 1) in vec2 aTexCoord; out vec2 TexCoord; uniform mat4 model; uniform mat4 view; uniform mat4 projection; void main() { gl_Position = projection * view * model * vec4(aPos, 1.0f); TexCoord = vec2(aTexCoord.x, aTexCoord.y); } then, the matrix manipulated:
..... glm::mat4 projection = glm::perspective(glm::radians(fov), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f); ourShader.setMat4("projection", projection); .... glm::mat4 view = glm::lookAt(cameraPos, cameraPos + cameraFront, cameraUp); ourShader.setMat4("view", view); .... model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f)); ourShader.setMat4("model", model);
So, some doubts:
- Why use it like that?
- Is it okay to manipulate the camera that way?
-in this way, are not the vertex's positions that changes instead of the camera?
- I need to pass MVP to all shaders of object in my scenes ?

What it seems, is that the camera stands still and the scenery that changes...
it's right?

Thank you

• Sampling a floating point texture where the alpha channel holds 4-bytes of packed data into the float. I don't know how to cast the raw memory to treat it as an integer so I can perform bit-shifting operations.

int rgbValue = int(textureSample.w);//4 bytes of data packed as color
// algorithm might not be correct and endianness might need switching.
vec3 extractedData = vec3(  rgbValue & 0xFF000000,  (rgbValue << 8) & 0xFF000000, (rgbValue << 16) & 0xFF000000);
extractedData /= 255.0f;

• While writing a simple renderer using OpenGL, I faced an issue with the glGetUniformLocation function. For some reason, the location is coming to be -1.
Anyone has any idea .. what should I do?