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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:54:56+00:00 2026-05-24T09:54:56+00:00

I am using OpenGL 1.3 to do 2D sprite rendering and supporting both POTS

  • 0

I am using OpenGL 1.3 to do 2D sprite rendering and supporting both POTS (power of two size) textures and NPOTS (non power of two size) textures with TEXTURE_2D and TEXTURE_RECTANGLE_ARB respectively.

I had started with POTS textures (using TEXTURE_2D), which worked fine, but now I am adding NPOTS textures (using TEXTURE_RECTANGLE_ARB). This addition has caused the POTS textures (with TEXTURE_2D) to break.

By break I mean that the POTS textures are rendered as a grayscale gradient ranging from gray in the bottom left corner and white in the top right.

An extra point (discovered whilst trying to fix this error) – One big difference between TEXTURE_RECTANGLE_ARB and TEXTURE_2D is that the first uses non-normalised coordinates on the textures, whereas TEXTURE_2D uses normalised coordinates ([0.0,1.0]). I decided to check and replace the TEXTURE_2D’s normalised coordinates with non-normalised coordinates, and this removed the grayscale problem by creating another – it was rendering the wrong texture!

I.e. when using a POTS and an NPOTS texture, my POTS texture tries to render the NPOTS texture.

Does anyone have any idea why this might be happening? Thankyou!

  • 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-24T09:54:57+00:00Added an answer on May 24, 2026 at 9:54 am

    Okay, so it turns out that it was a rather silly mistake, that was found in the original TEXTURE_2D code. I had forgotten to end the rendering with the correct glDisable!

    I.e. the rendering code began with glEnable(targetType), but did not end with glDisable(targetType) [where targetType was the correct choice of GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE_ARB].

    I guess, somehow, the two rendering environments got intertwined.

    Lesson – make sure when you begin with glEnable that you end with glDisable.

    Edit: Considering the below comment, I did a little digging and found out about target presidence. The idea is presented in the beginning of this article:

    http://math.hws.edu/graphicsnotes/c4/s5.html

    “At most one texture target will be used when a surface is rendered. If several targets are enabled, 3D textures have precedence over 2D textures, and 2D textures have precedence over 1D. Except for one example later in this section, we will work only with 2D textures.”

    In terms of TEXTURE_RECTANGLE_ARBs precedence, this is described in the specification in section 10: http://www.opengl.org/registry/specs/ARB/texture_rectangle.txt

    I did not know about target priority or precedence at the time of the bug, so thanks to @datenwolf!

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

Sidebar

Related Questions

I'm trying to apply texture to a sprite using opengl as follows: int[] textures=new
Using OpenGL /GLUT how would I detect if two keys, say 'a' and 'j'
I'm using OpenGL to draw in 2D. I'm trying to overlay textures with alpha.
I'm writing a simple graphics engine that draws textures on the screen using OpenGL
I'm running on XCode and using OpenGL ES 1.1 and I have two classes
I am using OpenGL to draw textures in my game. glClear(GL_COLOR_BUFFER_BIT); float w =
I've been using OpenGL extensions on Windows the painful way . Is GLEW the
I'm using OpenGL ES on a low-resolution, embedded device . I've applied a vertical
I'm using opengl's selection buffer, but i'm experiencing a trouble, the picking works perfectly
In relation to this question on Using OpenGL extensions , what's the purpose of

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.