游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1994|回复: 4

openGL的显卡差异?

[复制链接]

6

主题

22

帖子

28

积分

注册会员

Rank: 2

积分
28
发表于 2006-1-10 14:57:00 | 显示全部楼层 |阅读模式
我的显卡是intel 82865
绘制一条直线
                glColor3f(1.0f,1.0f,0.0f);
        glBegin(GL_LINES);               
        glVertex2d( 10,10);               
        glVertex2d( 100,10);
        glEnd();
再绘制三角形
                glColor3f(1.0f,0.0f,1.0f);
        glBegin(GL_TRIANGLE_STRIP);
        glVertex3f(10, 10, 0.0f);
        glVertex3f( 100, 10, 0.0f);
        glVertex3f( 100, 100, 0.0f);
        glEnd();
三角形应该是覆盖了直线的,可在我得显卡上看到的效果是直线在三角形的旁边
在其他显卡上或者在我的机器上用dx3d画同样的效果,都是直线被三角形覆盖的
是不是什么环境变量没有设置正确? 还是其他原因

请高手指点一下,谢谢

6

主题

22

帖子

28

积分

注册会员

Rank: 2

积分
28
 楼主| 发表于 2006-1-10 15:31:00 | 显示全部楼层

Re: openGL的显卡差异?

我用的是正交变换glOrtho2D
只做平面效果

同样的代码在sis 651的显卡上就没有偏移

6

主题

22

帖子

28

积分

注册会员

Rank: 2

积分
28
 楼主| 发表于 2006-1-10 16:49:00 | 显示全部楼层

Re: openGL的显卡差异?

intel 82865下
sf_2006110164849.bmp

6

主题

22

帖子

28

积分

注册会员

Rank: 2

积分
28
 楼主| 发表于 2006-1-10 17:35:00 | 显示全部楼层

Re: openGL的显卡差异?

搞定了,有同样问题的也可以看一下
OpenGL FAQ 14.120
14.120 If I draw a quad in fill mode and again in line mode, why don't the lines hit the same pixels as the filled quad?

Filled primitives and line primitives follow different rules for rasterization.

When a filled primitive is rendered, a pixel is only touched if its exact center falls within the primitive's mathematical boundary.

When a line primitive is rasterized, ideally a pixel is only touched if the line exits a diamond inscribed in the pixel's boundary.

From these rules, it should be clear that a line loop specified with the same vertices as those used for a filled primitive, can rasterize pixels that the filled primitive doesn't.

(The OpenGL specification allows for some deviation from the diamond exit line rasterization rule, but it makes no difference in this scenario.)

180

主题

3511

帖子

3520

积分

论坛元老

Rank: 8Rank: 8

积分
3520
发表于 2006-1-11 13:33:00 | 显示全部楼层

Re:openGL的显卡差异?

楼主,
glColor3f(1.0f,1.0f,0.0f);
glBegin(GL_LINES);
glVertex2d( 10,10);
glVertex2d( 100,10);//----应该是“横着的直线”
glEnd();

图片怎么是“竖着的直线”呢?

图片与上面的程序不是同一个啊?
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2026-1-23 05:17

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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