Archived

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

Azrael

OpenGL Opengl and Vertex and Pixel Shaders

Recommended Posts

Azrael    128
I was checking nvidia site to get some info on how to run vertex and pixel shaders on the opengl SDK (Great stuff! a must download for any developer!) BUT.. I currently have a nvidia riva tnt2 (dont worry I already ordered my geforce 2 it should arrive in a month or two) and It doesnt say anything about how to use vertex shaders in a card without hardware support for it, is there a way to use this shaders in my riva at least for testing?

Share this post


Link to post
Share on other sites
Krippy2k    134
I think there is something similar but the reason you can't get it in software is because it is not standard OpenGL, rather it is an extension which will only work if your current video card driver supports it. You will need to test for hardware support and if it is there, use the shader, if not use another method.

Anything that is standard OpenGL it will automatically switch to software rendering if the card does not support it.

Seeya
Krippy

Edited by - krippy2k on June 28, 2001 1:36:35 AM

Share this post


Link to post
Share on other sites
Maximus    124
OpenGL does have vertex and pixel shaders, they are accessible via extensions. Pixel shaders arent accessible unless your hardware has support for them, but Vertex programs (ogl equiv of vertex shaders) are emulated by the drivers for older geforce cards (not sure about TNT cards).

Share this post


Link to post
Share on other sites
Obelix    122
DX8 has some software support for this. Vertex shaders is pretty OK in sw but I think that you can get some big slowdowns compare to fixed functions. Pixel shaders is hopeless without the proper hardware.

In OpenGL is vertex programs the same as vertex shaders for nvidia cards. I think "texture shaders" is used instead of "pixel shaders". ATI and others is working on an extension with functions instead of the assembly language used in the original vertex shaders.

You need a GF3 for full hardware support. Any GeForce can also be used with OpenGL but some features will be emulated.

Share this post


Link to post
Share on other sites
ironfroggy    122
Correct me if I''m wrong, but can''t anything be software emulated? Pixel shadding (im assuming this means bump-maps) would be very easy in software. You would have a little equation for the angle the pixel should be shaded for, based on its surrounding pixels'' heights. I can''t describe it all right here, not without some diagrams, but I''m going to write an article about it now so I can work out all the details. This will be a nice project.. If you want to read it email me and I''ll tell you when its done. I''ll do it tomorrow.

Share this post


Link to post
Share on other sites
ironfroggy    122
Ok here is what I got:

If the values for the map at all the pixels around the current pixel is A through H, starting from the top-left and clockwise from there, the angles on the X axis and Y axis can be found with these equations:

Y = (H - D) + (C - G)/2 + (A - E)2
X = (B - F) + (C - G)/2 + (A - E)2

either I am horribly wrong for a genius cause I just scribbled a few things down and got that in about a minute.

You can use the light angles on this data to get the bumps.

Share this post


Link to post
Share on other sites
Krippy2k    134
Yes, well you can emulate just about anything you want using software if you write the code. Doesn''t necessarily mean it will be fast enough to be useful though.

Seeya
Krippy

Share this post


Link to post
Share on other sites
Maximus    124
Pixel shaders != pixel shading
I suggest you go read up on pixel shaders @ nVidia''s developer site for a proper explanation of what they are. They are a damn lot better than bump mapping alone, thats for sure.

Share this post


Link to post
Share on other sites

  • Similar Content

    • By markshaw001
      Hi i am new to this forum  i wanted to ask for help from all of you i want to generate real time terrain using a 32 bit heightmap i am good at c++ and have started learning Opengl as i am very interested in making landscapes in opengl i have looked around the internet for help about this topic but i am not getting the hang of the concepts and what they are doing can some here suggests me some good resources for making terrain engine please for example like tutorials,books etc so that i can understand the whole concept of terrain generation.
       
    • By KarimIO
      Hey guys. I'm trying to get my application to work on my Nvidia GTX 970 desktop. It currently works on my Intel HD 3000 laptop, but on the desktop, every bind textures specifically from framebuffers, I get half a second of lag. This is done 4 times as I have three RGBA textures and one depth 32F buffer. I tried to use debugging software for the first time - RenderDoc only shows SwapBuffers() and no OGL calls, while Nvidia Nsight crashes upon execution, so neither are helpful. Without binding it runs regularly. This does not happen with non-framebuffer binds.
      GLFramebuffer::GLFramebuffer(FramebufferCreateInfo createInfo) { glGenFramebuffers(1, &fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo); textures = new GLuint[createInfo.numColorTargets]; glGenTextures(createInfo.numColorTargets, textures); GLenum *DrawBuffers = new GLenum[createInfo.numColorTargets]; for (uint32_t i = 0; i < createInfo.numColorTargets; i++) { glBindTexture(GL_TEXTURE_2D, textures[i]); GLint internalFormat; GLenum format; TranslateFormats(createInfo.colorFormats[i], format, internalFormat); // returns GL_RGBA and GL_RGBA glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, createInfo.width, createInfo.height, 0, format, GL_FLOAT, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); DrawBuffers[i] = GL_COLOR_ATTACHMENT0 + i; glBindTexture(GL_TEXTURE_2D, 0); glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, textures[i], 0); } if (createInfo.depthFormat != FORMAT_DEPTH_NONE) { GLenum depthFormat; switch (createInfo.depthFormat) { case FORMAT_DEPTH_16: depthFormat = GL_DEPTH_COMPONENT16; break; case FORMAT_DEPTH_24: depthFormat = GL_DEPTH_COMPONENT24; break; case FORMAT_DEPTH_32: depthFormat = GL_DEPTH_COMPONENT32; break; case FORMAT_DEPTH_24_STENCIL_8: depthFormat = GL_DEPTH24_STENCIL8; break; case FORMAT_DEPTH_32_STENCIL_8: depthFormat = GL_DEPTH32F_STENCIL8; break; } glGenTextures(1, &depthrenderbuffer); glBindTexture(GL_TEXTURE_2D, depthrenderbuffer); glTexImage2D(GL_TEXTURE_2D, 0, depthFormat, createInfo.width, createInfo.height, 0, GL_DEPTH_COMPONENT, GL_FLOAT, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glBindTexture(GL_TEXTURE_2D, 0); glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, depthrenderbuffer, 0); } if (createInfo.numColorTargets > 0) glDrawBuffers(createInfo.numColorTargets, DrawBuffers); else glDrawBuffer(GL_NONE); if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) std::cout << "Framebuffer Incomplete\n"; glBindFramebuffer(GL_FRAMEBUFFER, 0); width = createInfo.width; height = createInfo.height; } // ... // FBO Creation FramebufferCreateInfo gbufferCI; gbufferCI.colorFormats = gbufferCFs.data(); gbufferCI.depthFormat = FORMAT_DEPTH_32; gbufferCI.numColorTargets = gbufferCFs.size(); gbufferCI.width = engine.settings.resolutionX; gbufferCI.height = engine.settings.resolutionY; gbufferCI.renderPass = nullptr; gbuffer = graphicsWrapper->CreateFramebuffer(gbufferCI); // Bind glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo); // Draw here... // Bind to textures glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, textures[0]); glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, textures[1]); glActiveTexture(GL_TEXTURE2); glBindTexture(GL_TEXTURE_2D, textures[2]); glActiveTexture(GL_TEXTURE3); glBindTexture(GL_TEXTURE_2D, depthrenderbuffer); Here is an extract of my code. I can't think of anything else to include. I've really been butting my head into a wall trying to think of a reason but I can think of none and all my research yields nothing. Thanks in advance!
    • By Adrianensis
      Hi everyone, I've shared my 2D Game Engine source code. It's the result of 4 years working on it (and I still continue improving features ) and I want to share with the community. You can see some videos on youtube and some demo gifs on my twitter account.
      This Engine has been developed as End-of-Degree Project and it is coded in Javascript, WebGL and GLSL. The engine is written from scratch.
      This is not a professional engine but it's for learning purposes, so anyone can review the code an learn basis about graphics, physics or game engine architecture. Source code on this GitHub repository.
      I'm available for a good conversation about Game Engine / Graphics Programming
    • By C0dR
      I would like to introduce the first version of my physically based camera rendering library, written in C++, called PhysiCam.
      Physicam is an open source OpenGL C++ library, which provides physically based camera rendering and parameters. It is based on OpenGL and designed to be used as either static library or dynamic library and can be integrated in existing applications.
       
      The following features are implemented:
      Physically based sensor and focal length calculation Autoexposure Manual exposure Lense distortion Bloom (influenced by ISO, Shutter Speed, Sensor type etc.) Bokeh (influenced by Aperture, Sensor type and focal length) Tonemapping  
      You can find the repository at https://github.com/0x2A/physicam
       
      I would be happy about feedback, suggestions or contributions.

    • By altay
      Hi folks,
      Imagine we have 8 different light sources in our scene and want dynamic shadow map for each of them. The question is how do we generate shadow maps? Do we render the scene for each to get the depth data? If so, how about performance? Do we deal with the performance issues just by applying general methods (e.g. frustum culling)?
      Thanks,
       
  • Popular Now