游戏开发论坛

 找回密码
 立即注册
搜索
查看: 2778|回复: 3

如何实现屏幕镜像

[复制链接]

52

主题

155

帖子

160

积分

注册会员

Rank: 2

积分
160
发表于 2006-12-29 14:51:00 | 显示全部楼层 |阅读模式
是否先用glReadPixels ,再翻转 x=width-x; y=y; 再glDrawPixels ?

52

主题

155

帖子

160

积分

注册会员

Rank: 2

积分
160
 楼主| 发表于 2006-12-29 16:00:00 | 显示全部楼层

Re: 如何实现屏幕镜像

知道了,很简单。

        GLfloat mirrorMats[16]={
                -1,0,0,0,
                0,1,0,0,
                0,0,1,0,
                0,0,0,1,
       
        };

        glMultMatrixf(mirrorMats);

32

主题

1259

帖子

1351

积分

金牌会员

Rank: 6Rank: 6

积分
1351
发表于 2007-1-2 20:23:00 | 显示全部楼层

Re:如何实现屏幕镜像

gluLookAt 最后三个参数整下啊.

8

主题

716

帖子

716

积分

高级会员

Rank: 4

积分
716
发表于 2007-1-4 13:44:00 | 显示全部楼层

Re:如何实现屏幕镜像

D3DXMatrixReflect
Builds a matrix that reflects the coordinate system about a plane.

D3DXMATRIX * D3DXMatrixReflect(
  D3DXMATRIX * pOut,
  CONST D3DXPLANE * pPlane
);
Parameters
pOut
[in, out] Pointer to the D3DXMATRIX structure that is the result of the operation.
pPlane
[in] Pointer to the source D3DXPLANE structure.
Return Values
Pointer to a D3DXMATRIX structure that reflects the coordinate system about the source plane.

Remarks
This function normalizes the plane equation before it creates the reflected matrix.

The return value for this function is the same value returned in the pOut parameter. In this way, the D3DXMatrixReflect function can be used as a parameter for another function.

This function uses the following formula to compute the returned matrix.

P = normalize(Plane);
   
-2 * P.a * P.a + 1  -2 * P.b * P.a      -2 * P.c * P.a        0
-2 * P.a * P.b      -2 * P.b * P.b + 1  -2 * P.c * P.b        0
-2 * P.a * P.c      -2 * P.b * P.c      -2 * P.c * P.c + 1    0
-2 * P.a * P.d      -2 * P.b * P.d      -2 * P.c * P.d        l

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2026-1-26 04:34

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表