Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drawing image via OpenGL textures: no speedup?



Two things come to mind. The call stack is obviously somewhat bogus, OpenGL does a lot of runtime code gen which confuses samples so once you get past 0x1e821c8 things are really up in the air. Run the OpenGL Profiler on your app (which gives the right calls stats) and look at the call stats to determine were time in GL is being spent.

OK. OpenGLProfiler says 68% of time is spent in glBegin(). 27% in glFlush() (I changed the code from glFinish() to glFlush() ), 4% in glDeleteTextures.

The only I call glBegin() is at the start of the defineQuad: method.

Second, turn off execution of all OpenGL entry points and see what the change in frame rate is (i.e., how much affect does GL have on the app's speed).

In this particular case, close to 100%. Squeak is a Smalltalk programming system. I was trying to see if/how OpenGL-based drawing could speed up the display subsystem. To get an upper bound (should be best case for OpenGL), I evaluated an expression that flushes Squeak's entire Display-bitmap to the actual screen.

One thing to think about is that if you are updating the texture every frame you are more like a movie app then an image app.

The *real* common case is updating partial parts of the bitmap: Squeak has its own windowing system that runs inside a host system's window (or full-screen). However, I think I want to get the basics right first before tackling the advanced stuff. And most importantly: have some idea that what I am doing is actually worthwhile.

So keep this in mind (you are using shared memory which would be the right thing). If you are modifying your texture in place you will also need to correctly fence that modification.

Yes, but this is also something for later. Ultimately, I think I will want to keep the main bitmap in VRAM and just update parts of it from main memory, via the AGP. Or even keep individial Squeak morphs (graphical objects) cached on the card and render those.

We should have more examples out next week showing some of these techniques.

Great! However, it still suspiciously looks like there is a main-memory copy being made, both because of the call-stack and the performance profile. So a somewhat more specific question would be: what could be causing OpenGL to make a copy despite the flags I've set? Is there some what to find out, and some way to stop it?

Thanks,

Marcel

Here is the output from OpenGL Profiler:

GL Function;Total Time (5sec);Number of Calls;Avg Time (5sec);% Total Time
CGLUpdateContext;0;208;0.00;0.00
glBegin;8166416;206;39642.80;68.35
glBindTexture;2150;206;10.44;0.02
glDeleteTextures;488460;206;2371.17;4.09
glDisable;667;206;3.24;0.01
glEnable;370;618;0.60;0.00
glEnd;1079;205;5.26;0.01
glFlush;3282350;205;16011.46;27.47
glLoadIdentity;1;2;0.92;0.00
glMatrixMode;1;2;0.98;0.00
glPixelStorei;440;412;1.07;0.00
glTexCoord2f;933;820;1.14;0.01
glTexImage2D;2927;206;14.21;0.02
glTexParameterf;841;206;4.08;0.01
glTexParameteri;661;1,030;0.64;0.01
glVertex2f;396;820;0.48;0.00
glViewport;5;1;5.81;0.00

--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
_______________________________________________
mac-opengl mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/mac-opengl
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Drawing image via OpenGL textures: no speedup? (From: Geoff Stahl <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.