Click here to Skip to main content
15,894,405 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Simple C to C++ Pin
Richard MacCutchan14-Sep-11 22:14
mveRichard MacCutchan14-Sep-11 22:14 
GeneralRe: Simple C to C++ Pin
Orjan Westin15-Sep-11 1:38
professionalOrjan Westin15-Sep-11 1:38 
GeneralRe: Simple C to C++ Pin
Richard MacCutchan15-Sep-11 1:43
mveRichard MacCutchan15-Sep-11 1:43 
AnswerRe: Simple C to C++ Pin
Orjan Westin15-Sep-11 1:32
professionalOrjan Westin15-Sep-11 1:32 
AnswerRe: Simple C to C++ Pin
Stefan_Lang15-Sep-11 1:43
Stefan_Lang15-Sep-11 1:43 
GeneralRe: Simple C to C++ Pin
Richard MacCutchan15-Sep-11 1:47
mveRichard MacCutchan15-Sep-11 1:47 
JokeRe: Simple C to C++ Pin
MicroVirus15-Sep-11 3:36
MicroVirus15-Sep-11 3:36 
QuestionMFC OpenGL Invalidate Flickering Pin
appollosputnik14-Sep-11 6:19
appollosputnik14-Sep-11 6:19 
Dear Friends
I am wirting an application for drawing a rectangle on the screen using opengl and mfc. So I implemented the OnPaint function, OnDraw function is also giving the same problem. It's drawing fine. I want to implement pan, zoom, and rotate functionalities. Now everytime the mouse moves I am calling Invalidate() or otherwise I can call Invalidate() in the ::OnDraw function. Pan, zoom and rotate everything is happening but its heavily flickering. I have serached a lot and tried all means like return 1 in the OnEraseBackground() functio for WM_ERASEBACKGROUND etc. But I am getting still flickering . Please help getting rid of this problem. Check the code snippet below.



void CRevolutionProjView::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
CRect RectAff;
GetClientRect(RectAff);
glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f ) ;
glClear ( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ) ;
glPushMatrix( ) ;
glTranslatef(trans[0], trans[1], trans[2]);
glRotatef(rot[0], 1.0f, 0.0f, 0.0f);
glRotatef(rot[1], 0.0f, 1.0f, 0.0f);
drawcube();
glPopMatrix( ) ;
glFinish( ) ;
glFlush();
SwapBuffers(hDC);
Invalidate(false);
// Do not call CView::OnPaint() for painting messages
}

void CRevolutionProjView::OnMouseMove(UINT nFlags, CPoint point)
{
newP = point;
// TODO: Add your message handler code here and/or call default
int dx = oldP.x - newP.x;
int dy = newP.y - oldP.y;
switch(STATE)
{
case PAN:
{
trans[0] -= dx/100.0f;
trans[1] -= dy/100.0f;
// Invalidate();
}
break;
case ZOOM:
{
trans[2] -= (dx+dy) / 100.0f;
// Invalidate();
}
break;
case ROTATE:
{
rot[0] += (dy * 180.0f) / 500.0f;
rot[1] -= (dx * 180.0f) / 500.0f;
#define clamp(x) x = x > 360.0f ? x-360.0f : x < -360.0f ? x+=360.0f : x
clamp(rot[0]);
clamp(rot[1]);
// Invalidate();

}
break;
}

oldP = newP;

CView::OnMouseMove(nFlags, point);
}
AnswerRe: Flicker Free Drawing In MFC Pin
Software_Developer14-Sep-11 7:32
Software_Developer14-Sep-11 7:32 
AnswerRe: MFC OpenGL Invalidate Flickering Pin
Roger Allen27-Sep-11 6:23
Roger Allen27-Sep-11 6:23 
QuestionShowHTMLDialog not working in Windows 7 Pin
doug2514-Sep-11 4:00
doug2514-Sep-11 4:00 
AnswerRe: ShowHTMLDialog not working in Windows 7 Pin
Chris Meech14-Sep-11 6:07
Chris Meech14-Sep-11 6:07 
GeneralRe: ShowHTMLDialog not working in Windows 7 Pin
doug2514-Sep-11 7:39
doug2514-Sep-11 7:39 
GeneralRe: ShowHTMLDialog not working in Windows 7 Pin
Chris Meech14-Sep-11 8:27
Chris Meech14-Sep-11 8:27 
GeneralRe: ShowHTMLDialog not working in Windows 7 Pin
doug2514-Sep-11 8:59
doug2514-Sep-11 8:59 
Questionindex of member of a map? Pin
zon_cpp14-Sep-11 3:16
zon_cpp14-Sep-11 3:16 
AnswerRe: index of member of a map? Pin
«_Superman_»14-Sep-11 3:31
professional«_Superman_»14-Sep-11 3:31 
AnswerRe: index of member of a map? Pin
Chris Losinger14-Sep-11 3:37
professionalChris Losinger14-Sep-11 3:37 
QuestionWaitForSingleObject Pin
john563213-Sep-11 23:41
john563213-Sep-11 23:41 
AnswerRe: WaitForSingleObject Pin
CPallini14-Sep-11 0:12
mveCPallini14-Sep-11 0:12 
GeneralRe: WaitForSingleObject Pin
john563214-Sep-11 0:25
john563214-Sep-11 0:25 
GeneralRe: WaitForSingleObject Pin
CPallini14-Sep-11 0:39
mveCPallini14-Sep-11 0:39 
GeneralRe: WaitForSingleObject Pin
Albert Holguin16-Sep-11 4:10
professionalAlbert Holguin16-Sep-11 4:10 
QuestionCHKBOOK sample Pin
_Flaviu13-Sep-11 21:12
_Flaviu13-Sep-11 21:12 
AnswerRe: CHKBOOK sample Pin
Richard MacCutchan13-Sep-11 21:29
mveRichard MacCutchan13-Sep-11 21:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.