오류 LNK2019 auxDIBImageLoadA 외부 기호(참조 위치: "int __cdecl LoadGLTextures(void)" (?LoadGLTextures@@YAHXZ) 함수)에서 확인하지 못했습니다. 라는 오류가 계속 뜹니다. 이 오류가 Window응용프로그램에서 콘솔기반으로바꾸면 된다는데 그거 말고는 해결법이 없을 까요? 다른 이미지 로드하는 방법이라도ㅜㅜ 살려주세요!!
#include "stdafx.h"
#include "alcohol.h"
#include "OpenGLView.h"
#include "./include/GL/glew.h"
#include "./include/GL/wglew.h"
#include "./include/GL/glut.h"
#include "./include/GL/glaux.h"
#pragma comment(lib, "OpenGL32.lib")
#pragma comment(lib, "./lib/glew32.lib")
#pragma comment(lib, "./lib/glut32.lib")
#pragma comment(lib, "./lib/glaux.lib")
GLuint texture[1];
int LoadGLTextures()
{
AUX_RGBImageRec *TextureImage = auxDIBImageLoadA("./blood.bmp");
int Status = FALSE;
memset(TextureImage, 0, sizeof(void *) * 1);
if (TextureImage != NULL)
{
Status = TRUE;
glGenTextures(1, &texture[0]);
glBindTexture(GL_TEXTURE_2D, texture[0]);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage->sizeX, TextureImage->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage->data);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
else return FALSE;
if (TextureImage)
{
if (TextureImage->data)
{
free(TextureImage->data);
}
free(TextureImage);
}
return Status;
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}
// COpenGLView 그리기입니다.
void COpenGLView::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: add draw code here
HDC hdc = ::GetDC(m_hWnd);
HGLRC hglrc;
hglrc = wglCreateContext(hdc);
wglMakeCurrent(hdc, hglrc);
glClearColor(0.0, 0.0, 0.0, 0.0);
LoadGLTextures();
glPushMatrix();
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, texture[0]);
glBegin(GL_QUADS);
glTexCoord2f(0.0, 1.0); glVertex2f(-1.0, 1.0);
glTexCoord2f(1.0, 1.0); glVertex2f(1.0, 1.0);
glTexCoord2f(1.0, 0.0); glVertex2f(1.0, -1.0);
glTexCoord2f(0.0, 0.0); glVertex2f(-1.0, -1.0);
glEnd();
glDisable(GL_TEXTURE_2D);
glPopMatrix();
glFlush();
SwapBuffers(hdc);
wglMakeCurrent(NULL, NULL);
::ReleaseDC(m_hWnd, hdc);
wglDeleteContext(hglrc);
}
// COpenGLView 진단입니다.
#ifdef _DEBUG
void COpenGLView::AssertValid() const
{
CView::AssertValid();
}
#ifndef _WIN32_WCE
void COpenGLView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
#endif
#endif //_DEBUG
// COpenGLView 메시지 처리기입니다.
int COpenGLView::SetupPixelFormat(HDC hdc)
{
PIXELFORMATDESCRIPTOR pfd =
{
sizeof(PIXELFORMATDESCRIPTOR), //size of this pfd
1, //version number
PFD_DRAW_TO_WINDOW | //support window
PFD_SUPPORT_OPENGL | //supprt opengl
PFD_DOUBLEBUFFER, //double buffering
PFD_TYPE_RGBA, //RGBA type
24, //24bit color depth
0,0,0,0,0,0, //color bit ignored
0, //no alpha buffer
0, //shift bit ignored
0, //no accumulation buffer
0,0,0,0, //accumm bits ignored
32, //32bit z buffer
0,
0,
PFD_MAIN_PLANE, //main layer
0,
0,0,0
};
int iPixelFormat;
//get the device context's best, abailable pixel format match
if ((iPixelFormat = ChoosePixelFormat(hdc, &pfd)) == 0)
{
MessageBox(TEXT("ChoosePixelFormat Failed!"), TEXT("Error"), MB_OK);
return 0;
}
//make that match the device context's current pixel format
if (SetPixelFormat(hdc, iPixelFormat, &pfd) == FALSE)
{
MessageBox(TEXT("SetPixelFormat Failed!"), TEXT("Error"), MB_OK);
return 0;
}
return 1;
}
int COpenGLView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: 여기에 특수화된 작성 코드를 추가합니다.
SetupPixelFormat(::GetDC(m_hWnd));
return 0;
}