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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:27:00+00:00 2026-06-10T21:27:00+00:00

I am use vertex buffers (in a fixed function pipeline) to batch triangle strips

  • 0

I am use vertex buffers (in a fixed function pipeline) to batch triangle strips by repeating first/last vertices. The rendering code is as follows:

    glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);

    // enable vertex array
    glEnableClientState(GL_VERTEX_ARRAY);
    glVertexPointer(3, GL_FLOAT, 3*sizeof(GLfloat), 0);

    // prepare color VBO
    glBindBuffer(GL_ARRAY_BUFFER, _colorBuffer);

    // enable color array
    glEnableClientState(GL_COLOR_ARRAY);
    glColorPointer(3, GL_FLOAT, 3*sizeof(GLfloat), 0);

    // prepare normals VBO
    glBindBuffer(GL_ARRAY_BUFFER, _normalBuffer);

    // enable normal array
    glEnableClientState(GL_NORMAL_ARRAY);
    glNormalPointer(GL_FLOAT, 0, 0);

    glDrawArrays(mode, 0, _nVertices);      

    // disable/unbind
    glDisableClientState(GL_VERTEX_ARRAY);
    glDisableClientState(GL_COLOR_ARRAY);
    glDisableClientState(GL_NORMAL_ARRAY);
    glBindBuffer(GL_ARRAY_BUFFER, 0);

But, although the triangle strips are separated correctly, the lighting is correct only for the first triangle strip.

In the example below, I am rendering a pentagon and a square, and you can see that the lighting is correct only for the pentagon.

enter image description here

This is the data in the 3 (vertex, normal, color) vertex buffers. You can see that the last vertex of the pentagon and the first vertex of the square is repeated, and that the normals are consistent.


vertices:

-2.000000 1.000000 0.000000
-1.000000 0.000000 0.000000
-1.000000 2.000000 0.000000
0.000000 0.000000 0.000000
0.000000 2.000000 0.000000
0.000000 2.000000 0.000000
1.000000 -1.000000 0.000000
1.000000 -1.000000 0.000000
1.000000 -2.000000 0.000000
2.000000 -1.000000 0.000000
2.000000 -2.000000 0.000000

normals:

-0.000000 0.000000 1.000000
-0.000000 0.000000 1.000000
-0.000000 0.000000 1.000000
-0.000000 -0.000000 1.000000
-0.000000 0.000000 1.000000
-0.000000 0.000000 1.000000
-0.000000 0.000000 1.000000
-0.000000 0.000000 1.000000
-0.000000 0.000000 1.000000
-0.000000 0.000000 1.000000
-0.000000 -0.000000 1.000000

colors:

0.317647 0.011765 0.458824
0.317647 0.011765 0.458824
0.317647 0.011765 0.458824
0.317647 0.011765 0.458824
0.317647 0.011765 0.458824
0.317647 0.011765 0.458824
0.678431 0.003922 0.003922
0.678431 0.003922 0.003922
0.678431 0.003922 0.003922
0.678431 0.003922 0.003922
0.678431 0.003922 0.003922

Why is the lighting wrong for the square?

  • 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-10T21:27:01+00:00Added an answer on June 10, 2026 at 9:27 pm

    Apparently the issue has to do with the number of degenerate triangles added when you combine 2 triangle strips. This can change the vertex ordering, thus making the direction of your normals inconsistent.

    I solved the above problem by adding adding an extra redundant vertex when the current running length of the triangle strip is odd.

    The link below has a lot of useful information on construction and joining of triangle strips:

    http://www.codercorner.com/Strips.htm

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

Sidebar

Related Questions

I often use references to simplify the appearance of code: vec3f& vertex = _vertices[index];
I'm trying to animate object. I use keyframe animation: I have two vertex buffers
I'd like to use Vertex Buffer Objects (VBOs) to improved my rendering of somewhat
I tried to use this tutorial with Golang: http://www.opengl-tutorial.org/beginners-tutorials/tutorial-2-the-first-triangle/ The go-version opens the window
I am writing a Graph-class using boost-graph-library. I use custom vertex and edge properties
In my vertex declaration I can use various data types for color. Including: INT
In OpenGL, is there a way to use framebuffer data as vertex data without
I'm currently passing an array to a function, then attempting to use glGenBuffers with
Do I need to use one vertex buffer per mesh, or can I store
I have a vertex shader that transforms vertices to create a fisheye affect. Is

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.