Hi
I want to set the particular bytearray as a thin plot (dot) in a texturing .How do i? if possible plz consider my problem.
i sent that code also.
following code is:
OnPaint()
{
glEnable (GL_BLEND) ;
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) ;
glShadeModel (GL_SMOOTH) ;
glEnable(GL_TEXTURE_2D) ;
glPushMatrix() ;
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR) ;
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) ;
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP) ;
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP) ;
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR) ;
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) ;
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB , m_nWidth, m_nHeight, 0, GL_RGB, GL_UNSIGNED_BYTE, m_nTextureData) ;
LoadSubImageTexture() ;
glPopMatrix() ;
glDisable(GL_TEXTURE_2D) ;
}
void CPPIDisplayCtrl::LoadSubImageTexture()
{
GLfloat fYoffSetVal,fXoffSetVal ;
//user's Point of view Outer most circle Radius 20 / 55 is a radius of outermost circle in Pc point of view.
fRangeResolution = m_fRangeVal / 0.36363636363636363636363636363636 ;
// To locate the point on specified angle
//0.017453292519943295769236907684886 Used to radian to degree convertion factor (PI/180).
m_fXOffsetVal = (fRangeResolution * sin(m_fAzimuth * 0.017453292519943295769236907684886)) ;
//Used to locate the point with (64,64) as center of the PPI.
fXoffSetVal = 64.0 + m_fXOffsetVal ;
m_fYOffsetVal = (fRangeResolution * cos(m_fAzimuth * 0.017453292519943295769236907684886)) ;
fYoffSetVal = 64.0 - m_fYOffsetVal ;
int nIndex = (((int)fXoffSetVal) * 3.0) + (128.0 * ((int)fYoffSetVal) * 3.0) ; //(128 * 53 * 3) + (63* 3); 53 is Y value && 63 is X value //20 95 //47 115
//nIndex = nIndex - (nIndex % 3) ;
//Changing color when plotting points are going to an outside of the circle.
//if(fRangeResolution <= 55.0000)
////int n = (82 * 3) + (128 * 11 * 3) ;
// m_nTextureData[nIndex] = 255 ;
//else//
m_nTextureData[nIndex + 1/*+ 1*/] = 255 ;
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_nWidth, m_nHeight, GL_RGB , GL_UNSIGNED_BYTE, m_nTextureData);
SetTextureCoOrdinate() ;
}
void CPPIDisplayCtrl::SetTextureCoOrdinate()
{
RECT rect;
GetClientRect(&rect) ;
int nWindowWidth = rect.right - rect.left ;
int nWindowHeight = rect.bottom - rect.top ;
gluOrtho2D(0, nWindowWidth/2, nWindowHeight/2, 0) ;
glBegin(GL_POLYGON) ;
glTexCoord2f(0.0f, 0.0f) ;
glVertex2i(0, 0) ;
glTexCoord2f(1.0f, 0.0f) ;
glVertex2i(nWindowWidth/2 , 0) ;
glTexCoord2f(1.0f, 1.0f) ;
glVertex2i(nWindowWidth/2, nWindowHeight/2) ;
glTexCoord2f(0.0f, 1.0f) ;
glVertex2i(0, nWindowHeight/2 ) ;
glEnd() ;
}