Retrieve Texture coordinates
Retrieve Texture coordinates
Retrieve Texture coordinates
Retrieve Texture coordinates
Retrieve Texture coordinates
Retrieve Texture coordinates Retrieve Texture coordinates Retrieve Texture coordinates Retrieve Texture coordinates Retrieve Texture coordinates Retrieve Texture coordinates Retrieve Texture coordinates Retrieve Texture coordinates
Retrieve Texture coordinates Retrieve Texture coordinates
Retrieve Texture coordinates
Go Back  Xtreme Visual Basic Talk > > > > Retrieve Texture coordinates


Reply
 
Thread Tools Display Modes
  #1  
Old 08-28-2005, 09:19 AM
amigaxtreme amigaxtreme is offline
Newcomer
 
Join Date: Feb 2005
Posts: 6
Default Retrieve Texture coordinates


VB.net Direct3d Texture
How can i retrieve the texture coordinates directly?
Dim desc as surfacedescription
desc=texture.getleveldescription(0)
desc.width 'return width
desc.height 'return height

How to get the current X and Y coordinates of the texture?

how to get directly the current x,y coords?

Thank you



Last edited by amigaxtreme; 08-28-2005 at 09:43 AM. Reason: Incorrect Information
Reply With Quote
  #2  
Old 08-28-2005, 06:52 PM
sgt_pinky's Avatar
sgt_pinky sgt_pinky is offline
Contributor
 
Join Date: Feb 2004
Location: Melbourne, Australia
Posts: 633
Default

The texture coordinates are defined in the vertex buffer.

So in terms of the render device, when you want to draw a mesh with a texture on it, you set the render vertex buffer, set the texture file, and then render.

So if you want to retrieve the actual texture coordinates, you have to pull them out of the vertex buffer.

eg:

Code:
Dim blah As VertexBuffer Dim xx() As CustomVertex.TransformedTextured = blah.Lock(0, LockFlags.None) 'And you should know the size of the xx array, or work it out Dim tu As Single = xx(10).Tu 'The Tu coordinate for this vertex Dim tv As Single = xx(10).Tv 'The Tv coordinate for this vertex

So you can just loop through the array 'xx' like that, and rip out all the coords.

If it's a mesh object, its done the same, but slightly differently, by locking the mesh objects vertex buffer.
Reply With Quote
  #3  
Old 08-29-2005, 07:19 AM
amigaxtreme amigaxtreme is offline
Newcomer
 
Join Date: Feb 2005
Posts: 6
Default I Mean texture coordinates for 2d sprite

Quote:
Originally Posted by sgt_pinky
The texture coordinates are defined in the vertex buffer.

So in terms of the render device, when you want to draw a mesh with a texture on it, you set the render vertex buffer, set the texture file, and then render.

So if you want to retrieve the actual texture coordinates, you have to pull them out of the vertex buffer.

eg:

Code:
Dim blah As VertexBuffer Dim xx() As CustomVertex.TransformedTextured = blah.Lock(0, LockFlags.None) 'And you should know the size of the xx array, or work it out Dim tu As Single = xx(10).Tu 'The Tu coordinate for this vertex Dim tv As Single = xx(10).Tv 'The Tv coordinate for this vertex

So you can just loop through the array 'xx' like that, and rip out all the coords.

If it's a mesh object, its done the same, but slightly differently, by locking the mesh objects vertex buffer.
'**********************
if i have a texture diapslyed on the screen used for the sprite structure
How can get the current x,y coords

SprTexture = TextureLoader.FromFile(device, filesrc, 0, 0, 0, 0, Format.X8R8G8B8, Pool.Managed, Filter.Linear, Filter.Linear, color)


assuming that i do not have track of the current x,y position of the texture

Can i retrive the texture coords using the texturename? in this case SprTexture
Reply With Quote
  #4  
Old 08-29-2005, 04:51 PM
sgt_pinky's Avatar
sgt_pinky sgt_pinky is offline
Contributor
 
Join Date: Feb 2004
Location: Melbourne, Australia
Posts: 633
Default

No, because you position the texture when you draw the sprite - a point to position the texture, and a single to rotate the texture is part of that methods overloads. It's not a property.

When you draw the sprite you should just save the Point in a variable, or something like that.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

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

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Retrieve Texture coordinates
Retrieve Texture coordinates
Retrieve Texture coordinates Retrieve Texture coordinates
Retrieve Texture coordinates
Retrieve Texture coordinates
Retrieve Texture coordinates Retrieve Texture coordinates Retrieve Texture coordinates Retrieve Texture coordinates Retrieve Texture coordinates Retrieve Texture coordinates Retrieve Texture coordinates
Retrieve Texture coordinates
Retrieve Texture coordinates
 
Retrieve Texture coordinates
Retrieve Texture coordinates
 
-->