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

  • Home
  • SEARCH
  • 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 4268054
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:58:59+00:00 2026-05-21T06:58:59+00:00

Making a 2D OpenGL game. When rendering a frame I need to first draw

  • 0

Making a 2D OpenGL game. When rendering a frame I need to first draw some computed quads geometry and then draw some textured sprites. When the body of my render method only draws the sprites, everything works fine. However, when I try to draw my geometric quads prior to the sprites the texture of the sprite changes to be the color of the last GL.Color3 used previously. How do I tell OpenGL (well, OpenTK) “Ok, we are done drawing geometry and its time to move on to sprites?”

Here is what the render code looks like:

        // Let's do some geometry 
        GL.Begin(BeginMode.Quads);
        GL.Color3(_dashboardBGColor);  // commenting this out makes my sprites look right

        int shakeBuffer = 100;
        GL.Vertex2(0 - shakeBuffer, _view.DashboardHeightPixels);
        GL.Vertex2(_view.WidthPixelsCount + shakeBuffer, _view.DashboardHeightPixels);
        GL.Vertex2(_view.WidthPixelsCount + shakeBuffer, 0 - shakeBuffer);
        GL.Vertex2(0 - shakeBuffer, 0 - shakeBuffer);

        GL.End();

        // lets do some sprites
        GL.Begin(BeginMode.Quads);
        GL.BindTexture(TextureTarget.Texture2D, _rockTextureId);

        float baseX = 200;
        float baseY = 200;

        GL.TexCoord2(0, 0); GL.Vertex2(baseX, baseY);
        GL.TexCoord2(1, 0); GL.Vertex2(baseX + _rockTextureWidth, baseY);
        GL.TexCoord2(1, 1); GL.Vertex2(baseX + _rockTextureWidth, baseY - _rockTextureHeight);
        GL.TexCoord2(0, 1); GL.Vertex2(baseX, baseY - _rockTextureHeight);  

        GL.End();

        GL.Flush();
        SwapBuffers();
  • 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-21T06:59:00+00:00Added an answer on May 21, 2026 at 6:59 am

    The default texture environment mode is GL_MODULATE, which does that, it multiplies the texture color with the vertex color.

    A easy solution is to set the vertex color before drawing a textured primitive to 1,1,1,1 with:

    glColor4f(1.0f, 1.0f, 1.0f, 1.0f);

    Another solution is to change the texture environment mode to GL_REPLACE, which makes the texture color replace the vertex color and doesn’t have the issue:

    glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

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

Sidebar

Related Questions

I'm trying to draw a car for a game I'm making using OpenGL. The
I'm making an opengl game for iPhone. And I'm about to start adding sound
Little background.. I'm in the process of making an OpenGL game using Java and
I'm making a relatively simple OpenGL ES based iPhone game. While testing on the
While making a little Pong game in C++ OpenGL, I decided it'd be fun
okay i'm making a game using c++ (for the engine) and openGL, now i've
I'm making a 3D game with OpenGL that basically has a world made entirely
I am making a kind of first person game but my view seems to
I'm making a Minecraft clone as my very first OpenGL project and am stuck
I'm making a Minecraft -ish terrain engine to learn some OpenGL and 3D and

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.