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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:52:40+00:00 2026-06-13T19:52:40+00:00

To make a lighting system for a voxel game, I need to specify a

  • 0

To make a lighting system for a voxel game, I need to specify a darkness value per vertex. I’m using GL_COLOR_MATERIAL and specifying a color per vertex, like this:

glEnable(GL_COLOR_MATERIAL);

glBegin(GL_QUADS);

glColor3f(0.6f, 0.6f, 0.6f);
glTexCoord2f(...);
glVertex3f(...);

glColor3f(0.3f, 0.3f, 0.3f);    
glTexCoord2f(...);
glVertex3f(...);

glColor3f(0.7f, 0.7f, 0.7f);        
glTexCoord2f(...);
glVertex3f(...);

glColor3f(0.9f, 0.9f, 0.9f);
glTexCoord2f(...);
glVertex3f(...);

glEnd();

This is working, but with many quads it is very slow. I’m using display lists too. Any good ideas in how to make vertices darker?

  • 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-13T19:52:42+00:00Added an answer on June 13, 2026 at 7:52 pm

    You’re using immediate mode (glBegin, glEnd and everything in between). If performance is what you need, then I recommend you stop doing that.

    What you’re probably after is a generic vertex attribute. And lo and behold: Modern OpenGL actually has exactly this: Generic attributes. They even went so far, doing the right thing and do away with the predefined attributes (position, color, normal, texcoords, etc.) and have only generic attributes in OpenGL-3 core and later.

    The functions glVertexAttrib (most of the time a Uniform does the job better) and glVertexAttribPointer are your friends. Specify how vertex attributes are processed using an appropriate vertex shader.

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

Sidebar

Related Questions

I need to make rounded inputs with inner lighting like on this picture: I
I make an app that have to printing image. I need to print image
I need to create good looking lightning using OpenGL ES 1.1 (iPhone) and was
I'm using texture-based DOT3 lighting to achieve bump mapping on older iPhones, and I'm
I'm working on a 2D game using C++ and DirectX9 and I've got a
I am trying to make my lighting similar to Terraria's, block-lighting. Now, I know
I'm trying to make a simple Simon game (an increasing sequence of colors flash
make /bin/sh /Users/myusername/Downloads/php-5.3.5/ext/mssql/libtool --mode=compile cc -I. -I/Users/myusername/Downloads/php-5.3.5/ext/mssql -DPHP_ATOM_INC -I/Users/myusername/Downloads/php-5.3.5/ext/mssql/include -I/Users/myusername/Downloads/php-5.3.5/ext/mssql/main -I/Users/myusername/Downloads/php-5.3.5/ext/mssql -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM
Make it on Linux. The reason to use more than one version of Vim,
I make a picture with phone (640*480) and put it inside uiimageview (300*300) with

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.