?
Solved

OpenGL+ScrollView+MFC

Posted on 2004-10-11
8
Medium Priority
?
801 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

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: 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.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

762 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