Solved

OpenGL+ScrollView+MFC

Posted on 2004-10-11
8
796 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 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
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!

 
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

Industry Leaders: 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: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

726 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