Looking to copy only a small portion of bitmap to backbuffer
Looking to copy only a small portion of bitmap to backbuffer
Looking to copy only a small portion of bitmap to backbuffer
Looking to copy only a small portion of bitmap to backbuffer
Looking to copy only a small portion of bitmap to backbuffer
Looking to copy only a small portion of bitmap to backbuffer Looking to copy only a small portion of bitmap to backbuffer Looking to copy only a small portion of bitmap to backbuffer Looking to copy only a small portion of bitmap to backbuffer Looking to copy only a small portion of bitmap to backbuffer Looking to copy only a small portion of bitmap to backbuffer Looking to copy only a small portion of bitmap to backbuffer Looking to copy only a small portion of bitmap to backbuffer
Looking to copy only a small portion of bitmap to backbuffer Looking to copy only a small portion of bitmap to backbuffer
Looking to copy only a small portion of bitmap to backbuffer
Go Back  Xtreme Visual Basic Talk > > > > Looking to copy only a small portion of bitmap to backbuffer


Reply
 
Thread Tools Display Modes
  #1  
Old 10-18-2006, 08:14 PM
SlimShady SlimShady is offline
Newcomer
 
Join Date: Oct 2002
Posts: 17
Default Looking to copy only a small portion of bitmap to backbuffer


Hi all.

I have a program that I'm working on that uses Direct3D to display sprites over a backdrop.
This all works very well, but the problem I'm having is trying to only put 1024x768 of the 1024x2000 background into the backbuffer.

Are then any Direct3D specific commands that I should be looking for, or will it need to be done with standard vb.net commands.

I'm using this at the moment, which squashes the full 1024x2000 image into the 1024x768 screen space:

backtexture = TextureLoader.FromFile(D3Ddev, "test.jpg", 1024, 768, D3DX.Default, Usage.None, Format.Unknown, Pool.Default, Filter.Point, Filter.Point, ColorKeyVal.ToArgb)

Any help appreciated.
I've had enough of trying for tonight.

Cheers,
Slim.
Reply With Quote
  #2  
Old 10-19-2006, 04:59 AM
Iceplug's Avatar
IceplugLooking to copy only a small portion of bitmap to backbuffer Iceplug is offline
MetaCenturion

Retired Moderator
* Guru *
 
Join Date: Aug 2001
Location: Iowa, USA
Posts: 16,583
Default

Load the actual size of the bitmap. The line you posted above is not drawing. That's the line telling what texture to load and what to change its size to.

To only draw a portion of the bitmap with full coloring, you need to use TextureLoader to load the texture with its actual dimensions. Then, when you specify the vertices, you need to set the texture coordinates of the vertices to only use the portion of the image that you want to use.

So, in short, TextureLoader loads the whole texture and scales it to the size you specified. To show a portion, you have to specify texture coordinates for the vertices that you are using.
__________________

Iceplug, USN
Quadrill 1 Quadrill 2 (full) Quadrill 3 JumpCross .NET Website is ALIVE! - DL Platform Tour for VB.NET! Posting Guidelines Hint: Specify your location in your user cp profile if you want compassion!
Reply With Quote
  #3  
Old 10-19-2006, 12:18 PM
SlimShady SlimShady is offline
Newcomer
 
Join Date: Oct 2002
Posts: 17
Default

Thanks for replying mate.

I'm using the following to actually draw the sprite:

*.Draw2D(*Texture, New Point(0, 0), RotationAngle, New Point(512, 384), Color.White)

I thought that there was an overloaded version of Draw2d that allowed me to specify a rectangle of the source bitmap, but all the ones that I try show errors in the VB.Net IDE.

The only one that works is the basic one shown.

While I'm here, is there an easy way to embed the textures in the program so that they are still able to be accessed without too much trouble.
Maybe loaded into a control, or even a resource file?

I'm still working out the various functions that I need before I start the serious coding, so although I haven't looked at this yet, any pointers would be welcome.

Cheers,
Slim.
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
Looking to copy only a small portion of bitmap to backbuffer
Looking to copy only a small portion of bitmap to backbuffer
Looking to copy only a small portion of bitmap to backbuffer Looking to copy only a small portion of bitmap to backbuffer
Looking to copy only a small portion of bitmap to backbuffer
Looking to copy only a small portion of bitmap to backbuffer
Looking to copy only a small portion of bitmap to backbuffer Looking to copy only a small portion of bitmap to backbuffer Looking to copy only a small portion of bitmap to backbuffer Looking to copy only a small portion of bitmap to backbuffer Looking to copy only a small portion of bitmap to backbuffer Looking to copy only a small portion of bitmap to backbuffer Looking to copy only a small portion of bitmap to backbuffer
Looking to copy only a small portion of bitmap to backbuffer
Looking to copy only a small portion of bitmap to backbuffer
 
Looking to copy only a small portion of bitmap to backbuffer
Looking to copy only a small portion of bitmap to backbuffer
 
-->