Jump to content
  • Advertisement
Sign in to follow this  
frankmail007

OpenGL OpenGL Extension

This topic is 4437 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

I'm new to OpenGL. I have a simple question regarding with OpenGL Extension. As a common knowledge I know the opengl can only support bitmap's width and heigth in power of 2. It's a very nasty problem. How can I overcome this problem? I know there is a extension called GL_ARB_texture_non_power_of_two. The question is how I can use it. I'm trying to use Glew to check. Unfortunately it seems it can't be support in my pc. What's wrong with it? Should I install something?

Share this post


Link to post
Share on other sites
Advertisement
Make sure you have the latest drivers installed for your card (which card do you have btw.?). If you then don't have support for this extension, try ARB_texture_rectangle: It is similar to ARB_NPOT, but without filtering/mipmaps (not sure right now). If this extension is unsupported or you require filtering/mipmaps, you should go with the glu*-functions (gluBuildMipmaps2D() especially). This function will take your texture data and fit it into a POT texture, so you can use filtering and mipmapping easily. The remaining space is filled zero bytes, so it is wasted. You may want to take care of this.

Share this post


Link to post
Share on other sites
Actually you graphics-adapter might not support non-power-of-two textures, only newer ones do so. Depending on how old your drivers for your graphics-adapter are these might not have support for non-power-of-two textures too.

So first thing you should do is update your drivers.

Then please check for the following extensions (just test with GLEW) :
- GL_NV_texture_rectangle
- GL_ARB_texture_rectangle
- GL_EXT_texture_rectangle

Everyone of these indicates that your graphics-adapter supports non-power-of-two textures. If your graphics-adapter supports none of these you'll have to get a new one :-(

And no there is nothing you can install that magically enables non-power-of-two textures for you. (don't even ask about MESA, thats only software-rendering).

regards
Markus

PS.: just tell us which graphics-adapter you have and we most propably can tell you what you need to know!

Share this post


Link to post
Share on other sites
@Enrico :

from here http://www.mevis.de/opengl/gluBuild2DMipmaps.html

gluBuild2DMipmaps obtains the input image and generates all mipmap images (using gluScaleImage) so that the input image can be used as a mipmapped texture image. glTexImage2D is then called to load each of the images. If the dimensions of the input image are not powers of two, then the image is scaled so that both the width and height are powers of two before the mipmaps are generated.

Share this post


Link to post
Share on other sites
My VGA card is ATI Mobility Radeon 9700. I think it's not very old, right?

Since this extension is not supported by most of the VGA card, I'm afraid I can't use it. I'm writing a simple game. It should have a low requirement for hardware. Maybe I should try gluBuild2DMipmaps.

Thanks for your replys.

Share this post


Link to post
Share on other sites
GL_ARB_texture_rectangle should be support from Geforce2/Radeon 7000, according to the OpenGL Extension Viewer. Make sure you have the latest drivers installed.

Share this post


Link to post
Share on other sites
Quote:
Original post by frankmail007
My VGA card is ATI Mobility Radeon 9700. I think it's not very old, right?

Since this extension is not supported by most of the VGA card, I'm afraid I can't use it. I'm writing a simple game. It should have a low requirement for hardware. Maybe I should try gluBuild2DMipmaps.

Thanks for your replys.


No on the 9700 only the x1000 series and I am not sure all of them support NPOT, but on Geforce6/7 series they do. You can either look into arb_texture_rectangle or use gluBuild2DMipmaps() this will rescale your image to POT for you. Better yet just use PS or some image program and scale it yourself and upload it as POT... And if you go the arb_texture_rectangle route there are some issues you need to be aware of. So instead of thinking of the texture image lying in a [0..1]x[0..1] range, the NPOTS texture image lies in a [0..w]x[0..h] range.

Share this post


Link to post
Share on other sites
Quote:
Original post by MARS_999

No on the 9700 only the x1000 series and I am not sure all of them support NPOT, but on Geforce6/7 series they do. You can either look into arb_texture_rectangle or use gluBuild2DMipmaps() this will rescale your image to POT for you. Better yet just use PS or some image program and scale it yourself and upload it as POT... And if you go the arb_texture_rectangle route there are some issues you need to be aware of. So instead of thinking of the texture image lying in a [0..1]x[0..1] range, the NPOTS texture image lies in a [0..w]x[0..h] range.


Does arb_texture_rectangle support most of the vga card?

If I have a window size 800x600 and I want to show my texture as background in that window, is gluBuild2DMipmaps possible to do that or it just scales the image to 1024x1024 and show only part of the image on that window?

Share this post


Link to post
Share on other sites
Quote:
Original post by frankmail007
If I have a window size 800x600 and I want to show my texture as background in that window, is gluBuild2DMipmaps possible to do that or it just scales the image to 1024x1024 and show only part of the image on that window?

The best thing to do would be to resize the 800x600 image to 1024x1024 in an art program, touch up as required, and use it to texture a screen aligned 800x600 quad in your program.

While ARB_texture_rectangle is really convenient in some cases (notably where the NPOT texture is dynamically generated) - I think in your case you should consider using a POT texture. Also, as others have mentioned, texture_rectangle has some pretty serious limitations.

Just my opinion. [smile]

Share this post


Link to post
Share on other sites
What you mean is to resize my 800x600 to 1024x1024 then scale it to 800x600 texture?

I'm using the following function:

glTexImage2D( GL_TEXTURE_2D, 0, bpp, texW, texH, 0,
format, GL_UNSIGNED_BYTE, m_pImage->getPixels() );

How can I scale it to 800x600 since the texW and texH will be 1024 already?

Sorry for my stupid question. I'm very new to OpenGL.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!