Jump to content
  • Advertisement
Sign in to follow this  
leoptimus

OpenGL Passing Shader Parameters VB

This topic is 4859 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! I'm using OpenGL shading language, and there is need to pass a large amount of data as an Uniform Variable. Currently I pass this uniform variable as an array, with this command: void glUniform3ivARB(GLint location, GLsizei count, const GLint *value) However, that implies to move a lot of data from my App to the GPU. The cuestion is: Can I use glUniform3ivARB with VertexBuffers? how to pass info with VB?

Share this post


Link to post
Share on other sites
Advertisement
What is it actually you want to do? if the data you want to make available is large and doesn't change very often you can always pass it in as a texture instead. Feel free to explain a bit more about what you are trying to do and we should be able to help out better.

Share this post


Link to post
Share on other sites
Thanks Rollo, That's great!
Using a texture sampler for passing additional data is a great Idea!
Currently, I'm writing a Vertex Skinning program, which must receive an array of vertex-to-bone assignment like this:

struct VERTEXBONE_ASSIGNMENT
{
REAL m_boneindex;
REAL m_boneweight;
};

The problem is that this element cannot be attached to each vertex; each vertex-to-bone element has independecy of vertices. Also, the vertex bone array info has more elements that model vertex array.
Each vertex has attributes that addressing to VERTEXBONE_ASSIGNMENT elements, F.E. The vertex declaration would be:
struct MY_VERTEX
{
float3 vertice;
float3 normal;
float2 texcoords;
///address to bone assignment array
float m_vb_assignment_offset;
float m_vb_assignment_count;
};

There is needed to treat vertex-to-bone array as an alternative stream source.
Textures may help

Share this post


Link to post
Share on other sites
Disclaimer: I havent actually implemented skinning in a shader, so take my comments with a big cup of salt...

From what I understand your plan is to support a variable number of bones per vertex. Unfortunatly textures wont help you much unless you are using a SM3 card (texture sampling in vertex shader). If you have that capability it would be interresting to see your results.

How about:
1) set a big uniform array like you suggested (you might run out of uniform space here maybe?)
2) fixed (N) maximum amount of bones affecting each vertex. Pass in N weights and bone indices per vertex. Have separate shader versions for different amounts and when you need to render the skinned object pick the best fit shader and use zero weights for bones you dont need.

[Edited by - rollo on December 4, 2005 8:51:41 AM]

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!