|
XTexture Class
|
XTexture 클래스는 텍스처 데이터를 OpenGL에서 렌더링하기 위한 다양한 기능을 제공한다.
Inheritance Hierarchy
Namespace: Pixoneer.NXDL.NGRAssembly: NXDLgr (in NXDLgr.dll) Version: 3.0.0.0
Syntaxpublic class XTexture : IDisposable
The XTexture type exposes the following members.
Constructors
Properties
Methods | Name | Description |
---|
 | Bind | 텍스처 객체를 OpenGL에 바인딩한다. |
 | FreeTextureInDevice | 디바이스(그래픽 카드)에서 관리되고 있는 텍스처를 삭제한다. |
  | GetRGBA | 입력 문자열에 대한 텍스쳐 데이터를 RGBA 형식으로 로딩한다. 파일 형태 또는 키워드를 이용한 텍스처 로딩을 할 수 있다. |
 | Load | 파일 경로(PNG, BMP, JPG등 파일) 또는 텍스처 키워드(TextureDriver를 활용할 때)를 이용하여 텍스처 데이터를 로딩한다. |
 | SendTextureToDevice | 이 객체를 디바이스(그래픽 카드)에서 사용할 수 있도록 한다. |
  | Set |
32 비트형 비트맵 데이터를 XTexture 객체에 설정한다.
|
Top
Example
XTexture 객체를 생성하고 파일에서 로딩한 후 NXPlanetLayer의 OnOrthoRender 이벤트 함수에서 로딩한 텍스쳐를 화면에 그린다.
public XTexture m_TexLogo;
public FormMain_Load()
{
m_TexLogo = new XTexture();
m_TexLogo.Load("D:/Sample/pixoneerlogo.bmp");
}
private bool nxPlanetLayer1_OnOrthoRender(object sender, NXPlanetDrawArgs e)
{
if (m_TexLogo.Loaded)
{
if (!m_TexLogo.InDevice)
m_TexLogo.SendTextureToDevice();
e.Graphics.glDisable(XGraphics.GL_DEPTH_TEST);
e.Graphics.glEnable(XGraphics.GL_TEXTURE_2D);
e.Graphics.glBindTexture(XGraphics.GL_TEXTURE_2D, (uint)m_TexLogo.GLTextureID);
e.Graphics.glColor3f(1.0f, 1.0f, 1.0f);
e.Graphics.glBegin(XGraphics.GL_QUADS);
e.Graphics.glTexCoord2f(0, 1); e.Graphics.glVertex3d(e.ViewArea.Width - 215, e.ViewArea.Height - 84, 0);
e.Graphics.glTexCoord2f(0, 0); e.Graphics.glVertex3d(e.ViewArea.Width - 215, e.ViewArea.Height - 10, 0);
e.Graphics.glTexCoord2f(1, 0); e.Graphics.glVertex3d(e.ViewArea.Width - 10, e.ViewArea.Height - 10, 0);
e.Graphics.glTexCoord2f(1, 1); e.Graphics.glVertex3d(e.ViewArea.Width - 10, e.ViewArea.Height - 84, 0);
e.Graphics.glEnd();
e.Graphics.glEnable(XGraphics.GL_DEPTH_TEST);
e.Graphics.glDisable(XGraphics.GL_TEXTURE_2D);
}
return default(bool);
}
See Also