Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8891333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:42:55+00:00 2026-06-14T22:42:55+00:00

After doing some computation on the GPU I want to copy the results stored

  • 0

After doing some computation on the GPU I want to copy the results stored in the FBO to VBOs for rendering.

The problem: It looks like some of the data is corrupted when I do the copy. I’ve already checked both buffers’ format and size, and also checked that the data stored in the FBO is correct.

Consider the following code that initializes the FBO:

unsigned int verticesTextureId = AllocateTexture(GL_TEXTURE_RECTANGLE, mVBOSize, 1, GL_RGBA32F, GL_RGBA);
CHECK_FOR_OPENGL_ERRORS();

unsigned int normalsTextureId = AllocateTexture(GL_TEXTURE_RECTANGLE, mVBOSize, 1, GL_RGBA32F, GL_RGBA);
CHECK_FOR_OPENGL_ERRORS();

SetUpViewport(mVBOSize, 1);

glBindFramebuffer(GL_FRAMEBUFFER, mFBOId);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_RECTANGLE, verticesTextureId, 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_RECTANGLE, normalsTextureId, 0);

And the following code that initializes the VBOs and copies data from the FBO to the VBOs:

mVerticesBufferId = AllocateVBO();
CHECK_FOR_OPENGL_ERRORS();

glBindBuffer(GL_PIXEL_PACK_BUFFER, mVerticesBufferId);
glBufferData(GL_PIXEL_PACK_BUFFER, mVBOSize * 4 * sizeof(float), 0, GL_STATIC_DRAW);

mNormalsBufferId = AllocateVBO();
CHECK_FOR_OPENGL_ERRORS();

glBindBuffer(GL_PIXEL_PACK_BUFFER, mNormalsBufferId);
glBufferData(GL_PIXEL_PACK_BUFFER, mVBOSize * 4 * sizeof(float), 0, GL_STATIC_DRAW);

glReadBuffer(GL_COLOR_ATTACHMENT0);
glBindBuffer(GL_PIXEL_PACK_BUFFER, mVerticesBufferId);
glReadPixels(0, 0, mVBOSize, 1, GL_RGBA, GL_FLOAT, 0);

glReadBuffer(GL_COLOR_ATTACHMENT1);
glBindBuffer(GL_PIXEL_PACK_BUFFER, mNormalsBufferId);
glReadPixels(0, 0, mVBOSize, 1, GL_RGBA, GL_FLOAT, 0);

Here I bind the VBOs as vertex/normal attributes and call the draw:

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);

glBindBuffer(GL_ARRAY_BUFFER, mVerticesBufferId);
glVertexPointer(4, GL_FLOAT, 4 * sizeof(float), 0);

glBindBuffer(GL_ARRAY_BUFFER, mNormalsBufferId);
glNormalPointer(GL_FLOAT, 4 * sizeof(float), 0);

glDrawArrays(GL_POINTS, 0, mVBOSize);

glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);

After this call, most points appear correctly on screen, but some appear strangely out of place. This seems to be unrelated to signal or clamping because vertices with negative or greater than 1 components are being displayed correctly.

I’m attaching pictures of a kosh snowflake (a curve) that’s not being correctly rendered.

1) Vertices rendered as points:

Kosh Snowflake (with wrong vertices rounded with red circles)

2) Vertices rendered as line strips, using a simple geometry shader:

Kosh Snowflake (wrong vertices circled in red)

Reference Image:

Correct Kosh Snowflake

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:42:57+00:00Added an answer on June 14, 2026 at 10:42 pm

    Using gDEBugger I found that the data on my VBOs were also correct. The problem was that after fragment shader computation, the homogeneous component of my vectors (the w) had garbage on them, which produced unwanted effects on transforms.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting a getaddress error and after doing some sleuthing, it looks like it
I have an activity with some views, after doing some stuff I want to
This seemed like a common question but after doing some searching, I wasn't really
After doing some Core animations using: [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.5]; [self setAffineTransform:CGAffineTransformIdentity]; [UIView
After doing some research on the subject, I've been experimenting a lot with patterns
After doing some experimentation with move semantics with an array type I created, I
Update: I updated this after doing some digging and realizing that this might be
I am building my own torrent site and after doing some research I have
I got this message when doing some javascript programming, and after some google searches,
After doing some research, it would seem that errno 150 occurs when either table

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.