15,895,192 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Member 10536430 (Top 38 by date)
Member 10536430
21-Apr-16 1:00am
View
Thanks a lot for your answer.
I updated and cleaned my code and got the answer.
Member 10536430
20-Apr-16 5:40am
View
The above example is for creating window for each opengl textures, actually i want to display 2 opengl textures in one window. How to do that?
Member 10536430
20-Apr-16 3:21am
View
i got the solution by using glcolor4f with different slider values
Member 10536430
20-Apr-16 3:11am
View
can you please help me in solving http://www.codeproject.com/Questions/1094584/Display-opengl-texture-in-left-and-right-plane-in
Member 10536430
19-Apr-16 1:23am
View
Thanks a lot for your valuable comments. I removed the unwanted lines and then replaced glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ) this line with glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE ); and my issue is solved. Thanks a lot for spending your valuable time in solving the issue.
Member 10536430
18-Apr-16 10:35am
View
const int CIRCLEWIDTH = 700;
const int CIRCLEHEIGHT = 500;
const int CIRCLEPIXEL = 3;
Member 10536430
18-Apr-16 10:24am
View
Thanks a lot. I got the result, instead of using m_glTextureWidth , i used another values for width n height and the error was solved. Now my problem is when i try to display that byte array, i,m getting the image along with a background.
I used the below code
BYTE* pbyNewImageData = NULL;
pbyNewImageData = new BYTE[ CIRCLEWIDTH * CIRCLEHEIGHT * 3];
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glEnable( GL_TEXTURE_2D );
glGenTextures( 1, &m_glTexture[1] );
glBindTexture( GL_TEXTURE_2D, m_glTexture[1] );
glColorMaterial( GL_FRONT, GL_AMBIENT_AND_DIFFUSE );
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE ); // Select modulate to mix texture with color for shading
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST ); // When texture area is small, bilinear filter the closest mipmap
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST ); // When texture area is large, bilinear filter the original
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT ); // The texture wraps over at the edges (repeat)
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGB, CIRCLEWIDTH, CIRCLEHEIGHT, 0, GL_RGB, GL_UNSIGNED_BYTE, pbyNewImageData );
glEnable( GL_TEXTURE_2D );
glBindTexture( GL_TEXTURE_2D, m_glTexture[1] );
glBegin( GL_QUADS );
glTexCoord2d( 0.0,0.0 );
glVertex2f( -0.8f, -0.8f );
glTexCoord2d( 1.0,0.0 );
glVertex2f( 0.8f, -0.8f );
glTexCoord2d( 1.0,1.0 );
glVertex2f( 0.8f, 0.8f );
glTexCoord2d( 0.0,1.0 );
glVertex2f( -0.8f, 0.8f );
glEnd();
SwapBuffers( m_hDeviceContextDC );
glDisable( GL_TEXTURE_2D );
delete[] pbyNewImageData;
Member 10536430
18-Apr-16 1:45am
View
glGetTexLevelParameteriv( GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &m_glTextureWidth );
returning 0 . Why
Member 10536430
15-Apr-16 7:35am
View
Can you Please help me in solving http://www.codeproject.com/Questions/1092666/Save-opengl-texture-into-a-byte-array.
Member 10536430
15-Apr-16 0:51am
View
Thanks a lot for your reply. The above issue is because of " SwapBuffers( m_hDeviceContextDC ); " . when the above line was called, the previously drawn image will be dissappearing. I modified the button click.
Member 10536430
13-Apr-16 9:28am
View
Can you please help me in solving the question in below link
http://www.codeproject.com/Questions/1092145/When-I-draw-a-square-using-opengl-over-opengl-text
Member 10536430
13-Apr-16 8:20am
View
Actually i need to move the object in the mouse direction, that is when i click the left button of mouse and move the cursor, it must move along with that. And when i click the right button of mouse and move the cursor then the size of object must be changed.
Member 10536430
13-Apr-16 4:25am
View
thanks a lot for your help. My issue has been solved.
Member 10536430
13-Apr-16 1:44am
View
So for lighting effects what code did you use here i.e how did you produce lighting effects ?
Member 10536430
13-Apr-16 0:27am
View
Can you please post the code here. i could not get it from the above site.
Member 10536430
13-Apr-16 0:24am
View
Actually m_pbyImageData is a byte array that contains a .bin file data. I used that byte array to display the texture. It is a 8 bit image, i used GL_RGB and GL_RGBA but i didnt get any texture so i used GL_LUMINANCE . the code i used to initialize is
void DisplayTextureDlg::Initialize(void)
{
PIXELFORMATDESCRIPTOR pfPixelFormator ;
memset(&pfPixelFormator, 0, sizeof(PIXELFORMATDESCRIPTOR));
pfPixelFormator.nSize = sizeof(PIXELFORMATDESCRIPTOR);
pfPixelFormator.cColorBits = 24;
pfPixelFormator.cDepthBits = 8;
pfPixelFormator.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER ;
pfPixelFormator.iPixelType = PFD_TYPE_RGBA;
pfPixelFormator.nVersion = 1;
//CClientDC ClientDC(this);
//m_hDeviceContextDC = ClientDC.GetSafeHdc();
CWnd* pPictureWnd = GetDlgItem(IDC_STATIC_PICTURE);
m_hDeviceContextDC = pPictureWnd->GetDC()->GetSafeHdc();
int nPixelFormat = ChoosePixelFormat(m_hDeviceContextDC, &pfPixelFormator);
SetPixelFormat(m_hDeviceContextDC,nPixelFormat, &pfPixelFormator);
m_hRenderContextRC = wglCreateContext(m_hDeviceContextDC);
wglMakeCurrent(m_hDeviceContextDC, m_hRenderContextRC);
glClearColor(5.0f, 5.0f, 5.0f, 5.0f);
glClearDepth(0.0f);
}
Then i used the above code (which was posted earlier).
Member 10536430
11-Apr-16 4:48am
View
Does anybody know how to do this. If yes then could you please post a solution.
Member 10536430
8-Apr-16 5:03am
View
can anyone please give me an example of changing the intensity on opengl with slider control.
Member 10536430
8-Apr-16 0:18am
View
Can you please give me an example ? how to manipulate the intensity, i need the code , i am actually new to opengl .
Member 10536430
6-Apr-16 8:02am
View
the final solution is updated, got the solution. Thanks a lot for your help
Member 10536430
6-Apr-16 6:55am
View
how to use gluBuild2DMipmaps and glTexImage2D when the bin file image is only 8 bit.
Member 10536430
6-Apr-16 6:11am
View
the image i get is smaller and it is repeating
Member 10536430
6-Apr-16 6:09am
View
i dont know how to attach image here, only if i attach the actual image and the image i get you could understand the issue.
Member 10536430
6-Apr-16 6:04am
View
I got it partially correct way, my changed code is
void CDisplayTextureDlg::OnBnClickedOk()
{
GLuint glTexture;
glTexture = LoadTexture();
glEnable( GL_TEXTURE_2D );
glBindTexture( GL_TEXTURE_2D, glTexture );
glBegin( GL_QUADS );
glTexCoord2d(0.0,0.0);
glVertex2d(0.0,0.0);
glTexCoord2d(1.0,0.0);
glVertex2d(1.0,0.0);
glTexCoord2d(1.0,1.0);
glVertex2d(1.0,1.0);
glTexCoord2d(0.0,1.0);
glVertex2d(0.0,1.0);
glEnd();
SwapBuffers(m_hDeviceContext);
// CDialogEx::OnOK();
}
GLuint CDisplayTextureDlg :: LoadTexture()
{
char* pchBinBuffer = NULL;
BYTE* bData = NULL;
pchBinBuffer = new char[nWIDTH *nHEIGHT * nPIXEL];
bData = new BYTE[nWIDTH *nHEIGHT * nPIXEL ];
TCHAR tchFileName[MAX_PATH];
swprintf_s(tchFileName, _T("D:\\Bin Files\\InputData_1280_690.bin"));
FILE* pFile = NULL;
_wfopen_s(&pFile, tchFileName, _T("rb"));
if(NULL != pFile)
{
fread(bData, nWIDTH *nHEIGHT * nPIXEL * sizeof( unsigned char ), 1, pFile);
// memset( bData, 255, 1280 *690 * 3 );
fclose(pFile);
}
GLuint glTexture ;
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glEnable(GL_TEXTURE_2D);
glGenTextures(1, &glTexture);
glBindTexture(GL_TEXTURE_2D, glTexture);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); // select modulate to mix texture with color for shading
// when texture area is small, bilinear filter the closest mipmap
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_NEAREST );
// when texture area is large, bilinear filter the original
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
// the texture wraps over at the edges (repeat)
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
gluBuild2DMipmaps( GL_TEXTURE_2D, 1, nWIDTH, nHEIGHT, GL_RGB, GL_UNSIGNED_BYTE, bData );
// glTexImage2D(GL_TEXTURE_2D,0, 1 , nWIDTH, nHEIGHT, 0, GL_BGR_EXT , GL_UNSIGNED_BYTE, bData);
delete [] pchBinBuffer;
delete[] bData;
return glTexture;
}
void CDisplayTextureDlg::Initialize(void)
{
PIXELFORMATDESCRIPTOR pfd ;
memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR));
pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
pfd.cColorBits = 16;
pfd.cDepthBits = 16;
pfd.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER ;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.nVersion = 1;
CClientDC dc(this);
m_hDeviceContext = dc.GetSafeHdc();
int nPixelFormat = ChoosePixelFormat(m_hDeviceContext, &pfd);
SetPixelFormat(m_hDeviceContext,nPixelFormat, &pfd);
m_hRenderContext = wglCreateContext(m_hDeviceContext);
wglMakeCurrent(m_hDeviceContext, m_hRenderContext);
glClearColor(2.0f, 2.0f, 2.0f, 0.0f);
glClearDepth(0.0f);
OnBnClickedOk();
}
Now the issue i'm facing is that the image is not in the way i get.
Member 10536430
6-Apr-16 2:40am
View
I updated my code to
void CRead_Bin_File_And_Display_TextureDlg::OnBnClickedOk()
{
GLuint glTexture;
glTexture = LoadTexture();
glEnable( GL_TEXTURE_2D );
glBindTexture( GL_TEXTURE_2D, glTexture );
glBegin( GL_QUADS );
glTexCoord2d(0.0,0.0); glVertex2d(0.0,0.0);
glTexCoord2d(1.0,0.0); glVertex2d(1.0,0.0);
glTexCoord2d(1.0,1.0); glVertex2d(1.0,1.0);
glTexCoord2d(0.0,1.0); glVertex2d(0.0,1.0);
glEnd();
// CDialogEx::OnOK();
}
GLuint CRead_Bin_File_And_Display_TextureDlg :: LoadTexture()
{
char* chBinBuffer = NULL;
BYTE* bData = NULL;
chBinBuffer = new char[1280 *690 * 3];
bData = new BYTE[1280 *690 * 3 ];
TCHAR tchFileName[MAX_PATH];
swprintf_s(tchFileName, _T("D:\\Image Bin Files\\InputData_1280_690.bin"));
FILE* pFile = NULL;
_wfopen_s(&pFile, tchFileName, _T("rb"));
if(NULL != pFile)
{
fread(bData, 1280 *690 * 3 * sizeof( unsigned char ), 1, pFile);
// memset( bData, 255, 1280 *690 * 3 );
fclose(pFile);
}
GLuint glTexture ;
glEnable(GL_TEXTURE_2D);
glGenTextures(1, &glTexture);
glBindTexture(GL_TEXTURE_2D, glTexture);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); // select modulate to mix texture with color for shading
// when texture area is small, bilinear filter the closest mipmap
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_LINEAR );
// when texture area is large, bilinear filter the original
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
// the texture wraps over at the edges (repeat)
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
// // build our texture mipmaps
gluBuild2DMipmaps( GL_TEXTURE_2D, 3, 1280, 690,
GL_RGB, GL_UNSIGNED_BYTE, bData );
//glTexImage2D(GL_TEXTURE_2D,0, GL_RGBA8 , 1280, 690, 0, GL_RGBA , GL_UNSIGNED_BYTE, bData);
//glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, 1280, 690, GL_RGBA, GL_UNSIGNED_BYTE, bData );
delete [] chBinBuffer;
delete[] bData;
return glTexture;
}
but still no change
Member 10536430
6-Apr-16 2:23am
View
can you give any other example relating this case
Member 10536430
6-Apr-16 1:21am
View
which solution
Member 10536430
6-Apr-16 1:20am
View
GLuint glTexture;
glEnable(GL_TEXTURE_2D);
glGenTextures(1, &glTexture);
glBindTexture(GL_TEXTURE_2D, glTexture);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); // select modulate to mix texture with color for shading
// when texture area is small, bilinear filter the closest mipmap
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
GL_NEAREST );
// when texture area is large, bilinear filter the original
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
// the texture wraps over at the edges (repeat)
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
// // build our texture mipmaps
/* gluBuild2DMipmaps( GL_TEXTURE_2D, 3, 1280, 690,
GL_RGBA, GL_UNSIGNED_BYTE, Bitmap_Data );*/
glTexImage2D(GL_TEXTURE_2D,0, GL_RGBA8, 1280, 690, 0, GL_RGBA, GL_UNSIGNED_BYTE, Bitmap_Data);
the above code is the code i used for applying texture.
I'm new to opengl and i cant understand all the code given in the ablve link. it seems complicated. the above data is valid because i have converted the bin data to bitmap and got the image correctly.
Member 10536430
6-Apr-16 0:46am
View
thw above link only has codes that can be used in win32 programming i need it in mfc. the above code i used , i got it from one example that can covert .raw data to opengl texture, it is also written that all other types of files can also be tried. So i tried .bin files. I got the code from http://www.nullterminator.net/gltexture.html .
Member 10536430
5-Apr-16 8:49am
View
I tried it but no change, still not getting any output.
Member 10536430
5-Apr-16 8:12am
View
actually it is a image and i need to get that image from bin file and display as texture. I have converted this bin file to bmp and displayed it on MFC. but now i need to display it as texture and i'm not getting it.
Member 10536430
30-Mar-16 5:30am
View
sorry i missed it, actualy i have beginpath in my code . At first i have drawn all the segments , then in each spin control click i need to increment the angle of a particular segment , while incrementing that particular segment the next segment after that respective segment will be dissappearing. actually while incrementing i need that segment to come over the next one.
Member 10536430
30-Mar-16 4:16am
View
I used angle arc to divide circle into 8 segments, when i extend an angle of one angle arc then the other dissappears , it does not overwrites what to do?
What I have tried:
i used the below code
MoveToEx(hMemDC,50,50 , (LPPOINT) NULL);
AngleArc(hMemDC, 50 , 50 , 47, 0, 45);
SetArcDirection(m_hMemDC, AD_CLOCKWISE);
LineTo(hMemDC,50,50);
EndPath(hMemDC);
StrokeAndFillPath(hMemDC);
then
MoveToEx(hMemDC,50,50 , (LPPOINT) NULL);
AngleArc(hMemDC, 50 , 50 , 47, 45, 45);
SetArcDirection(m_hMemDC, AD_CLOCKWISE);
LineTo(hMemDC,50,50);
EndPath(hMemDC);
StrokeAndFillPath(hMemDC);
and so on..
now if i want to increase the angle of 2nd segment to 55 degrees then the 3rd segment dissappears. how to solve it ?
Member 10536430
29-Mar-16 6:45am
View
thanks a lot....
Member 10536430
28-Mar-16 23:59pm
View
Deleted
nBlueOne = m_pPixelDataInfo->m_arnPixB[nColor - 1][nIdx];
// If the selected color is not the last color in the color bar index,
// take the color from nColor index position.
if( m_nNumColorsOnColorMap != nColorBarIdx_i )
{
nRedTwo = m_pPixelDataInfo->m_arnPixR[nColor][nIdx];
nGreenTwo = m_pPixelDataInfo->m_arnPixG[nColor][nIdx];
nBlueTwo = m_pPixelDataInfo->m_arnPixB[nColor][nIdx];
}
if(( COLOR_SPIN_VALUE_MIN != fCurrentTime - fTime[nColor - 1] ))
{
float fTimeCurrentIndex = fTime[nColor - 1];
stColorThree.nRedVal = static_cast<int>(( nRedTwo - nRedOne ) *
( fCurrentTime - fTimeCurrentIndex ) /
( fTime[nColor] - fTimeCurrentIndex ) +
nRedOne );
stColorThree.nGreenVal = static_cast<int>(( nGreenTwo - nGreenOne ) *
( fCurrentTime - fTimeCurrentIndex ) /
( fTime[nColor] - fTimeCurrentIndex ) +
nGreenOne );
stColorThree.nBlueVal = static_cast<int>(( nBlueTwo - nBlueOne ) *
( fCurrentTime - fTimeCurrentIndex ) /
( fTime[nColor] - fTimeCurrentIndex ) +
nBlueOne );
}
else
{
stColorThree.nRedVal = static_cast<int>(( nRedOne - nRedTwo ) + nRedTwo );
stColorThree.nGreenVal = static_cast<int>(( nGreenOne - nGreenTwo ) + nGreenTwo );
stColorThree.nBlueVal = static_cast<int>(( nBlueOne - nBlueTwo ) + nBlueTwo );
}
COLORREF cColor =RGB( stColorThree.nRedVal, stColorThree.nGreenVal, stColorThree.nBlueVal );
// Color myColor(stColorThree.nRedVal, stColorThree.nGreenVal, stColorThree.nBlueVal);
CRect rectFill( nPixel, rect.top, nPixel + 1, rect.bottom );
// Graphics m_gGraphics(hMemDC) ;
// SolidBrush* sSolidBrush = new SolidBrush(myColor);
// m_gGraphics.FillEllipse(sSolidBrush, nPixel, rect.top, nPixel + 1, rect.bottom);
// m_gGraphics.FillPie(sSolidBrush,rect.CenterPoint().x,rect.CenterPoint().y,100,100,0,90);
// COLORREF cColor = RGB(200,100,200);
HBRUSH hBrush = CreateSolidBrush( cColor );
HBRUSH hbrushOld = static_cast<hbrush>( SelectObject( hMemDC, hBrush ));
// FillRect( hMemDC, &rectFill, hBrush );
BeginPath(hMemDC);
MoveToEx(hMemDC,50,50 , (LPPOINT) NULL);
AngleArc(hMemDC, 50 , 50 , 47, nPixel, nPixel * 3);
SetArcDirection(m_hMemDC, AD_CLOCKWISE);
LineTo(hMemDC,50,50);
EndPath(hMemDC);
StrokeAndFillPath(hMemDC);
SelectObject(hMemDC, hbrushOld);
DeleteObject( hBrush );
hBrush = NULL;
}
}
}
fCurrentTime += fTimePerPixel;
}
Member 10536430
28-Mar-16 23:58pm
View
Deleted
{ CRect rect;
rect.top = pnArnHeight[nIdx + 1];
rect.bottom = pnArnHeight[nIdx];
rect.left = nLeftBdr;
rect.right = nRightBdr;
if( 0 != IsRectEmpty( &rect ))
{
continue;
}
COLORREF cColor = RGB( m_pPixelDataInfo->m_arnPixR[nColor - 1][nIdx],
m_pPixelDataInfo->m_arnPixG[nColor - 1][nIdx],
m_pPixelDataInfo->m_arnPixB[nColor - 1][nIdx] );
CRect rectFill( nPixel, rect.top, nPixel + 1, rect.bottom );
HBRUSH hBrush = CreateSolidBrush( cColor );
HBRUSH hbrushOld = static_cast<hbrush>( SelectObject( m_hMemDC, hBrush ));
//FillRect( m_hMemDC, &rectFill, hBrush );
SelectObject( m_hMemDC, hbrushOld );
BeginPath(m_hMemDC);
MoveToEx(m_hMemDC,50,50, (LPPOINT) NULL);
AngleArc(m_hMemDC, 50 , 50 , 47, nPixel, nPixel + 1);
SetArcDirection(m_hMemDC, AD_CLOCKWISE);
LineTo(m_hMemDC,50,50);
EndPath(m_hMemDC);
StrokeAndFillPath(m_hMemDC);
DeleteObject( hBrush );
hBrush = NULL;
} // end of for( int nIdx = nIntensityVal - 1; nIdx >= 0; nIdx-- )
}
else
{
// When smaller than the maximum value.
// When gradation is not used (simple)
if( !m_pColorMapInfo->m_bGradChecked )
{
for( int nIdx = nIntensityVal - 1; nIdx >= 0; nIdx-- )
{
CRect rect;
rect.top = pnArnHeight[nIdx + 1];
rect.bottom = pnArnHeight[nIdx];
rect.left = nLeftBdr;
rect.right = nRightBdr;
if( 0 != IsRectEmpty( &rect ))
{
continue;
}
COLORREF ColorRef = RGB( m_pPixelDataInfo->m_arnPixR[nColor - 1][nIdx], m_pPixelDataInfo->m_arnPixG[nColor - 1][nIdx],
m_pPixelDataInfo->m_arnPixB[nColor - 1][nIdx] );
CRect rectFill( nPixel, rect.top, nPixel + 1, rect.bottom );
COLORREF cColor = RGB(200,200,100);
HBRUSH hBrush = CreateSolidBrush( ColorRef );
HBRUSH hbrushOld = static_cast<hbrush>( SelectObject( m_hMemDC, hBrush ));
// FillRect( m_hMemDC, &rectFill, hBrush );
SelectObject( m_hMemDC, hbrushOld );
BeginPath(m_hMemDC);
MoveToEx(m_hMemDC,50,50, (LPPOINT) NULL);
AngleArc(m_hMemDC, rect.top , rect.bottom , 47, nPixel, nPixel+1);
SetArcDirection(m_hMemDC, AD_CLOCKWISE);
LineTo(m_hMemDC,50,50);
EndPath(m_hMemDC);
StrokeAndFillPath(m_hMemDC);
DeleteObject( hBrush );
hBrush = NULL;
}
}
else
{
// When gradation is used
//nIntensityVal = 30;
for( int nIdx = nIntensityVal - 1; nIdx >= 0; nIdx-- )
{
int nRedOne = 0;
int nGreenOne = 0;
int nBlueOne = 0;
int nRedTwo = 0;
int nGreenTwo = 0;
int nBlueTwo = 0;
CRect rect;
rect.top = pnArnHeight[nIdx + 1];
rect.bottom = pnArnHeight[nIdx];
rect.left = nLeftBdr;
rect.right = nRightBdr;
if( IsRectEmpty( &rect ))
{
continue;
}
// Take the color from nColor - 1 index position.
nRedOne = m_pPixelDataInfo->m_arnPixR[nColor - 1][nIdx];
nGreenOne = m_pPixelDataInfo->m_arnPixG[nColo
Member 10536430
28-Mar-16 23:58pm
View
Deleted
// SBE_TRACE_IN( BTI, _T( "BTIColorMapControl::UpdateColor()" ));
if(( 0 > nColorBarIdx_i ) || ( nColorBarIdx_i > m_nNumColorsOnColorMap ))
{
return;
}
const int ARRAY_INDEX_ZERO = 0;
const int COLOR_MAP_RIGHT = 266;
const float COLOR_SPIN_VALUE_MIN = 0.0;
int* pnArnwidth = 0;
int* pnArnHeight = 0;
int nRightBdr = 0;
int nLeftBdr = 0;
int nIntensityVal = 0;
RECT ClrBarRect;
HDC hMemDC;
float fTime[MAX_COLORS_ON_CLRMAP];
float fTimePerPixel = 0.0;
float fCurrentTime = 0.0;
float fMaxTime = 0.0;
float fMinTime = 0.0;
COLOR_t stColorThree;
if( !bBigMemDC_i )
{
ClrBarRect = m_ClrBarRect;
pnArnwidth = &nArray[0]/*m_arnWidth[0]*/;
pnArnHeight = &m_arnHeight[0];
hMemDC = m_hMemDC;
}
else
{
ClrBarRect = m_BigClrBarRect;
pnArnwidth = &m_arnBigWidth[0];
pnArnHeight = &m_arnBigHeight[0];
hMemDC = m_hBigMemDC;
}
// Calculate the right border of each color in color map acccording to color bar index.
nRightBdr = pnArnwidth[nColorBarIdx_i + 1];
if(( 0 < pnArnwidth[nColorBarIdx_i] ) && ( pnArnwidth[nColorBarIdx_i] < ClrBarRect.right ) &&
(( 0 > pnArnwidth[nColorBarIdx_i + 1] ) ||
( pnArnwidth[nColorBarIdx_i + 1] > ClrBarRect.right )))
{
nRightBdr = ClrBarRect.right;
}
// Calculate the left border of each color in color map according to color bar index.
// nLeftBdr = 0;
nLeftBdr = pnArnwidth[nColorBarIdx_i];
//If trying to paint an invalid region ,then no need for updation
if(( 0 > nRightBdr ) || ( nRightBdr > ClrBarRect.right ) ||
( 0 > nLeftBdr ) || ( nLeftBdr > ClrBarRect.right ))
{
return;
}
fMaxTime = m_pColorMapInfo->m_fMaxVal / COLOR_TIME_DIV;
fMinTime = m_pColorMapInfo->m_fMapVal[0] / COLOR_TIME_DIV;
for( int nColor = ARRAY_INDEX_ZERO; nColor < MAX_COLORS_ON_CLRMAP; ++nColor )
{
fTime[nColor] = static_cast<float>(( m_pColorMapInfo->m_fMapVal[nColor] ) / COLOR_TIME_DIV );
}
// Calculate the time value of each pixel.
fTimePerPixel = ( fMaxTime - fMinTime ) / static_cast<float>( COLOR_MAP_RIGHT );
fCurrentTime = fTime[nColorBarIdx_i];
nIntensityVal = m_pColorMapInfo->m_nClrIntensityVal[nColorBarIdx_i];
if( m_pColorMapInfo->m_bGradChecked )
{
nIntensityVal = MAX_INTENSITY_VAL;
}
for( int nPixel = nLeftBdr; nPixel < nRightBdr; nPixel++ )
{
RECT rect;
// Intensity value of pixel is less than the maximum intensity value.
if( MAX_INTENSITY_VAL > nIntensityVal )
{
rect.top = pnArnHeight[MAX_INTENSITY_VAL];
rect.bottom = pnArnHeight[m_pColorMapInfo->m_nClrIntensityVal[nColorBarIdx_i]];
rect.left = nLeftBdr;
rect.right = nRightBdr;
//if rect area not empty
if( 0 == IsRectEmpty( &rect ))
{
//Fill the rectangle
CRect rectFill( nPixel, rect.top, nPixel + 1, rect.bottom );
HBRUSH hBrush = CreateSolidBrush( m_pColorMapInfo->m_nChosenClr[nColorBarIdx_i] );
HBRUSH hbrushOld = static_cast<hbrush>( SelectObject( m_hMemDC, hBrush ));
// FillRect( m_hMemDC, &rectFill, hBrush );
SelectObject( m_hMemDC, hbrushOld );
BeginPath(m_hMemDC);
MoveToEx(m_hMemDC,50,50, (LPPOINT) NULL);
AngleArc(m_hMemDC, 50 , 50 , 47, nPixel, nPixel+1);
SetArcDirection(m_hMemDC, AD_CLOCKWISE);
LineTo(m_hMemDC,50,50);
EndPath(m_hMemDC);
StrokeAndFillPath(m_hMemDC);
DeleteObject( hBrush );
hBrush = NULL;
}
}
// Between [nColor-1] and [1]
int nColor = nColorBarIdx_i + 1;
// When the larger than max value
if( MAX_COLORS_ON_CLRMAP <= nColor )
{
for( int nIdx = nIntensityVal - 1; nId
Member 10536430
28-Mar-16 23:53pm
View
can you give me an example..? i doesnt need 8 individual buttons i just want to divide the button into 8 segments.
Show More