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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:34:43+00:00 2026-05-27T04:34:43+00:00

im trying to paint 512*512 points , which each point uses its neighbors. for

  • 0

im trying to paint 512*512 points , which each point uses its neighbors.
for example

glBegin(GL_TRIANGLE_STRIP);
glVertex(x,y,z);
glVertex(x+1,y,z);
glVertex(x,y,z+1);
glVertex(x+1,y,z+1);
glEnd();

the problem is that it works quite slow , i know i can use VBO (working with CUDA aswell) but im not sure how to define the VBO to work with GL_TRIANGLE_STRIP and how to set the painting order of the vertices.

  • 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-27T04:34:43+00:00Added an answer on May 27, 2026 at 4:34 am

    One way to use VBOs (there are variants, using the old Vertex Array API, directly uploading the data with glBufferData and other nice things).

    GLuint vbo; // this variable becomes a handles, keep them safe
    GLuint idx;
    
    glGenBuffers(1, &vbo);
    glBindBuffer(GL_ARRAY_BUFFER, vbo);
    glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat)*512*512*3, NULL, GL_STATIC_DRAW);
    GLfloat *vbuf = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE);
    fill_with_vertex_data(vbo);
    glUnmapBuffer(GL_ARRAY_BUFFER);
    
    glGenBuffers(1, &idx);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vbo);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLuint)*512*512*4, NULL, GL_STATIC_DRAW);
    GLfloat *ibuf = glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE);
    GLuint restart_index = 0xffff;
    fill_with_indices_restart(ibuf, restart_index); // 0xffff is the restart index to be used, delimiting each triangle strip.
    glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER);
    
    /* ... */
    
    glEnableVertexAttribArray(vertex_position_location);
    
    glBindBuffer(GL_ARRAY_BUFFER, vbo);
    glVertexAttrxPointer(vertex_position_location, 3, GL_FLOAT, GL_FALSE, 0, 0);
    
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, idx);
    glPrimitiveRestartIndex(restart_index);
    glDrawElements(GL_TRIANGLE_STRIP, 0, count, 0);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to paint cell on a html page, where each cell is
I am trying to paint a series of rectangles on the glass pane as
I was trying to paint border around JLabel when it is clicked. Just like
I'm programming a short Paint program like and I'm trying to make an MDI
I'm trying to capture the screen and then paint the image to a JFrame
I am need paint my image. I'm trying use JQuery in here this link:
I'm currently trying to analyze large data sets (40 000+ data points) with matlab.
I'm trying to understand how I can paint simple graphics in x86 protected mode
I am trying to figure out on which data the crc32 field in the
I am newbie to android game development. I've been trying an example of game

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.