Jump to content
  • Advertisement
Sign in to follow this  
cifa

Different results with animation made via shader or bufferSubData

This topic is 1932 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

 
 
 
 
 
EDIT: ERROR FOUND. I was an idiot using different formulas. This topic can be destroyed
Edited by cifa

Share this post


Link to post
Share on other sites
Advertisement

Hi ! First , did you initialized you buffed with 

 

bufferData(GLenum target, GLsizeiptr size, GLenum usage);

 

You have to do it before use bufferSubData , you can initliaze it at null like this.

 

gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(null), gl.STATIC_DRAW);

 

Second, why would you use subdata ? It's just a question i'm a beginner too smile.png. I would have used bufferdata, because, for me, subdata are more to store color data and vertex datas in the same bufferdata.

 

And why don't you do a var newPos = []; at the beginning of your wave but a slice at the end (it's less safe , no?, and you'll win in performance by having a local scope variable with JS).

 

Maybe you could try to use GlClearBufferSubData after passing your vertex to the shader,

 

I'm looking forward other answers.

Share this post


Link to post
Share on other sites

Hi ! First , did you initialized you buffed with 

 

bufferData(GLenum target, GLsizeiptr size, GLenum usage);

 

You have to do it before use bufferSubData , you can initliaze it at null like this.

 

gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(null), gl.STATIC_DRAW);

 

Second, why would you use subdata ? It's just a question i'm a beginner too smile.png. I would have used bufferdata, because, for me, subdata are more to store color data and vertex datas in the same bufferdata.

 

And why don't you do a var newPos = []; at the beginning of your wave but a slice at the end (it's less safe , no?, and you'll win in performance by having a local scope variable with JS).

 

Maybe you could try to use GlClearBufferSubData after passing your vertex to the shader,

 

I'm looking forward other answers.

 

 

Yup I've done the bufferData previously :) 

 

Using subdata for this animation actually doesn't make a lot of sense to me, but I need to do that as I need to look at some data.

 

 

The newPos part is actually realy something to which I didn't pay attention, the optimization part will come later, however thanks for the tip :D 

Share this post


Link to post
Share on other sites

Ok, so i don't see why.

 

Can you give us the solution plz? You said that you inversed formulas. Which ones? 

Share this post


Link to post
Share on other sites

Ok, so i don't see why.

 

Can you give us the solution plz? You said that you inversed formulas. Which ones? 

 

 

 

The animation formulas biggrin.png Just the coordinate modification was wrong in the function used by the subData version

Edited by cifa

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!