Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411992 Posts in 69441 Topics- by 58486 Members - Latest Member: Fuimus

June 17, 2024, 02:18:08 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Clean blitting help
Pages: [1]
Print
Author Topic: Clean blitting help  (Read 2288 times)
Trevor Dunbar
Level 10
*****


Working on unannouned fighting game.


View Profile
« on: January 08, 2009, 10:14:40 PM »

I'm using Direct x 9.0c sdk and VC++ 2008
So I'm trying to follow this tutorial:

http://www.gamedev.net/reference/articles/article1608.asp#demo

but it's kind-of overwhelming for me, can anyone help
?

Logged

Toucantastic.
Michelle Disraeli
Level 0
**


View Profile
« Reply #1 on: January 09, 2009, 05:57:39 AM »

Where exactly are you getting stuck?
Logged
J.G. Martins
Level 2
**


AKA anvilfolk


View Profile WWW
« Reply #2 on: January 09, 2009, 09:44:37 AM »

This is totally off-topic, as I can't help you. But do consider using multi-platform libraries such as OpenGL. There are loads of tutorials everywhere. These in particular are mentioned a lot.
Logged

Gold is for the mistress -- silver for the maid --
Copper for the craftsman cunning at his trade.
"Good!" cried the Baron, sitting in his hall,
"But iron, cold iron, is the master of them all."
--- Rudyard Kipling
AshleysBrain
Level 0
**


View Profile WWW
« Reply #3 on: January 09, 2009, 11:32:25 AM »

You could try the tutorials here:
http://www.drunkenhyena.com/cgi-bin/directx.pl
Logged

Trevor Dunbar
Level 10
*****


Working on unannouned fighting game.


View Profile
« Reply #4 on: January 09, 2009, 03:30:12 PM »

Open GL? are you serious?  Roll Eyes

Uhhh I'm specifically looking for help using a surface and cutting that surface up into textures.
Logged

Toucantastic.
J.G. Martins
Level 2
**


AKA anvilfolk


View Profile WWW
« Reply #5 on: January 09, 2009, 05:48:14 PM »

Open GL? are you serious?  Roll Eyes

Uhhh I'm specifically looking for help using a surface and cutting that surface up into textures.

Errrrr. Yes, I'm serious. Why do you ask? You've really got me puzzled. I'm not graphics guru, but as far as I can tell, OpenGL and DirectX (more specifically DirectDraw?) are essentially different libraries to do the same things.

I admit it's a knee-jerk reaction, always suggesting multiplatform libraries, but I don't get your reaction.
Logged

Gold is for the mistress -- silver for the maid --
Copper for the craftsman cunning at his trade.
"Good!" cried the Baron, sitting in his hall,
"But iron, cold iron, is the master of them all."
--- Rudyard Kipling
Krux
Level 2
**



View Profile
« Reply #6 on: January 09, 2009, 08:22:11 PM »

OpenGL is good, DirectX is evil. If you want to learn OpenGL in C++, it will be very hard. But if you are strong, use the NeHe tutorials.
I think the thing you are looking for is uv mapping.

But remember making games in C++ is frustrating and takes very much time.
Logged
David Pittman
Level 2
**


MAEK GAEM


View Profile WWW
« Reply #7 on: January 09, 2009, 10:06:10 PM »

OpenGL is good, DirectX is evil.

I've noticed that this seems to be a common opinion around here. Is it just OpenGL's cross-platform capacity that makes it ideal, or do you actually prefer the global, non-OO design of its API? I've used only D3D for the last two or three years and I don't have a whole lot bad to say about it.
« Last Edit: January 09, 2009, 10:15:41 PM by dphrygian » Logged

BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #8 on: January 10, 2009, 01:01:31 AM »

Jeez guyz, I know openGL is more popular here as it's cross platform, that's no excuse for how evangelical you are being. Dude has a DirectX query, you shouldn't just butt in. For all you know, he's been using openGL for 30 years and is checking out the competition. Or he could be on a platform/team that requires directX. The fact is, DirectX is an acceptable choice, and many many games use it, so you cannot dismiss it out of hand without knowing anything about the OP (unlike, say, if he said "I'm looking for some good Visual Basic tutorials").

But you haven't helped either, Draco9898. Your requests are too vague to answer. What problem are you having with the tutorial linked? Or are you looking for a more tutorials on the same subject? Or just tutorials in general?
Logged
Krux
Level 2
**



View Profile
« Reply #9 on: January 10, 2009, 04:50:03 AM »

The thing is, if your choise is DirectX, you are only able to develop for platforms where Microsoft has already has its operating system supporting directX. The fact is, you are dependant of Microsoft. This is the Independat Gaming Source, I don't think beeing dependant of anyone is compatible with the spirit of developing independant games. If your decision is OpenGL, then you are dependant of it, but OpenGL is open source, and can be implementet on any platform by any company.

This is my reason not to implement Games in DirectX.
Logged
Michelle Disraeli
Level 0
**


View Profile
« Reply #10 on: January 10, 2009, 06:39:50 AM »

Whilst discussions of graphics APIs are great and all, could a mod please split this thread if possible? Draco came in here with a specific question, and it is unfair to them to have the thread derailed into an unrelated discussion, especially since the problem they are trying to deal with is API-agnostic. Once the thread is split (or not), I shall dive in with my own thoughts on this matter Wink

Going back to the actual concern of the original poster:
Uhhh I'm specifically looking for help using a surface and cutting that surface up into textures.

What I believe they are trying to do is implement this section of the tutorial:
Quote
What we need is a way to break up a (potentially large) bitmap into smaller images to be stored in textures. The easiest way to do this is to load the entire bitmap into a Direct3D surface (which have no size restrictions) and then use CopyRects to copy surface sub-images into textures.

The demo program uses D3DFMT_A1R5G5B5, a 16-bit surface format where five bits are reserved for each colour and one bit is reserved for alpha transparency. Other suitable surface formats are D3DFMT_A8R8G8B8 and D3DFMT_A4R4G4B4. (See CreateSurfaceFromFilein the demo.

You need an alpha component in your surface format for transparency, and an RGB component for the colours to display correctly. The exception to this rule is D3DFMT_A8R3G3B2, which (in my experience) has insufficient RGB values to produce a good range of colours and often results in an incomprehensible grey image.

The same surface format is used for the textures. (You will not be able to copy data between textures and surface otherwise.)

In most video cards, the width and height of a texture must be a power of two. A 20x40 image will be stored in a 32x64 texture. This extra area within our texture must be set to a transparent colour or random colours may surround your sprites.

Newer video cards let you create textures that are not limited to powers of two.

To clear the texture we need to create a blank surface and then copy its content over to the texture. Can't we clear the texture directly, you ask? We can but textures placed in the D3DPOOL_DEFAULT pool cannot be locked for clearing [1g]. Placing our textures in D3DPOOL_MANAGED memory will allow us to lock the texture but the copy method works for both cases so it is more flexible. See CreateTextureFromSurface in the demo.

Finally, we can copy the bitmap image over to the texture.

This section specifically addresses the problem of texture sizes. Graphics hardware has traditionally had a maximum size and dimension of textures supported. This problem applies equally to OpenGL, hence why the API discussions really belong elsewhere (Although for OpenGL, the solution would be quite different).

Looking into IDirect3DDevice8::CopyRects, it seems that Draco's most likely problem is that I think this function no longer exists on the IDirect3DDevice9 interface. One quick search later, and the appropriate alternatives (in theory) are found! Wink
Logged
Trevor Dunbar
Level 10
*****


Working on unannouned fighting game.


View Profile
« Reply #11 on: January 10, 2009, 09:26:15 AM »

I do not prefer OGL, it seems to be having troubles as a platform for awhile. I do not plan on porting to anything other than xbox, if that.
I'm also balls-deep in direct x, so talking about what graphics API is better is fairly moot.
The point is- I'm not using open-GL. I'm not going to use- Open GL. If you can't constructively help with direct X, don't reply.

thank you- Michelle Disraeli, I'll try using StretchRect().

As for specifics- I'm having trouble integrating surfaces/textureTOsurface in my game engine. It's also confusing what is happening to our quad vertices at render-time.

« Last Edit: January 10, 2009, 09:34:38 AM by Draco9898 » Logged

Toucantastic.
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic