views:

283

answers:

1

I use that function to get my texture from the graphics card, but for some reason it doesnt return anything on some cards if miplevel > 0

Here is the code im using to get image:

glGetTexImage(GL_TEXTURE_2D, miplevel, GL_RGB, GL_UNSIGNED_BYTE, data);

here is the code i use to check which method to use for mipmapping:

ext = (char*)glGetString(GL_EXTENSIONS);

if(strstr(ext, "SGIS_generate_mipmap") == NULL){
 // use gluBuild2DMipmaps()
}else{
 // use GL_GENERATE_MIPMAP
}

So far it has worked properly, so it says GL_GENERATE_MIPMAP is supported for those ATI cards below.

Here are the tested cards:

  1. ATI Radeon 9550 / X1050 Series
  2. ATI Mobility Radeon HD 3470
  3. ATI Radeon X700
  4. ATI Radeon HD 4870
  5. ATI Radeon HD 3450

At this moment i am taking the miplevel 0 and generating the mipmap by own code. Is there better fix for this?

Also glGetError() returns 0 for all cards, so no error occurs. it just doesnt work. probably a driver problem?

Im still looking for better fix than resizing it myself on CPU...

+1  A: 

Check the error that glGetTexImage is reporting. It most probably tells you what the error is .

Edit: Sounds like the joys of using ATI's poorly written OpenGL drivers. Assuming your drivers are up-to-date, use an nVidia card, work around it or accept it won't work. Thats pretty much your only options. Might be worth hassling ATI about it but they will, most likely, do nothing, alas.

Edit2: On the problem cards are you using GL_GENERATE_MIPMAP? It might be that you can't grab the mip levels unless they are explicitly built ...? ie Try gluBuild2DMipmaps() for everything.

Edit 3: Thing is though. It "may" be the cause of your problems. It doesn't sound unlikely to me that the ATI card grabs the texture from a local copy, however if you use the auto generate of mip maps then it does it entirely on the card and never copies them back. Explicitly try building the mip maps locally and see if that fixes your issues. It may not, however you do need to try these things or you will never figure out the problem. Alas trial and error is all that works with problems like this. This is why a fair few games have large databases with driver name, card name and driver version to decide whether a feature will or will not work.

Goz
Answers are not for asking for clarifications, thats what comments are for.
Georg Fritzsche
Re-phrased then :P
Goz
check my edits.
Newbie
is there some way to check if they support miplevel > 0 texture grabbing? so i dont have to tell the users to manually change some setting.
Newbie
ive made it choose which method to use depending on if its supported or not. so i dont see any reason to try that (those arent my computers), since it wont fix any problems. if you think there is some fix, then just lemme hear possibilities. Look my edits, i showed the code which is used to check the support for it.
Newbie
but the users with those problem cards can see the miplevels! so its not missing miplevel problem...
Newbie
Slow response but you can either try it out and see if you can figure out what the bug is or you can just assume everything works as it should (it doesn't ... drivers are often incomplete or buggy)
Goz