[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

OpenGL+ScrollView+MFC

Posted on 2004-10-11
8
Medium Priority
?
809 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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…
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.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

650 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