Reply
Thread Tools Display Modes
Unread 07-14-10, 10:42 PM   #1
Kitjan
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 7
Controlling draw order of Textures

I have three lazily created textures that draw on "ARTWORK" of the same frame. Is there any way for me to make sure they're drawn in the correct order regardless of the order I create them in? I haven't been able to google up anything on draw order in the API at all.
Kitjan is offline   Reply With Quote
Unread 07-14-10, 10:50 PM   #2
Kitjan
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 7
Found another thread asking the same question once I figured out how to search this site a little better. I think I can do better than making another frame, but still yuck. Is there any place to read up on how the draw order is determined? I start with a texture and a text, and when I add a new texture, it still draws before the text. This happens to be what I want, but I'd love to be able to have predicted that.
Kitjan is offline   Reply With Quote
Unread 07-15-10, 03:51 PM   #3
Vrul
A Cobalt Mageweaver
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 208
Draw layers (lowest to highest):

BACKGROUND
BORDER
ARTWORK
OVERLAY
HIGHLIGHT
Vrul is offline   Reply With Quote
Unread 07-18-10, 12:15 PM   #4
Kitjan
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 7
wow, you're not kidding. I have a color picker for one of my textures, and reconfiguring the texture will sometimes cause it to change draw order. I was definitely not expecting this kind of non-determinism on the same draw layer.
Kitjan is offline   Reply With Quote
Unread 07-18-10, 03:07 PM   #5
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 569
http://www.wowwiki.com/API_Frame_SetFrameLevel
__________________
The cataclysm broke the world ... and the pandas could not fix it!
Rilgamon is offline   Reply With Quote
Unread 07-19-10, 02:01 PM   #6
Kitjan
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 7
Rilgamon, I'm talking about textures (from CreateTexture) all on the same frame, so SetFrameLevel does not apply. (Textures are not Frames)

Last edited by Kitjan : 07-19-10 at 02:09 PM.
Kitjan is offline   Reply With Quote
Unread 07-19-10, 03:46 PM   #7
Saiket
A Chromatic Dragonspawn
 
Saiket's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 152
_NPCScan.Overlay relies on textures drawing in the order they're parented to a frame, although sometimes even that doesn't work and a few textures will appear out of order. I think fontstrings might be drawn in an entirely different pass judging by what you've posted, so there's no way to sandwich a fontstring between two textures on the same drawlayer.

I imagine the rendering order is something like this pseudocode:
Code:
for each Layer in Frame
    for each Texture in Layer
        draw Texture
    for each FontString in Layer -- Always overlaps same-layer textures
        draw FontString
Saiket is offline   Reply With Quote
Unread 07-20-10, 11:10 AM   #8
Kitjan
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 7
I wonder if they draw in the same order as Frame:GetRegions() returns them? I wonder what draw operations on a Texture change the order of regions... I call a bunch of functions on the textures to set them up, presumably one of them has a chance to reorder them.

I was able to fix my issue by moving one of the textures to BORDER and doing a bit of texture coordinate math so the other two don't need to overlap any more.
Kitjan is offline   Reply With Quote
Reply

Go BackWoWInterface » Developer Discussions » Graphics Help » Controlling draw order of Textures

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off