Archived

This topic is now archived and is closed to further replies.

Dealing with pictures bigger than 256x256 in 3D

This topic is 5588 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Okay I understand that you shouldn''t use textures bigger than 256x256 in a 3D game due to the hardware limitations on some video cards. Since I''m making a 2D game that holds true. Anyway to the point. I have a 640x480 splash screen I want to display. Do I have to make the engine chop it up or whatever to display it whole? The same goes for making interfaces and displaying tiles. Suppose I have a bitmap size 640x480 with a bunch of 32x32 tiles or pieces of an interface in it. I place the tiles from that bitmap in my map editor and load the map. Does that count? Does the bitmap have to be 256x258 minus or is it just displaying 32x32 portions so it doesn''t mattter?! And how to make big interfaces that cover a good portion of the screen like in so many 3D games out there? I hope I''m making myself clear enough, please enlighten me, thanks! -- Ivyn --

Share this post


Link to post
Share on other sites
You could draw it using 2D raster functions. There won''t be any size limitations, and you can draw it pixel for pixel as it loads. OpenGL uses glRasterPos and glDrawPixels. I don''t know, though, how DirectX would accomplish this. I hope this helps.

Share this post


Link to post
Share on other sites
Just a general question, straying a tad off the topic:

Is it worth it to support Voodoo 3 cards anymore (in the forefront of the 256x256 limitation) ? Are there other cards with 256x256 limit. Isn''t it time people shell out $50-$100 for a superior card ?

Thanks for any insight.



2DNow - for the 2D game developer in you

Share this post


Link to post
Share on other sites
Only older cards have that limitation. The last card to have the limit was the voodoo3, most cards can display at least 512x512 or 1024x1024 textures. A lot of cards support non power of two textures, but I recommend you still use them. Just use a 512x512 texture and scale it up to 640x480 (the streching will be very minimal.) If you need exact mapping, you could use a 1024x1024 and store the splash screen in that (you can store other stuff in the extra space.) When storing tiles in textures you can do the same thing. You can display any portion of a texture, and on older cards the limit is on total size. You can''t have a 512x512 texture, but only use a 256x256 portion of it, that''s not how textures work. A texture is just an image, you can display any portion of it. Also, because textures are mapped to polygons (even in a 2D game) you can arbitrarily stretch them at no cost. Note, that all this stuff only applies if you''re using a 3D api\3d hardware for your 2D game. If you''re using 2D (Windows GDI, Direct Draw, SDL, etc.) then none of the 3D card restrictions apply, but neither do any of the benefits.

Share this post


Link to post
Share on other sites
>>Come on guys, I know it''s a stupid question but PLEASE!<<

come on, search button in the forum is a stupid button, but PLEASE!

seriously, its discussed quite some times yet, and the solutions are always the same..

scale
or tile

"take a look around" - limp bizkit
www.google.com

Share this post


Link to post
Share on other sites
Here''s what I did. I wanted a 1024x768 backdrop for my game''s title/options screen, and I wanted to draw 3D text on top of that.

  
class CTitleScreen {
// Among other things...

LPDIRECT3DDEVICE8 m_pD3DDev;
LPDIRECT3DSURFACE8 m_pTitleBuffer;
};

CTitleScreen::CTitleScreen()
{
// Among other things...

m_pD3DDev->CreateImageSurface(1024, 768, m_Format, &m_pTitleBuffer);
D3DXLoadSurfaceFromFile(m_pTitleBuffer, NULL, NULL, "Images\\TitleScreen.TGA", NULL, D3DX_FILTER_NONE, 0, NULL);
}

CTitleScreen::~CTitleScreen()
{
// Among other things...

m_pTitleBuffer->Release();
}

CTitleScreen::DrawFrame()
{
// Among other things...

IDirect3DSurface8* pBuffer;

// Only clear the Z buffer

m_pD3DDev->Clear(0, NULL, D3DCLEAR_ZBUFFER, 0, 1.0f, 0);
m_pD3DDev->GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO, &pBuffer);
D3DXLoadSurfaceFromSurface(pBuffer, NULL, NULL, m_pTitleBuffer, NULL, NULL, D3DX_FILTER_NONE, 0);
pBuffer->Release();

// And draw whatever you want on top of this.

}


Hope this helps,

Cheers, dorix

Share this post


Link to post
Share on other sites