Solved

OpenGL+ScrollView+MFC

Posted on 2004-10-11
8
776 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
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Add content to output file 4 58
deburging in oracle form 12 76
maven archtype selection in eclipse 1 51
MaxSpan challenge 9 67
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…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now