橡皮筋缩放功能 [英] Rubber band Zooming functionality

查看:70
本文介绍了橡皮筋缩放功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我是Venkat Kumar,我是OpenGL的新人。我必须实现雷达显示设计系统,我必须实现缩放功能。如何在OpenGL下显示橡皮筋矩形

?例如当用户尝试定义要缩放的区域时,大多数RDD系统会动态显示一个虚线矩形,表示当用户拖动鼠标指针时该区域。

解决方案

有很多方法可以在图形系统中实现缩放功能。

假设你的最终显示是在纹理中并显示在屏幕上。对于unzoomed显示,通常使用纹理坐标创建的顶点缓冲区如下,映射整个纹理(X坐标从0到1,Y坐标从0到1)



  //  格式x,y,z,TU,电视 
GLFloat fVertexBuffer []
{ - 1 .0f, 1 .0f, 0 .0f, 0 .0f, 1 .0f, // 左上角
- 1 .0f,- 1 .0f, 0 .0f, 0 .0f, 0 .0f), // 左下角
1 .0f, - 1 .0f, 0 .0f, 1 .0f, 0 .0f, // 右下角
1 .0f , 1 .0f, 0 .0f, 1 .0f, 1 .0f // 右上角
};





要获得最终纹理的缩放图像,可以映射小区域的纹理到屏幕。



 //格式x,y,z,TU,TV 
GLFloat fVertexBufferZoom []
{-1.0f,1.0f,0.0f,0.25f,0.75f,//左上角
-1.0f,-1.0f,0.0f,0.25f,0.25f),//左下角
1.0f,-1.0f,0.0f,0.75f,0.25f,//右下角
1.0f,1.0f,0.0f,0.75f,0.75f //右上角
};



另一个建议是根据缩放区域更改投影。如果使用正交投影,则可以根据矩形选择的缩放区域更改投影区域。



有关纹理贴图和投影的更多详细信息,请参阅任何opengl或图形参考文档。



这是一个OpenGL导师,可以用来更多地了解opengl投影和纹理映射概念。

http:// user .xmission.com /〜内特/ tutors.html


Hi everybody,
I am Venkat Kumar,I am a new comer to OpenGL. I have to implement a Radar display design system I have to implement a zoom function. How can a display a rubber-band rectangle
under OpenGL? e.g. when an user try to define the region to zoom to,most RDD system will dynamically display a dotted rectangle to indicate
the region as the user drag the mouse pointer.

解决方案

There are many ways to implement zoom functionalty in a graphic system.
Suppose your final display is in a texture and that is displayed to the screen. For unzoomed display, usually vertex buffer created with texture coordinate as follows, maps entire texture(X coordinate from 0 to 1 and Y coordinate from 0 to 1)

// Format x,y,z, TU, TV
GLFloat fVertexBuffer[]
{ -1.0f,1.0f, 0.0f,    0.0f, 1.0f, // Left Top  corner
 -1.0f,-1.0f, 0.0f,   0.0f, 0.0f), // Left Bottom
 1.0f , -1.0f, 0.0f,  1.0f, 0.0f, // Right bottom
 1.0f, 1.0f,  0.0f,   1.0f, 1.0f // Right top
};



To get a zoomed image of the final texture, you can map small area of the texture to screen.

// Format x,y,z, TU, TV
GLFloat fVertexBufferZoom[]
{ -1.0f,1.0f, 0.0f,    0.25f, 0.75f, // Left Top  corner
 -1.0f,-1.0f, 0.0f,   0.25f, 0.25f), // Left Bottom
 1.0f , -1.0f, 0.0f,  0.75f, 0.25f, // Right bottom
 1.0f, 1.0f,  0.0f,   0.75f, 0.75f // Right top
};


Another suggestion is to change the projection based on your zoom area. If you are using orthographic projection, you can simply change the projection area based on the zoom area selected by the rectangle.

For more details on texture mapping and projection, refer any opengl or graphics reference documents.

Here is a OpenGL tutor, can be used to get more idea about opengl projection and texture mapping conceps.
http://user.xmission.com/~nate/tutors.html


这篇关于橡皮筋缩放功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆