android glscissor使用实例,glViewport different result in Android and iOS

博主在开发跨平台框架的OpenGL ES渲染器时遇到了视口问题,发现iOS和Android在处理视口和裁剪上存在差异。Android设备上出现图形错误,而iOS显示正常。已尝试应用平移变换,但问题依然存在。初始化代码包括启用纹理、深度测试等,并设置了透视校正。博主在寻找可能的默认设置差异或解决方案。
摘要由CSDN通过智能技术生成

I just got started on a renderer for my cross platform framework (iOS and Android) using opengl es. When I got to the viewport stuff (which is needed for splitscreen stuff) and noticed there is a difference between iOS and Android. Here are two images.

Android

There is actually another glitch. IT seems to wrap.

uXt4K.png

iOS

f50f68a83e103c868d790f611999dfa7.png

My question.

Which of the two is correct? I have no transformations applied but one to bring the drawn quad back a bit. glTranslatef(0.0f, 0.0f, -5.f);

Initialisation code:

glEnable(GL_TEXTURE_2D);

glShadeModel(GL_SMOOTH); //Enable Smooth Shading

glClearColor(0.f, 0.f, 0.f, 1.0f); //Black Background

glClearDepthf(1.0f); //Depth Buffer Setup

glEnable(GL_DEPTH_TEST); //Enables Depth Testing

glDepthFunc(GL_LEQUAL); //The Type Of Depth Testing To Do

//Really Nice Perspective Calculations

glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);

Viewport and project code

glViewport(viewportX, viewportY, viewportW, viewportH);.

glEnable(GL_SCISSOR_TEST);

glScissor(viewportX, viewportY, viewportW, viewportH);

glMatrixMode(GL_PROJECTION);

glLoadIdentity();

... And finally the frustrum is calculated and set glFrustrum.

I have also used this code:

float widthH = width * .1f;

float heightH = height * .1f;

glOrthof(-widthH, widthH, -heightH, heightH, .1f, 100.f);

glScalef(widthH, heightH, 1.f);

Maybe Android or iOS has something set by default? I am clueless.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值