Jump to content
  • Advertisement
Sign in to follow this  
putenuter

OpenGL From Vertex Shader back to OpenGL-Transformation ?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there ! I just have programmed a custom vertex shader for my OpenGL-based game. But now I want to make it run even on graphic cards which are not able to load custom vertex shaders. So I want to compute all necessary transformations on the CPU. My Problem is, that I have to transform ALL Vertices (or Polygons) in my scene by a 4x4-matrix, which has to be recomputed every frame. Does anybody know which OpenGL-methods to use ? Do I have to modify the OpenGL-modelview-matrix or the projection matrix ? I am currently quite desperate about this issue, I hope somebody knows a option how to "migrate" a vertex shader back to the CPU.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by putenuter
Hi there !

I just have programmed a custom vertex shader for my OpenGL-based game.
But now I want to make it run even on graphic cards which are not able to load custom vertex shaders. So I want to compute all necessary transformations on the CPU.

My Problem is, that I have to transform ALL Vertices (or Polygons) in my scene by a 4x4-matrix, which has to be recomputed every frame.

Does anybody know which OpenGL-methods to use ? Do I have to modify the OpenGL-modelview-matrix or the projection matrix ?

I am currently quite desperate about this issue, I hope somebody knows a option how to "migrate" a vertex shader back to the CPU.


Transform all vertices by a 4x4 matrix? That would very likely be the modelview matrix (load it with glLoadMatrix).
What is the purpose? Camera class? If it's a camera class, then yes, go for modelview.

Share this post


Link to post
Share on other sites
I just have programmed a custom vertex shader for my OpenGL-based game.
But now I want to make it run even on graphic cards which are not able to load custom vertex shaders. So I want to compute all necessary transformations on the CPU.


I think your should pass your computed values by glUniformXX to your shaders, all is according your own program.

To Disable shaders ? glUseProgram(0),please lookup some function in documents

Share this post


Link to post
Share on other sites
First of all, cross-posting is not good.

Second, why do you need a vertex shader for something so simple as transforming the vertices with a matrix? You are aware that vertex shaders is not the beginning of vertex transformations, right? There was life before them. It seems to me that you jumped directly to shaders without understanding the traditional pipeline first. You can compute the matrix and use glLoadMatrix() or glMultMatrix() to load it or multiply it with the current matrix respectively.

Third, what do you mean if you have to use the projection or the modelview matrix? It depends what is it that you want to do. It's probably the modelview, but if you have to ask you need to go back to the Red Book and learn the basics first well before you start messing with such advanced topics as shaders.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!