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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:11:20+00:00 2026-06-11T17:11:20+00:00

A game uses software rendering to draw a full-screen paletted (8-bit) image in memory.

  • 0

A game uses software rendering to draw a full-screen paletted (8-bit) image in memory.

What’s the fastest way to put that image on the screen, using OpenGL?

Things I’ve tried:

  • glDrawPixels with glPixelMap to specify the palette, and letting OpenGL do the palette mapping. Performance was horrendous (~5 FPS).
  • Doing palette mapping (indexed -> BGRX) in software, then drawing that using glDrawPixels. Performance was better, but CPU usage is still much higher than using 32-bit DirectDraw with the same software palette mapping.

Should I be using some kind of texture instead?

  • 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-11T17:11:22+00:00Added an answer on June 11, 2026 at 5:11 pm
    • glDrawPixels with glPixelMap to specify the palette, and letting OpenGL do the palette mapping. Performance was horrendous (~5 FPS).

    That’s not a surprise. glDrawPixels is not very fast to begin with and glPixelMap will do the index/palette → RGB conversion on the CPU in a surely not very optimized codepath.

    • Doing palette mapping (indexed -> BGRX) in software, then drawing that using glDrawPixels.

    glDrawPixels is about one of the slowest functions in OpenGL there is. This has two main reasons: First it’s a codepatch not very much optimized, second it writes directly into the target framebuffer, hence forcing the pipeline into synchronization every time it’s called. Also on most GPU it isn’t backed by any cache.

    What I suggest is you place your indexed image into single channel texture, e.g. GL_R8 (for OpenGL-3 or later) or GL_LUMINANCE8, and your palette into a 1D RGB texture, so that the index used as texture coordinate does look up the color. Using a texture as a LUT is perfectly normal. With this combination you use a fragment shader for in-situ palette index to color conversion.

    The fragment shader would look like this

    #version 330
    
    uniform sampler2D image;
    uniform sampler1D palette;
    
    in vec2 texcoord;
    
    void main()
    {
        float index = tex2D(image, texcoord).r * 255.f; // 255 for a 8 bit palette
        gl_FragColor = texelFetch(palette, index, 0);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a game that uses layers as a way to organize depth. It
I have a game which uses OpenGL ES for rendering. And it requires that
I'm writing a game that uses WPF for its interface, and Direct3D11 for rendering
Im currently working on a game that uses multi touch to apply zoom to
I have a cocos2d powered game that uses UIKit menues, so I only use
I've made a small game that uses level, and level is just a int
I'm working on a game that uses local area network. Like most of multiplayer
I've built a simple snake game that uses a Main class (this is my
My game normally uses GL_TEXTURE_RECTANGLE_EXT to draw 2D textures. However, since this isn't supported
I'm writing a game which uses 3D models to draw a scene (top-down orthographic

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.