Jump to content

  • Log In with Google      Sign In   
  • Create Account


Different results with animation made via shader or bufferSubData


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 cifa   Members   -  Reputation: 194

Like
1Likes
Like

Posted 02 June 2013 - 04:47 PM

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

Edited by cifa, 03 June 2013 - 04:30 PM.


Sponsor:

#2 Shocoben   Members   -  Reputation: 116

Like
0Likes
Like

Posted 03 June 2013 - 03:39 PM

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.



#3 cifa   Members   -  Reputation: 194

Like
0Likes
Like

Posted 03 June 2013 - 03:45 PM

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 



#4 shocobenn   Members   -  Reputation: 273

Like
0Likes
Like

Posted 04 June 2013 - 02:19 AM

Ok, so i don't see why.

 

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



#5 cifa   Members   -  Reputation: 194

Like
0Likes
Like

Posted 04 June 2013 - 09:54 AM

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, 04 June 2013 - 09:55 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS