我剛遇到一個奇怪的問題。我試圖加載一個模型到OpenGL,並在我加載紋理的部分使用auxDIBImageLoadA(dibfile:PWideChar)
函數。這裏是我的代碼調用它帶PWideChar參數的函數只取第一個字符
procedure CreateTexture(var textureArray: array of UINT; strFileName: string; textureID: integer); // Vytvožení textury
var
pBitmap: PTAUX_RGBImageRec;
begin
if strFileName = '' then exit;
MessageBox(0,PWideChar(strFileName),nil,SW_SHOWNORMAL);
pBitmap := auxDIBImageLoadA(PWideChar(strFileName));
if pBitmap = nil then exit;
...
MessageBox只是爲了控制。這就是發生的情況:我運行該應用程序,出現一個包含"FACE.BMP"
的框。好的。但後來我得到一個錯誤,說"Failed to open DIB file F"
。當我將stFileName
設置爲xFACE.BMP
時,我得到"Failed to open DIB file x"
。因此,出於某種原因,該函數似乎只取第一個字符。
我錯過了什麼嗎?我使用的glaux.dll是我從不同來源下載的5次,所以它應該沒有問題(我希望每個OpenGL站點都提到它)。
WideChar' 'F''表示爲兩個AnsiChars'' F」,#0' Unicode版本,和你在這裏,截斷字符串 – 2011-06-11 17:36:03
總是寫你的delphi版本。 – 2011-06-12 03:03:33
對。這是XE。 – 2011-06-12 07:59:33