Sign in to follow this  

render to vertex array

This topic is 3808 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, it is almost the same problem than in this topic : [URL]http://www.gamedev.net/community/forums/topic.asp?topic_id=372387[/URL] the thing is that it is a bit old now (2006 the last answer).... I just want to take from my FBO the position of particle and put in a VBO for rendering. is the PBO/VBO is always the best solution? I heard about superbuffers?vertex texture? Is there any example available for render to vertex array (I can't find one!!!just people speacking about) thanks

Share this post


Link to post
Share on other sites
hello,

I used the tutorial

I choose to copy to a PBO and after to the VBO

but it doesn't work!!!!.........................; :evil: :twisted: :x :( :cry:
is it the good way to do it?? look at my code :


void DrawGLScene()
{
if (!p1->check() || !p2->check() || !p3->check() || !p4->check()){
// Calling glFinish() is only neccessary to get accurate timings,
// and we need a high number of iterations to avoid timing noise.
glFinish();
start = clock();

p1->resetForce();
p2->resetForce();
p3->resetForce();
p4->resetForce();

p1->computeForce();
p2->computeForce();
p3->computeForce();
p4->computeForce();

bindToText();
initFBO();

performComputation();

transferFromTexture(data,0);
transferFromTexture(data2,1);
transferFromTexture(force,2);

setParticle();

copyFBOtoPBO();

drawVBO();

glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT0_EXT, target, 0, 0);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT1_EXT, target, 0, 0);

glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
glFinish();
end = clock();
total += (end-start);
printf("total time = %lf\n",total);
}

}


the function VBO/PBO are the same that the tutorial:

void copyFBOtoPBO(void){
glReadBuffer(attachmentpoints[flag]);
glBindBufferARB(GL_PIXEL_PACK_BUFFER_EXT, vbo_vertices_handle);
glReadPixels(0, 0, texSize, texSize, GL_RGBA, GL_FLOAT, 0);

glReadBuffer(GL_NONE);
glBindBufferARB(GL_PIXEL_PACK_BUFFER_EXT, 0 );
}
void drawVBO(void){
glBindBufferARB(GL_ARRAY_BUFFER_ARB, vbo_vertices_handle);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer ( 4, GL_FLOAT,4*sizeof(float), (char *) 0);

glDisable(GL_LIGHTING);
glColor3f(1, 1, 1);

glDrawArrays( GL_TRIANGLES, 0,texSize*texSize );
glEnable(GL_LIGHTING);
glDisableClientState(GL_VERTEX_ARRAY);
}


and I init the VBO in the main with :

void initVBO(void){
glGenBuffersARB(1, &vbo_vertices_handle);
glBindBufferARB(GL_PIXEL_PACK_BUFFER_EXT, vbo_vertices_handle);
glBufferDataARB(GL_PIXEL_PACK_BUFFER_EXT, texSize*texSize*4*sizeof(float),NULL, GL_STREAM_DRAW_ARB );
}


without the VBO when I do a transferFromTexture I have the good thing in the array "data" but with the VBO it is not the same....
I should just read from my Attachmentpoint and not write on it (with the VBO)..isn't it?

Share this post


Link to post
Share on other sites

This topic is 3808 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this