Archived

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

Godji

Getting around the ^2 texture limitation

Recommended Posts

Is that possible and how? I have a 2000x1500 picture that I want to use as a 2D background. Loading it as a 2048x2048 texture and pasting only what I need is extremely inefficient, obviously... G-9405

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
That may be bigger than what a lot of cards can support anyway. You might need to break it up into several different textures and treat them as tiles.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
mip-mapping?? --> check the tuts!

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
That may be bigger than what a lot of cards can support anyway.


Actually, most cards GeForce2 or better can support 2048x2048

Regardless, the image should definitely be split into tiles

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
mip-mapping?? --> check the tuts!

Uh, no
He does not need mip-mapping

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
ya i agree. What you could do is add the extra data to the texture when loading it to make it 2^n. This would make a boarder around it.

Share this post


Link to post
Share on other sites
I had this problem when wanting to create fullscreen splash screens. What I did was chop it up into 256x256 squares and smaller until I created the entire resolution sized image. While this added extra tri's and blending operations, it gave me support for at LEAST voodoo3 cards.

James Simmons
MindEngine Development
http://medev.sourceforge.net

[edited by - neurokaotix on July 8, 2003 2:23:25 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
My TNT2 supports 2k x 2k textures. I say fsck 3Dfx, no one should be using those cards anymore anyway.

Share this post


Link to post
Share on other sites
quote:
Original post by neurokaotix
Actually, most people don''t have GeForce2''s



I wouldn''t be so sure. I have had my Geforce2 Ultra for around 2 years now, and it was a year old when I bought it.

Obviously, "most" people don''t have GeForce2s. But most people that play 3D games do. You need to consider your audience when contemplating issues like this. For my game, I am trying to stay below the 256x256 limit to allow the possibility of supporting cards as old as a Voodoo3. In the end, I probably won''t aim for anything less than a Geforce 1, but it''s never a bad idea to plan for as many video cards as you can.

-Mike

Share this post


Link to post
Share on other sites
For spash screens i use a bmp loader that isnt limited by the 2^n rule.

I cant remember, i think i modified the bmp on ether NeHe''s or gametutorails.

Share this post


Link to post
Share on other sites
Oh geez, all this arguing only one decent answer to his question. The first obvious answer is to split the picture into tiles, but thats only if it can be split into tiles that are powers of 2. Otherwise you still have the same problem. As was mentioned above, use a slightly larger texture size and pad the extra space with black (or whatever, doesn''t really matter what color) and just make sure when you set your t-map coordinates, you only get the part of the map you want. The last and easiest method is just to resize the image to a power of 2 using an image editor. Don''t worry if the aspect ration is different, as long as the poly it sits on has the correct aspect ratio it won''t be a problem.

Share this post


Link to post
Share on other sites
Thank you everyone for doing your best to answer!!

1. Resizing the source to a ^2 is inadequate. That would mean having a 2048x2048 texture for a 2000x1500 image.
2. My image is 2000x1500 in the first place, becase it is a background that is only partially seen at any time on a 1024x768 screen. In fact, all I am doing is porting a DirectDraw game I wrote a few months ago to OpenGL.
3. Tiling is what I currently use. I''ve split it to a 2048x1024 texture and an additional 2048x512 texture.
4. Using glDrawPixels for the background works only until I paste texturemapped sprites on top of it. Then it gets all weird, but I guess it''s some kind of OpenGL limitation. You can''t se glDrawPixels and draw textures on top.
5. I am VERY interested in the NV_texture_rectangle extension. What is it and how do I use it??
6. Finally I''m using an old GeForce 2 MX 400 32 mb.

Thanks again to anyone who replied!

G-9405

Share this post


Link to post
Share on other sites
For all your extensions needs :
http://oss.sgi.com/projects/ogl-sample/registry/

1) Do you really think people are going to run your 2D game in 2048xWhatever? Just make your texture 1024x1024, for example (and do that in Photoshop).
2) Same
3) Tiling is nice, but not the way you do it
4) glDrawPixels is really a bad idea => ultra slow
5) See the URL above, GL_NV_texture_rectangle
6) /

Share this post


Link to post
Share on other sites
quote:
Original post by Godji
I believe using this extension limits my game to NVIDIA users?
G-9405

Yep,.... so,.. DON''T USE IT!!,...

Share this post


Link to post
Share on other sites
I ether based this off of NeHe''s or game tutorials. I use it for my skybox''s and splashscreens (often 1024X768). 768 isnt a 2^n, I cant test to see if it allows any size, as i have a POS comp at work.

Give it a shot, let me know if it works.



///////////////////////////////////////////////////

/////////// CreateTexture() ////////////

/////////////////////////////////////////////////

// BMP BMP BMP BMP BMP BMP BMP BMP BMP BMP BMP//

void CreateTexture(UINT textureArray[], LPSTR strFileName, int textureID)
{
AUX_RGBImageRec *pBitmap = NULL;
if(!strFileName) // Return from the function if no file name was passed in

return;
pBitmap = auxDIBImageLoad(strFileName); // Load the bitmap and store the data

if(pBitmap == NULL) // If we can''t load the file, quit!

exit(0);
glGenTextures(1, &textureArray[textureID]);
glBindTexture(GL_TEXTURE_2D, textureArray[textureID]);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, pBitmap->sizeX, pBitmap->sizeY, GL_RGB, GL_UNSIGNED_BYTE, pBitmap->data);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
if (pBitmap) // If we loaded the bitmap

{
if (pBitmap->data) // If there is texture data

{
free(pBitmap->data); // Free the texture data, we don''t need it anymore

}
free(pBitmap); // Free the bitmap structure

}
}

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Crawl
quote:
Original post by Godji
I believe using this extension limits my game to NVIDIA users?
G-9405

Yep,.... so,.. DON''T USE IT!!,...


WRONG!

ATI supports it on all the Radeon series cards.

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
My TNT2 supports 2k x 2k textures. I say fsck 3Dfx, no one should be using those cards anymore anyway.


Hey, say nothing against 3Dfx ... I used my good old Voodoo Banshee till last year.
But I agree, only a few people still use them. Not because they are too slow, but the the driver-support is pratically nonexistent :-)

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
WRONG!

ATI supports it on all the Radeon series cards.


It doesn''t work on my Radeon 9800 pro.

Share this post


Link to post
Share on other sites
I know that the Voodoo3 only supports 256x256 textures but I was thinking that 512x512 would be nice in a lot of instances inside the game. Do you really think it''s a good idea to cut those older cards out of the lineup?

James Simmons
MindEngine Development
http://medev.sourceforge.net

Share this post


Link to post
Share on other sites
OK, thanks to everyone for replying, but I''ve given up making a 2D engine use OpenGL. It''s way too inefficient. If you want to do solely 2D, use DirectDraw.

G-9405

Share this post


Link to post
Share on other sites