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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:06:45+00:00 2026-05-31T19:06:45+00:00

In my program I have numerous Entity classes with a Texture2D attribute that are

  • 0

In my program I have numerous Entity classes with a Texture2D attribute that are added to a List<> container to iterate through their draw functions. I want to group Entities with identical textures together so that they can be batched efficiently in my SpriteBatch without it flushing out whenever the previous textures differ.

What is an efficient way to compare the Texture2D classes with each other for my sorting method? I only need a boolean result as to whether or not it is the same texture. I was thinking of using getData() to compare pixels, but that seems brutally inefficient. Is there a better way?

  • 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-31T19:06:46+00:00Added an answer on May 31, 2026 at 7:06 pm

    How about using a SortedList with a custom IComparer considering the texture member being used (e.g. by Name)? That way you should be able to sort all your objects by texture upon adding them to the list. Just don’t forget that you might want to draw specific entities in front of others and strict sorting might not be the best option.

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

Sidebar

Related Questions

In my program I have two classes: Collector and Entity. Collector stores Entities in
I have a program that uses way too much memory for allocating numerous small
I have simple base class with single static field. I have numerous classes that
I have program that has a variable that should never change. However, somehow, it
I have program, that must interact with a console program before my program can
I have program that runs fast enough. I want to see the number of
in a C program I have an long* that I want to serialize (thus
In an embedded program I have a screen object that needs to manage a
with my RCP program I have the problem that I want to have more
I have encountered numerous times when a silverlight program is running perfectly, but after

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.