c++ - glDeleteBuffers crashes during destructor call -


Hello I am using VBO to load image texture and then drag it into C ++. VBO generates IDs and binds and draws here

  Zero ViewManager :: render () {glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); GlEnable (GL_TEXTURE_2D); GlEnableClientState (GL_VERTEX_ARRAY); GlEnableClientState (GL_TEXTURE_COORD_ARRAY); GlEnable (GL_BLEND); Globefenk (GLICCR_ALPHA, GL_ONMINUSISUSRCCLAAPHA); If (Decompressile image-> gt; tile texture == 0) {load-fixtures (decompressile image); GlGenBuffers (1, & DecompressTileImage-> VBOId); GlBindBuffer (GL_ARRAY_BUFFER, decompressTileImage-> VBOId); GlBufferData (GL_ARRAY_BUFFER, sizeof (* (this-> tileCoordList)) + sizeof (* (this-> tileTestructureCoordList), 0, GL_STATIC_DRAW); GlBufferSubData (GL_ARRAY_BUFFER, 0, sizeof (* (-> tileCoordList), this-> tileCoordList); GlBufferSubData (GL_ARRAY_BUFFER, sizeof (* (- >-- tileCoordList)), sizeof (* (this-> tileTextCoordList), this-> tileTextureCoordList); } Other {glBindBuffer (GL_ARRAY_BUFFER, deccustomly image-> VBOId); Globinated (GL_TEXTURE_2D, decontrastilize-> gt; tiletext); } GlColor4f (1.0f, 1.0f, 1.0f, textured alfa); If (texture alpha> 1.0) {textureAlpha = textureAlpha + .03; This- & gt; TiledMapView-> RenderNow (); } GlTexCoordPointer (3, GL_FLOAT, 0, (Zero *) size (* (this-> tile cost list)); Glyretex Pointer (3, GL_Float, 0, 0); GlDrawArrays (GL_TRIANGLE_STRIP, 0, 4); GlBindBuffer (GL_ARRAY_BUFFER, 0); GlDisable (GL_BLEND); GlDisableClientState (GL_VERTEX_ARRAY); GlDisableClientState (GL_TEXTURE_COORD_ARRAY); GlDisable (GL_TEXTURE_2D); }   

This function is created in the category called MapTile 35 colors have been created for 35 code MapTile 35 times. And then a thread tells this method as 35 times 35 MapTile as an object and is doing it. This is the reason why I check for the first time that the method is called for the first time so that I can load the data and generate a VBO ID once for each MapTile object. I check it with (decompressTileImage-> tilecture == 0) this line and then every time I simply force to attract the vbo ID. There is no need to load the data again.

Here is the decompressTileImage a TextureImageInfo class. Implementation TextureImageInfo :: TextureImageInfo (unsigned char * image, GLuint format, integer texWidth, integer texHeight, integer imageWidth, integer imageHeight, tex_x boat, boat tex_y) {// TODO auto-generated creator stub is-> format = format; This- & gt; Image = image; This- & gt; Imagehite = imagehit; This-> ImageView = ImageWood; This- & gt; TexHeight = texHeight; This- & gt; TexWidth = texwidth; This- & gt; Tilecture = 0; It-> VBOId = 0; This- & gt; Time = 0; } TextureImageInfo :: ~ TextureImageInfo () {if (VBOId = 0!) GlDeleteBuffers (1, & VBOId); }

It draws and fixes everything, but when I try to clean memory in the destroyer of the code, textureImageInfo which is given here . I do not understand why I checked to check whether VBOId has been generated in the memory and loaded, even with the condition in the district.

As indicated in the comments, OpendGL ES commands should be presented with a single thread where The reference was made.

From Blackberry Docs:

It is important to note that every single OpenGL ES rendering targets a single thread of reference execution.

If you want to keep multiple views, you can separate each scene in your own thread, ensuring that each thread has its own reference < / Html>

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -