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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:33:24+00:00 2026-05-24T02:33:24+00:00

I have a curved surface defined by a number of triangular faces. The entire

  • 0

I have a curved surface defined by a number of triangular faces. The entire surface has single color.

So far I was drawing each triangle separately. For each triangle I was passing 3 vertices, 3 indices, 3 color values (of same color) and 3 normal values (all equal to surface normal of triangle). Then I would push all these arrays to VBO and render the curved surface.

Recently I realized this is pretty wasteful compared to the texture method of rendering. Now I create a texture out of a 2×2 array of pixels (all of the same color that I want for the curved surface). Then I calculate texture coordinates (s,t) for all the vertices on the curved surface. Thus I effectively stretch the 2×2 pixel texture to fit to my curved surface. This works pretty OK, for some surfaces. Also this requires much smaller size buffers (because now the vertices have only single normal and color value, therefore they have to be mentioned only once). However by this method, sometimes the curved surface doesn’t render at all. My suspicion is in the way I calculate the texture coordinates. It’s alright if a surface is slightly curved, but when the surface revolves around an axis and forms a closed boundary then the texture coordinates seem to confuse the graphic card.

My question is, what’s a recommended way in OpenGL ES, of drawing surfaces with a single color?

UPDATE – Explanation on accepting the answer

It took me a while to understand how genpfault’s answer will work. So here’s an explanation. Above I have described two methods of drawing plain colored surfaces – 1. using rgba color values, 2. using textures that have single color. genpfault’s answer explains how to do method 1 efficiently.

I had implemented first method by passing the same rgba color values per vertex multiple times. Therefore I was reading this color value in the vertex shader code as an attribute. In genpfault’s method, we set the color as a uniform variable before calling drawArray/Elements. This will require change in vertex shader to read the value from a uniform variable, instead of an attribute.

  • 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-24T02:33:24+00:00Added an answer on May 24, 2026 at 2:33 am

    Just set the current color via glColor() before rendering each patch.

    That way you don’t have to pass in per-vertex color components.

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

Sidebar

Related Questions

in a simple drawing application I have a model which has a NSMutableArray curvedPaths
I am trying to style a select drop down box. So far, I have
I want to put a 3d curved look in a list item I have
I have a container that I'm applying curved corners to with css3pie. Inside that
I'm trying to draw curved arrows in a html canvas. I have no problem
I have an array that contains the points for drawing multiple hills. When I
I want to have a curved shield in front of my space ship to
I have a UIView subclass that draws a curved line within it's frame (using
I have a button with a curved image set as its foreground image. It
Does anyone have any examples or source for letting users draw curved maps from

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.