Archived

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

NuffSaid

OpenGL OpenGL doesn't do fog??!?

Recommended Posts

NuffSaid    122
I''m pretty new to this 3D stuff, and recently, someone I know (whom I kinda respect) mentioned that OpenGL doesn''t do fog. I kindly corrected him, telling him the there is a function called glFog() (and others like glFogi, etc). Then he went on to some sort of BS about OpenGL doesn''t natively supporting fog(?), unlike Direct3D8. The point is, being a 3D newbie, I''m pretty confused and I need clarification.

Share this post


Link to post
Share on other sites
BiGCyC    139
Simple Demonstration

GLfloat colours[4] = {(GLfloat) 0.75, (GLfloat) 0.75, (GLfloat) 1, (GLfloat) 0.25};

//*** TEST FOG
glFogi(GL_FOG_MODE, GL_LINEAR);
glFogfv(GL_FOG_COLOR, colours); // same as clear colour
glFogf(GL_FOG_START, 8.0);
glFogf(GL_FOG_END, 30.0);
glFogf(GL_FOG_DENSITY, 0.2);
glEnable(GL_FOG);

Share this post


Link to post
Share on other sites
jenova    122
then maybe you should READ the OpenGL and Direct3D specifications to clarify.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.

Share this post


Link to post
Share on other sites
merlin9x9    174
That''s bullsh*t. OpenGL definately does fog, and can also do everything Direct3D can (arguably more through the extension mechanism); such features will either be part of OpenGL itself or extensions.

Also, we must not forget that since nobody but Microsoft makes an OpenGL binding on Windows, Windows platforms are stuck at API version 1.1, while 1.3 hardware compliance already exists...

Share this post


Link to post
Share on other sites
jenova    122
merlin9x9: that''s why people should stop answering these kinds of POST''s. if the original poster knows that there are functions such as "glFog" incorporated into the OpenGL API, then why would they ask if OpenGL has support for fogging. yeah, i thought "glFog" was for vertex arrays or something the first time i saw that function, and "glVertex" is for texture coordinates. furthermore, if the original poster, read any of the OpenGL programmer''s guide, reference guide, or any OpenGL documentation at all then they would have been able to conclude the answer to that question on their own. unfortunately, the world seems to think that becoming a professional programmer does NOT require years of training, practicing and most of all, THINKING. that''s it, everyone, keep jumpin'' on the programming bandwagon.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.

Share this post


Link to post
Share on other sites
Shag    122
Jenova ... I agree with you

Nuffsaid ... I don''t mean this unkindly, but try searching Google or similar for glFog ... you''ll get all the answers you need

Share this post


Link to post
Share on other sites
Shag    122
In fact - just to add to the above ...

The graphics cards themselves support many advanced rendering techniques - NOT the API. The API only exposes the functionality of the cards. Which is why (in many respects - no flame wars please) OpenGL is better - this advanced functionality is exposed very quickly via OpenGL extensions - whereas Microsoft DriectX fans have to wait for a new version of DirectX!

Share this post


Link to post
Share on other sites
NuffSaid    122
The thing I need clarification isn''t whether OpenGL does fog (which I know as I posted about glFog, etc), I just need some explanation about the BS bit like OpenGL doesn''t do fog natively(?).

This friend of mine said something like OpenGL uses the Alpha channel to do fog which is like a cheap hack, and is different from the way D3D does, and he went on to a long lecture about some stuff that I''ve never even heard off.

Sorry if I pissed anyone off, the title should have been something like "OpenGL doesn''t support fog natively?". I''ve searched Google, opengl.org and the MSDN about this, and I''ve come up zip, or with stuff that''s way over my head.

Share this post


Link to post
Share on other sites
avianRR    100
To answer your question, yes OpenGL supports fog natively and it does not use the alpha chanel (as far as I know). It uses the z-buffer value in a formula that calculates the amount of fog then multiplys that to the fog color and finally adds that to the pixel color to get the final result. (the exact same way D3D does it).
In fact if the hardware supports fog then both OpenGL and D3D will be useing the same hardware calls to do the fog.
Nothing personal and not to start flames but your friend sounds like a microsoft zombie. any BS that ms puts out he believes. He''s one of those OpenGL is an obsolete API that can''t do anything people because that''s what MS say''s. I''d like to see them sit down and learn OpenGL once to see that it can do everything d3D can and usually is easyer to program.
I like meating people like that and busting there bubbles Maybe you should send him over to my house so I can set him straight?

Share this post


Link to post
Share on other sites
Ysaneya    1383
Yes, it has native support for fog. That is, fog is supported in all versions of OpenGL ( 1.1, 1.2, 1.3 ) without having to use an extension. What''s true however is that if your hardware doesn''t support fogging, it will get emulated by OpenGL, probably with that alpha-blending trick you mentionned. I think that''s what happens with old Vaudoos. But well, if there is no hardware support, D3D is no way different then.

Y.

Share this post


Link to post
Share on other sites
jenova    122
here is a link to the entire OpenGL reference manual and programmers guide. full OpenGL 1.1 function call specifications, as well as detailed information of the algorithms used to calculate fogging, projection, etc. and examples and source code. it''s a good place to start if you are SERIOUS about becoming a OpenGL developer.

http://ask.ii.uib.no/ebt-bin/nph-dweb/dynaweb/SGI_Developer/OpenGL_RM

http://ask.ii.uib.no/ebt-bin/nph-dweb/dynaweb/SGI_Developer/OpenGL_RG

peace.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
quote:

What''s true however is that if your hardware doesn''t support fogging, it will get emulated by OpenGL, probably with that alpha-blending trick you mentionned. I think that''s what happens with old Vaudoos.



No, even the oldset Voodoo-1 did per-pixel fog in hardware.
The only place where it emulates it by vertex alpha blending is in software mode, or if you specifically ask for it.

- AH

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
quote:
Original post by merlin9x9
Also, we must not forget that since nobody but Microsoft makes an OpenGL binding on Windows, Windows platforms are stuck at API version 1.1, while 1.3 hardware compliance already exists...


Use the Silicon Graphics Incorporated libraries instead. Firstly they are at higher versions, secondly they rendered textures, smooth and rendered polygons faster (lines are slower) and thirdly the source is available.

Share this post


Link to post
Share on other sites
ANSI2000    122
So we can get v1.3 from sgi for windows?

Another thign I dont understand. If people realy want OpenGL for Windows, why hasn't a 3rd party or even SGI taken control back of the Windows implementation. MS is not supporting it anymore, so what is stopping someone from writing there own version of the libs? I would figure then that all card manufacturers do that. But why not just have 1 3rd party write the standar 1.3 libs with all the latest features of the ARB and have the card manufactures include there extra features through extensions. To my understanding to get the 1.3 features of OGL working with windows 1.1, the card manufactures have to implement them as extensions.

Edited by - ANSI2000 on November 14, 2001 12:44:24 PM

Share this post


Link to post
Share on other sites
jenova    122
i can''t believe this POST received 14, i mean 15 replies.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.

Share this post


Link to post
Share on other sites
zedzeek    529
quote:
Original post by ANSI2000
So we can get v1.3 from sgi for windows?

Another thign I dont understand. If people realy want OpenGL for Windows, why hasn''t a 3rd party or even SGI taken control back of the Windows implementation. MS is not supporting it anymore, so what is stopping someone from writing there own version of the libs?


ms wont let anyone else make a vesion of opengl32.dll. my bet is when opengl2.0 comes out all these problems will be solved (ie a clean break).

Share this post


Link to post
Share on other sites
NuffSaid    122
quote:
Original post by zedzeek
ms wont let anyone else make a vesion of opengl32.dll. my bet is when opengl2.0 comes out all these problems will be solved (ie a clean break).



What makes you say that? AFAIK, there''s nothing stopping MS from preventing anyone else from making a new version of opengl32.dll.

But what I don''t get is, why no just change the name of the DLL to SGI''s DLL, which is just opengl.dll & glu.dll? Wouldn''t that circumvent MS''s restriction?

Share this post


Link to post
Share on other sites
Null and Void    1088
quote:
Original post by NuffSaid
What makes you say that? AFAIK, there''s nothing stopping MS from preventing anyone else from making a new version of opengl32.dll.

But what I don''t get is, why no just change the name of the DLL to SGI''s DLL, which is just opengl.dll & glu.dll? Wouldn''t that circumvent MS''s restriction?


There are potential legal issues with updating the OpenGL MCD shipped with Windows, but nothing is certain until it happens. The OpenGL ARB is getting pretty ticked off at Microsoft (read the ARB notes), since they (SGI) have had up-to-date MCD''s for Windows ready to go for years (Microsoft has had the longest ''testing'' period in history specially made just for the MCD''s). You are able to replace them yourself, but how many people will do that?

[Resist Windows XP''s Invasive Production Activation Technology!]

Share this post


Link to post
Share on other sites

  • Similar Content

    • By pseudomarvin
      I assumed that if a shader is computationally expensive then the execution is just slower. But running the following GLSL FS instead just crashes
      void main() { float x = 0; float y = 0; int sum = 0; for (float x = 0; x < 10; x += 0.00005) { for (float y = 0; y < 10; y += 0.00005) { sum++; } } fragColor = vec4(1, 1, 1 , 1.0); } with unhandled exception in nvoglv32.dll. Are there any hard limits on the number of steps/time that a shader can take before it is shut down? I was thinking about implementing some time intensive computation in shaders where it would take on the order of seconds to compute a frame, is that possible? Thanks.
    • By Arulbabu Donbosco
      There are studios selling applications which is just copying any 3Dgraphic content and regenerating into another new window. especially for CAVE Virtual reality experience. so that the user opens REvite or CAD or any other 3D applications and opens a model. then when the user selects the rendered window the VR application copies the 3D model information from the OpenGL window. 
      I got the clue that the VR application replaces the windows opengl32.dll file. how this is possible ... how can we copy the 3d content from the current OpenGL window.
      anyone, please help me .. how to go further... to create an application like VR CAVE. 
       
      Thanks
    • By cebugdev
      hi all,

      i am trying to build an OpenGL 2D GUI system, (yeah yeah, i know i should not be re inventing the wheel, but this is for educational and some other purpose only),
      i have built GUI system before using 2D systems such as that of HTML/JS canvas, but in 2D system, i can directly match a mouse coordinates to the actual graphic coordinates with additional computation for screen size/ratio/scale ofcourse.
      now i want to port it to OpenGL, i know that to render a 2D object in OpenGL we specify coordiantes in Clip space or use the orthographic projection, now heres what i need help about.
      1. what is the right way of rendering the GUI? is it thru drawing in clip space or switching to ortho projection?
      2. from screen coordinates (top left is 0,0 nd bottom right is width height), how can i map the mouse coordinates to OpenGL 2D so that mouse events such as button click works? In consideration ofcourse to the current screen/size dimension.
      3. when let say if the screen size/dimension is different, how to handle this? in my previous javascript 2D engine using canvas, i just have my working coordinates and then just perform the bitblk or copying my working canvas to screen canvas and scale the mouse coordinates from there, in OpenGL how to work on a multiple screen sizes (more like an OpenGL ES question).
      lastly, if you guys know any books, resources, links or tutorials that handle or discuss this, i found one with marekknows opengl game engine website but its not free,
      Just let me know. Did not have any luck finding resource in google for writing our own OpenGL GUI framework.
      IF there are no any available online, just let me know, what things do i need to look into for OpenGL and i will study them one by one to make it work.
      thank you, and looking forward to positive replies.
    • By fllwr0491
      I have a few beginner questions about tesselation that I really have no clue.
      The opengl wiki doesn't seem to talk anything about the details.
       
      What is the relationship between TCS layout out and TES layout in?
      How does the tesselator know how control points are organized?
          e.g. If TES input requests triangles, but TCS can output N vertices.
             What happens in this case?
      In this article,
      http://www.informit.com/articles/article.aspx?p=2120983
      the isoline example TCS out=4, but TES in=isoline.
      And gl_TessCoord is only a single one.
      So which ones are the control points?
      How are tesselator building primitives?
    • By Orella
      I've been developing a 2D Engine using SFML + ImGui.
      Here you can see an image
      The editor is rendered using ImGui and the scene window is a sf::RenderTexture where I draw the GameObjects and then is converted to ImGui::Image to render it in the editor.
      Now I need to create a 3D Engine during this year in my Bachelor Degree but using SDL2 + ImGui and I want to recreate what I did with the 2D Engine. 
      I've managed to render the editor like I did in the 2D Engine using this example that comes with ImGui. 
      3D Editor preview
      But I don't know how to create an equivalent of sf::RenderTexture in SDL2, so I can draw the 3D scene there and convert it to ImGui::Image to show it in the editor.
      If you can provide code will be better. And if you want me to provide any specific code tell me.
      Thanks!
  • Popular Now