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 6468079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:51:23+00:00 2026-05-25T05:51:23+00:00

I am writing some proof-of-concept code. I want to prove that I can write

  • 0

I am writing some proof-of-concept code. I want to prove that I can write data to a buffer object after the buffer has been created. However, I am getting a a GLenum error code of 1280 when I try to unmap the buffer after writing to it. I am completely stymied.

I can initialize the buffer the with color data and successfully render it. The problem is that I cannot modify the data in the buffer afterwards. The code is below. It shows how I write the new data to the buffer and then how I try to read it back. The error codes are shown in comments after the glGetError() calls. The variable “cbo” is the color buffer:

//NEW COLOR DATA
GLubyte colorData2[9] = {255,255,0, 0,128,255, 255,0,255};

//WRITE THE DATA TO THE COLOR BUFFER OBJECT (variable cbo)
glBindBuffer(GL_ARRAY_BUFFER, cbo);
int err1 = glGetError();  //Error code 0

//Oddly, glMapBuffer always returns and invalid pointer.
//GLvoid * pColor = glMapBuffer(GL_ARRAY_BUFFER, GL_MAP_WRITE_BIT); 

//However, glMapBufferRange return a pointer that looks good 
GLvoid * pColor = glMapBufferRange(GL_ARRAY_BUFFER, 0, 9, GL_MAP_WRITE_BIT);
int err2 = glGetError(); //Error code 0

// Copy colors from host to device
memcpy(pColor, colorData2, 9);

//Unmap to force host to device copy
glUnmapBuffer(cbo);
int err3 = glGetError(); //Error code 1280

//Unbind
glBindBuffer(GL_ARRAY_BUFFER, 0);
int err4 = glGetError(); //Error code 0

//******TEST THE WRITE******
GLubyte readbackData[9];
glBindBuffer(GL_ARRAY_BUFFER, cbo);
int err5 = glGetError(); //Error code 0
GLvoid * pColorX = glMapBufferRange(GL_ARRAY_BUFFER, 0, 9, GL_MAP_READ_BIT);
int err6 = glGetError(); //Error code 1282

//Mem copy halts because of a memory exception. 
memcpy(readbackData, pColorX, 9);

glUnmapBuffer(cbo);
glBindBuffer(GL_ARRAY_BUFFER, 0);

Here is the code where I created the buffer object:

//Create color buffer
glGenBuffers(1, &cbo);
glBindBuffer(GL_ARRAY_BUFFER, cbo);

//Create space for three RGB 8-bit color objects
colorBufferSize = 3 * numColorChannels * sizeof(GLubyte);
glBufferData(GL_ARRAY_BUFFER, colorBufferSize, colorData, GL_DYNAMIC_DRAW);

//Unbind
glBindBuffer(GL_ARRAY_BUFFER, 0);
  • 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-05-25T05:51:23+00:00Added an answer on May 25, 2026 at 5:51 am

    1280, or 0x0500, is GL_INVALID_ENUM.

    glUnmapBuffer takes the enum where the buffer object is bound, not the buffer object to unmap. glUnmapBuffer expects the buffer object to be unmapped to be bound to that binding target. So glUnmapBuffer(GL_ARRAY_BUFFER) will unmap whatever is currently bound to the GL_ARRAY_BUFFER binding.

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

Sidebar

Related Questions

In writing some code today, I have happened upon a circumstance that has caused
I'm writing some code that will take a screenshot of another application, given its'
I've got a proof-of-concept program which is doing some interprocess communication simply by writing
Im writing some code in R whereby i need to generate a data set
Writing some docs with code snippets which I want to be copyable to run
While writing some C code, I decided to compile it to assembly and read
I am re-writing some code for a new re-design and I am wondering if
I'm writing some html code to make an html email. I've done some research
I am writing some BASH script and I want it have some error handling
I'm writing some xUnit tests for some helper classes that relies on some configuration

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.