Advertisement

Multiple OGL instances, texture issues

Started by June 17, 2003 09:08 AM
1 comment, last by Shawn54c 21 years, 8 months ago
Hi, my problem is rather complicated so ill do my best to describe the issue im having. We have a windows application that contains multiple "pages" ( mainframe windows ) with childframes inside of them, the child frames are then divided into splitterwnd's. this allows us to put activex controls inside each page ( any number of them ). so here is the problem. i have a 3d plotter that uses opengl . it is it's own activex control so you can plop several of them on the screen at once. what happens is when we have multiple plotters instatiated in the program and we reevaluate the file to be plotted weird things with the textures start to happen. if i have 2 different measurements (flatness and fit) and say i have 3 plotters on the screen, 2 are displaying flatness and one is displaying fit, when i reevaluate the file the ones for flatness are displaying the texture for the fit plot, and vice versa for the fit plot. it could also happen that the texture doesnt get set at all and the plot is just a shape with a matte grey on it. Then if you go to an individual plot and configure it ( modify things like scale etc, but you dont even have to change anything ) when it redraws it on configure the plot then shows the correct texture. the refreshing for the reevaluate and the configure call the same block of code to create all the necessary stuff. what im doing is generating the data set for the points from a map that is provided, the dataset's are ALWAYS correct. i then take an object that we have and generate the bitmap of the part which will be used as a texture ( we have tested this extensively by putting the bitmap out to a file etc) and the bitmap that is generated is the correct bitmap for that plot. the bitmap is then padded to be an even power of 2 (just for logistics) and then i generate a texture based on that bitmap. it all seems straightforward to me as to the instantiations of it, also i am deleting EVERYTHING and using new on everything before i redraw (slow but it needs to be done). but what seems to be happening is the plots are getting confused with the textures, it is as if they are swapping their memory. im storing each texture in a GLuint texture[1] by calling the following: if( texturesGenerated ) { glDeleteTextures( 1, texture ); } texturesGenerated = FALSE; glGenTextures(1, texture); // Create The Texture // Typical Texture Generation Using Data From The Bitmap glBindTexture(GL_TEXTURE_2D, texture[0]); // Generate The Texture glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, m_Pow2SizedBitmap->bmWidth, m_Pow2SizedBitmap->bmHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, m_Pow2SizedBitmap->bmBits); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER, GL_LINEAR); // Linear Filtering glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER, GL_LINEAR); // Linear Filtering texturesGenerated = TRUE; glBindTexture( GL_TEXTURE_2D, 0 ); im asking if anyone has any idea of why this is happening.. are the multiple instances of opengl only able to support one texture list and therefore it is getting confused? im totally stumped here and so is my boss. we have tracked this down to the texture issue since i used to color the map using a mathematical formula and set each data point to the color based on height (the bitmap generated is done the same way). but i went back to an earlier version before the textures and it always displays the correct information. help would be greatly appreciated -shawn [edited by - shawn54c on June 17, 2003 10:17:01 AM]
Im not sure if I can be much help here...and your question is quite specific to your implementation. I am writing a MDI application with multiple OpenGL windows myself so I am aware of issues with using the same texture in multiple windows. I solved my problem by making texturing class that creates the texture as an object, thereby allowing me to use the same texture in multiple windows. If your interested I could post it for you...but I don''t have it with me (Im at work...don''t tell my boss!) ...If your interested I could do it when I get home... Check out my website and email me back...
www.lanceusa.com

Check out: www.lanceusa.com Link
Advertisement
thanks for a little bit of insight, except what im running into is i want each window pane to create it''s own texture and use that. it seems that somehow the textures are getting ''shared'' among multiple windows when it definitely shouldnt be. i know this is a difficult thing, this is my third full day of work trying to get a handle on it

This topic is closed to new replies.

Advertisement