?
Solved

OpenGL+ScrollView+MFC

Posted on 2004-10-11
8
Medium Priority
?
813 Views
Last Modified: 2013-11-20
I want to implement scrollbars for openGl scene

That what I’m doing:
IMPLEMENT_DYNCREATE(COglView, CScrollView)

void COglView::OnInitialUpdate()
{
CScrollView::OnInitialUpdate();
CSize sizeTotal;
CRect clientRec;
GetClientRect(clientRec);
sizeTotal = GetTotalSize();
sizeTotal.cx = (clientRec.Width())*m_GLManager.GetScaleFactor();
sizeTotal.cy = (clientRec.Height())*m_GLManager.GetScaleFactor();

SetScrollSizes(MM_TEXT, sizeTotal);
}

OnZoomin function:
m_scalefactor += 0.1;

OnDrawScene function
glScalef(m_scalefactor,m_scalefactor,m_scalefactor);

to “scroll” the scene I’m using glTranslatef(m_TranslateX,m_TranslateY,m_TranslateZ);

Now my question how to find the relationship between position of the scroll bar and how I should increase/decrease
m_TranslateX and m_TranslateY parameters ???

Please help me, it’s really urgent .
Thank you.
P.S
some example could be very help
0
Comment
Question by:vadim85
6 Comments
 
LVL 6

Expert Comment

by:Amritpal Singh
ID: 12284744
plz have a look at the following article

http://www.codeproject.com/opengl/opengl_zooming.asp
0
 

Author Comment

by:vadim85
ID: 12289801
Thank you for your answer , but how this article helps me with the scrollview??


Thank you.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12329453
OpenGL mantains its own "double buffer" that doesn't interact with MFC windows, including scrolling behaviour. If you want to scroll an openGL window, you have to "trap" the scrolling events and scroll the opengl view by yourself using the glTranslate function.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12560324
I think my answer is correct, there is not relation between scrollview (or any other MFC windows) and OpenGL, usual technique is to "synchronize by hand" trapping WM_SCROLL events and performing scroll with glTranslate().
0
 

Author Comment

by:vadim85
ID: 12566122
Hi jaime_olivares,
I know that I nee to "synchronize by hand”, and that exactly what I tried to do, but my question was how to find on how many units I need to Translate my OpenglView when I clicked on the scroll bar.
Do you have any example to demonstrate the technique??

Thank you
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12867808
PAQed with points refunded (250)

modulo
Community Support Moderator
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month14 days, 11 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question