|
I have a very big view (i.e. city) with so many detailes on it, and it consumes time to draw/redraw it.
My problem is: to select a street from that city, I have to ReDraw the scene/the whole city to do the picking and see the detailes of that street.
Does any one know how to do the selection / picking without redrawing every thing ?
Thank you
|
|
|
|
|
belloSoft wrote: My problem is: to select a street from that city, I have to ReDraw the scene/the whole city to do the picking and see the detailes of that street.
Does any one know how to do the selection / picking without redrawing every thing ?
There are two ways to do picking, three if you count hybrids, but we'll stick with two. One uses the draw cycle evaluating which pixel you touched and what triangle it belongs to, and what group that triangle lies within, etc. That is hardware based and limited by the options available in hardware. http://web.engr.oregonstate.edu/~mjb/cs553/Handouts/Picking/picking.pdf[^] I assume from your message you are doing this.
The second type is via proximity or at least via spatial zone. There are many algorithms a google on "ray intersection octree" or "ray intersection triangle" will produce many ansers. For instance: http://giig.ugr.es/~rgarcia/Poster.pdf[^] You can also do cheap bounding box tests mathematically for large regions. A quad-tree search within a scene for a "picked" locaton can quickly differenciate what object (or objects) you are looking at, and then you can either do a ray-triangle test to find a specific triangle of that subset, or an OpenGL pick of ONLY those few objects of relative usefullness.
There is also obscuration testing. This is fairly new (last few generations) but certainly no longer leading edge stuff, but it will allow you to quickly reduce the objects being drawn to only those visible using an occlusion query. The more you can do to "cut down" what you draw the faster your draw-time. Why draw it at all if it is off the screen? why draw it if it is entirely hidden by another building? etc. Occlusion Query[^]
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Thank you !
I will try the first solution
|
|
|
|
|
You probably want to try using ray intersection tests (3d) or point in polygon tests. If drawing is slow then drawing related methods would be least appropriate.
Sounds like they are causing your problem already...
|
|
|
|
|
Hi!
I have to do some calculations of GLC matrix and textural features in C++, but I don't know how to read an image and processing it like a matrix. This is very simple in Matlab, but I don't know how to do it in C++.
|
|
|
|
|
In wich format do you have your Image?
JO
|
|
|
|
|
Hi,
I have to get some properties of image files. Image file can be in any format and the properties i need is listed below
BitDepth of the image...
ColorSpace of the Image... whether it is RGB,GrayScale,CMYK or...
Number of bands in the image...
thanks for your help...
sniper47
|
|
|
|
|
There might be something in the dotnet libary that can do this but I've never done that before so I don't know. I do know you can do it by opening a file as a file stream then reading the header for the file.
Basically the headers are usually different for different file types so you'll have to look up information on each of the file types you are interested in.
Hope this helps,
Mike
|
|
|
|
|
|
Thanks for your replys. i have tried this property but i couldnt find which code means which property.
sniper47 Computer Engineer
|
|
|
|
|
Hi,
AFAIK these properties are optional, and supported by JPEG only.
These are the propID, propName pairs I recovered from some code:
Hashtable propNames=new Hashtable();
propNames.Add(0x010E, "ImageDescription");
propNames.Add(0x010F, "EquipMake");
propNames.Add(0x0110, "EquipModel");
propNames.Add(0x0112, "Orientation");
propNames.Add(0x011A, "XResolution");
propNames.Add(0x011B, "YResolution");
propNames.Add(0x0132, "DateTime");
propNames.Add(0x0128, "ResolutionUnit");
propNames.Add(0x0131, "SoftwareUsed");
propNames.Add(0x0201, "JPEGInterFormat");
propNames.Add(0x0202, "JPEGInterLength");
propNames.Add(0x0213, "YCbCrPositioning");
propNames.Add(0x501B, "ThumbnailData");
propNames.Add(0x502D, "ThumbnailResolutionX");
propNames.Add(0x502E, "ThumbnailResolutionY");
propNames.Add(0x5090, "LuminanceTable");
propNames.Add(0x5091, "ChrominanceTable");
propNames.Add(0x829A, "ExifExposureTime");
propNames.Add(0x9003, "ExifDTOrig");
propNames.Add(0x9004, "ExifDTDigitized");
propNames.Add(0x9204, "ExifExposureBias");
propNames.Add(0x9209, "ExifFlash");
propNames.Add(0x927C, "ExifMakerNote");
propNames.Add(0x9286, "ExifUserComment");
propNames.Add(0xA002, "ExifPixXDim");
propNames.Add(0xA003, "ExifPixYDim");
and this shows the kind of code you will need to extract a property:
PropertyItem pi=image.GetPropertyItem(ID);
s="";
byte[] bb=pi.Value;
switch ((PropertyTagType)pi.Type) {
case PropertyTagType.Byte:
type="(byte)";
for (int i=0; i<bb.Length; i++) {
byte us=bb[i];
s+=" "+us.ToString("X2");
if (bb.Length==1) s+="("+us.ToString()+")";
}
break;
case PropertyTagType.ASCII:
type="(ASCII)";
s=" "+ASCIIencoding.GetString(pi.Value, 0, pi.Len-1);
break;
case PropertyTagType.Short:
type="(short)";
for (int i=0; i<bb.Length/2; i++) {
ushort us=BitConverter.ToUInt16(bb,2*i);
s+=" "+us.ToString("X4");
if (bb.Length==2) s+="("+us.ToString()+")";
}
break;
...
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi all,
I have loaded 3D model using Direct 3d retained mode. I have to display label for all faces available in a mesh.
Kindly tell me how to add a label for a face using Direct 3d retained mode.
|
|
|
|
|
I have some pretty basic code that loads a texture, and tries to display it all across my terrain, however, it does not seem to be working and I can't for the life of me figure out why.
The loading code is here:
ifstream texFile("brickbump.bmp");
if (texFile.is_open())
{
AUX_RGBImageRec* image = auxDIBImageLoad("brickbump.bmp");
glGenTextures(1, &m_textures[0]);
glBindTexture(GL_TEXTURE_2D, m_textures[0]);
glTexImage2D(GL_TEXTURE_2D, GL_RGB8, 3, image->sizeX, image->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, image->data);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
texFile.close();
free(image);
}
After this, I have my function that redraws everything. Since it is too long, here is the important snippet:
glBindTexture(GL_TEXTURE_2D, m_textures[0]);
QuadVNode* tempNode = m_terrain->Tree()->GetFirstNode();
QuadVNode* nextLineNode = tempNode->Bottom();
int count = 0;
while (nextLineNode)
{
glBegin(GL_TRIANGLE_STRIP);
while (tempNode)
{
glNormal3d(tempNode->m_nx, tempNode->m_ny, tempNode->m_nz);
if (count % 2 == 0)
glTexCoord2d(0.0f, 0.0f);
else if (count % 2 == 1)
glTexCoord2d(1.0f, 0.0f);
glVertex3d(tempNode->m_x, tempNode->m_height, tempNode->m_z);
tempNode = tempNode->Bottom();
glNormal3d(tempNode->m_nx, tempNode->m_ny, tempNode->m_nz);
if (count % 2 == 0)
glTexCoord2d(0.0f, 1.0f);
else if (count % 2 == 1)
glTexCoord2d(1.0f, 1.0f);
glVertex3d(tempNode->m_x, tempNode->m_height, tempNode->m_z);
tempNode = tempNode->Top()->Right();
count++;
}
glEnd();
tempNode = nextLineNode;
nextLineNode = nextLineNode->Bottom();
}
My problem is that it doesn't display the texture. All it does is draw it as if I had simply done glNormal/glVertex over and over again, discarding the glTex2Coord call in between. Another thing I should mention is that I do have glEnable(GL_TEXTURE_2D) somewhere in my initialization code. Also, it does actually find the texFile, and sets m_textures[0] to an unsigned value of 1 when I call glGenTextures().
|
|
|
|
|
Alright, this happened to be a fluke, but I went digging around in the documentation, and it was suggested that I use 0 for the second parameter to glTexImage2D, and now it works. I don't know where I came up with RGB_8 as the constant to use there, but this solves the problem.
|
|
|
|
|
I'm doing something with a bitmap and as many of you probably know the getpixel and setpixel functions are heinously slow so I'm simply opening the bitmap as a filestream and manipulating the bytes directly which is much faster. Anyways is there anyway I can display this filestream directly on a picuturebox without having to close the file then load it again from its location in the hard drive.
thanks,
Mike
|
|
|
|
|
Image.FromStream() accepts a FileStream.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
|
i want to display an image which is over 400M size by the following ways:
1) GDI+
2)OPenGL (load the image as texture)
but it dosn't work, since i can display little size image by these two methods, is there size limit to display so big image?
thanks
|
|
|
|
|
Hi,
what is the size of your image (width and height in pixels)?
Lao Wang wrote: it dosn't work
What does that mean? Do you have code that does not compile, if so show the error message.
Do you get an exception at run-time, if so show us the code and the entire
exception.ToString().
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
thanks Pattyn:
the size of my image is 29000*15000.
there is no compile error, no run-time exception yet.
i can display an image of 9000*5000 size through GDI+ and OpenGL, but display nothing with the big image of 29000*15000.
so i want to know is there size limit of displaying an image by GDI+ and OpenGL?
|
|
|
|
|
Is it possible to break the picture down into smaller tiles ( I doubt the user is looking at the whole picture at once )?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
thanks
maybe i have to divide the big image into some little images before display it.
|
|
|
|
|
Adobe applications can display images that large, but nothing I've tried under win32 (including several OSS apps that could do it under *nix(64?)) was able to load the one image that big that I tried. I assume they're using some sort of divide and conquer approach instead of just trying to use the API native constructs.
--
If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.
|
|
|
|
|
Lao Wang wrote: i want to display an image which is over 400M size by the following ways:
"display" is relative to your display, which theoretically is probably maxing out at 2560x1600 assuming a very nice monitor. Parse is another issue.
One method is through a form of Level of Detail mapping for imagery, you can zoom into any portion of a very large image, yet not have anything more than 512x512 on any given cell. You break the cells into quads and those quads into quads, and those quads into quads, etc. until you reach full resolution. Then the hard-part is paging those in and out. Real memory becomes a cache for tiles loaded off disk. Now you can pull any given section rapidly. The primary advantage of tiling is that it allows you to combine multiple things all tiled off the same zone. This is extremely common for imagery related to terrain as terrain elevation can be tiled as well as imagery, perhaps as well as soil, or vegetation, or other layers of information. Each layer of information may have a different size, but be tiled the same. Elevation could be 64x64 while satellite imagery 512x512, while soil types are 32x32 and vegetation 64x64. Tiling is common for two sources together, and more common the more layers you have to use together. It is very difficult and often expensive (performance wise) not to tile multiple layers.
Another method is through windowed compression. This is probably the easiest, though depending on the data source not always as good looking. ECW free version limits your images to 500M which is within your limits. A GNU license or commercial license will buy you unlimited sizes (limited by your hardware of course). ECW and Jpeg2000 are wavelet compression which is very easy to window. You can then store the entire image on disk as compressed wavelet information, and extract the "window" of the visible portions of the image.
ECW and Jpeg 2000[^]
Tiling textures[^]
Image Clipmapping[^]
ChunkLOD Implimentation (images and elevation data)[^]
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
El Corazon wrote: "display" is relative to your display, which theoretically is probably maxing out at 2560x1600 assuming a very nice monitor.
He could be working with super premium type monitors used for medical imaging, etc. I know those can reach at least 8 megapixels.
--
If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.
|
|
|
|
|