Skip to main content
GameDev.net gamedev.net
🔒 Locked

loading textures

Started by THEBUTCHA666 Feb 1, 2003 at 4:34 AM 0 replies 500+ views
Original Post
THEBUTCHA666
THEBUTCHA666
How to load a rectangle of a texture? I normally use D3DXCreateTextureFromFileEx, do i have to write an own texture loader? thebutcha
Bullmax
Bullmax
You first load the texture in a "IDirect3DTexture8" object with "D3DXCreateTextureFromFileEx(..)". You create a another texture that will contain de portion of the texture you want with "CreateTextureEx(..)" (I think) and you use "CopyRect(..)" to blit texel data from the original texture onto the newly created texture.


Original New
*###########* *-----*
# # copy | ** |
# ** # ===> |**** |
# **** # *-**--*
# ** #
# #
# #
*###########*


But you can also load the whole texture and use TU and TV of your vertices to show only a portion of your texture :


Original
*###########*
# uv1 uv2 #
# *-**--* #
# |**** | | <=== Vertices TU & TV
# *-**--* # pointing to region
# uv3 uv4 #
# #
*###########*




/* Bullmax */
-------------
Reality has many forms : good and evil, black and white, yin and yang.
/ Bullmax /-------------Reality has many forms : good and evil, black and white, yin and yang.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.