Skip to main content
added 110 characters in body
Source Link
Tetrad
  • 30.1k
  • 12
  • 96
  • 143

I have heard that textures consumes lot of memory but I am surprised how much.... I have 7 textures 1024 16 bit each. And while I will run my app it consumes 57MB of memory. I think that this is "a bit" too much.

I am writing 2D application (no cocos or other framework)

Strange is that while I will compile my app with disabled rendering methods: glDrawArrays than It uses only 27MB.... which is about 30MB less...

Do you have any Idea why?

I am creating textures before rendering of course: rendering looks like this:

[EAGLContext setCurrentContext:context]; glBindFramebufferOES(GL_FRAMEBUFFER_OES, defaultFramebuffer);

glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT);

glPushMatrix(); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glEnable(GL_TEXTURE_2D);

glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

TeksturaObrazek *obrazek_klaw =[[AppDirector sharedAppDirector] obrazek_klaw]; glBindTexture(GL_TEXTURE_2D, [[obrazek_klaw image_texture] name] );

glVertexPointer(2, GL_FLOAT, 0,vertex1); glTexCoordPointer(2, GL_FLOAT, 0, vertex2); glColor4f(1,1,1,alpha); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glPopMatrix(); [context presentRenderbuffer:GL_RENDERBUFFER_OES];

 [EAGLContext setCurrentContext:context];
 glBindFramebufferOES(GL_FRAMEBUFFER_OES, defaultFramebuffer);

 glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
        glClear(GL_COLOR_BUFFER_BIT);

 glPushMatrix();
 glEnableClientState(GL_VERTEX_ARRAY);
 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 glEnable(GL_TEXTURE_2D);
 
 glEnable(GL_BLEND);
 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

 TeksturaObrazek *obrazek_klaw =[[AppDirector sharedAppDirector] obrazek_klaw];
 glBindTexture(GL_TEXTURE_2D, [[obrazek_klaw image_texture] name] );

  glVertexPointer(2, GL_FLOAT, 0,vertex1);
  glTexCoordPointer(2, GL_FLOAT, 0, vertex2);
  glColor4f(1,1,1,alpha);
  glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

 glDisable(GL_BLEND);
 glDisable(GL_TEXTURE_2D);
 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
 glPopMatrix();
    [context presentRenderbuffer:GL_RENDERBUFFER_OES];

It looks like standard routine... I have spent about 2 days looking for for answer and I still have no clue.

I have heard that textures consumes lot of memory but I am surprised how much.... I have 7 textures 1024 16 bit each. And while I will run my app it consumes 57MB of memory. I think that this is "a bit" too much.

I am writing 2D application (no cocos or other framework)

Strange is that while I will compile my app with disabled rendering methods: glDrawArrays than It uses only 27MB.... which is about 30MB less...

Do you have any Idea why?

I am creating textures before rendering of course: rendering looks like this:

[EAGLContext setCurrentContext:context]; glBindFramebufferOES(GL_FRAMEBUFFER_OES, defaultFramebuffer);

glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT);

glPushMatrix(); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glEnable(GL_TEXTURE_2D);

glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

TeksturaObrazek *obrazek_klaw =[[AppDirector sharedAppDirector] obrazek_klaw]; glBindTexture(GL_TEXTURE_2D, [[obrazek_klaw image_texture] name] );

glVertexPointer(2, GL_FLOAT, 0,vertex1); glTexCoordPointer(2, GL_FLOAT, 0, vertex2); glColor4f(1,1,1,alpha); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glPopMatrix(); [context presentRenderbuffer:GL_RENDERBUFFER_OES];

It looks like standard routine... I have spent about 2 days looking for for answer and I still have no clue.

I have heard that textures consumes lot of memory but I am surprised how much.... I have 7 textures 1024 16 bit each. And while I will run my app it consumes 57MB of memory. I think that this is "a bit" too much.

I am writing 2D application (no cocos or other framework)

Strange is that while I will compile my app with disabled rendering methods: glDrawArrays than It uses only 27MB.... which is about 30MB less...

Do you have any Idea why?

I am creating textures before rendering of course: rendering looks like this:

 [EAGLContext setCurrentContext:context];
 glBindFramebufferOES(GL_FRAMEBUFFER_OES, defaultFramebuffer);

 glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
        glClear(GL_COLOR_BUFFER_BIT);

 glPushMatrix();
 glEnableClientState(GL_VERTEX_ARRAY);
 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 glEnable(GL_TEXTURE_2D);
 
 glEnable(GL_BLEND);
 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

 TeksturaObrazek *obrazek_klaw =[[AppDirector sharedAppDirector] obrazek_klaw];
 glBindTexture(GL_TEXTURE_2D, [[obrazek_klaw image_texture] name] );

  glVertexPointer(2, GL_FLOAT, 0,vertex1);
  glTexCoordPointer(2, GL_FLOAT, 0, vertex2);
  glColor4f(1,1,1,alpha);
  glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

 glDisable(GL_BLEND);
 glDisable(GL_TEXTURE_2D);
 glDisableClientState(GL_TEXTURE_COORD_ARRAY);
 glPopMatrix();
    [context presentRenderbuffer:GL_RENDERBUFFER_OES];

It looks like standard routine... I have spent about 2 days looking for for answer and I still have no clue.

Source Link

opengl memory issue - quite strange.

I have heard that textures consumes lot of memory but I am surprised how much.... I have 7 textures 1024 16 bit each. And while I will run my app it consumes 57MB of memory. I think that this is "a bit" too much.

I am writing 2D application (no cocos or other framework)

Strange is that while I will compile my app with disabled rendering methods: glDrawArrays than It uses only 27MB.... which is about 30MB less...

Do you have any Idea why?

I am creating textures before rendering of course: rendering looks like this:

[EAGLContext setCurrentContext:context]; glBindFramebufferOES(GL_FRAMEBUFFER_OES, defaultFramebuffer);

glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT);

glPushMatrix(); glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glEnable(GL_TEXTURE_2D);

glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

TeksturaObrazek *obrazek_klaw =[[AppDirector sharedAppDirector] obrazek_klaw]; glBindTexture(GL_TEXTURE_2D, [[obrazek_klaw image_texture] name] );

glVertexPointer(2, GL_FLOAT, 0,vertex1); glTexCoordPointer(2, GL_FLOAT, 0, vertex2); glColor4f(1,1,1,alpha); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glPopMatrix(); [context presentRenderbuffer:GL_RENDERBUFFER_OES];

It looks like standard routine... I have spent about 2 days looking for for answer and I still have no clue.