|
XTexture Class
|
XTexture는 내부에서 OpenGL로 렌더링하기 위한 단위요소(Bitmap File)를 로딩하여 그리기 위해 사용된다.
Inheritance Hierarchy
Namespace: Pixoneer.NXDL.NGRAssembly: NXDLgr (in NXDLgr.dll) Version: 2.0.3.38
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등을 로딩하여 화면에 도시할 수 있다.
|
 | 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