作者littleshan (我要加入劍道社!)
看板GameDesign
標題Re: [程式] Open GL的texture問題
時間Mon Oct 30 17:24:01 2006
※ 引述《elfria (elfria)》之銘言:
: 我讀圖檔....結果讀一讀...讀了上百MB...
: 現在變成,再讀一張圖硬碟就會磨一下...速度變超慢...
: ------------這是我載入圖的方式---------------------
: glGenTextures(1, &texture);
: glBindTexture(GL_TEXTURE_2D, texture);
: glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, W, H,
: 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, data);
: 可是我不知道要怎麼 釋放記憶體!!
: 所以圖越讀越多, 速度越來越慢@_@
glDeleteTextures(1, &texture);
這樣會釋放配置在 texture 上的記憶體
如果說 glGenTexture() 相當於 malloc()
那麼 glDeleteTexture() 就相當於 free()
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.62.3.35
推 elfria:原來如此..不愧是OPEN GL之神.. 10/31 04:09
推 elfria:三分天下諸葛亮,一統江湖littleshan 10/31 04:12
→ elfria:這句話走在路上都能聽到小孩子在念 10/31 04:12