如何使用OpenGl在C ++中删除行 [英] how to delete lines in c++ using OpenGl

查看:106
本文介绍了如何使用OpenGl在C ++中删除行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我构建了一个游戏,其中有一个球在窗口中飞翔,当击中线条时,线条会消失,依此类推..我该怎么做?

i build a game that a ball fly in window and when hit the lines , the lines will Disappear and so on .. how i can do this ??

推荐答案

当绘图线使用alpha值指定其颜色时
While drawing lines specify it''s color with alpha value
glColor4f(R,B,G,A)


"A"表示Alpha值并定​​义透明度,如果等于1,则表示不透明,如果等于0,则表示透明.
通过更改线条的alpha值,可以解决您的问题.
碰撞后,使alpha值等于0,那么它将是透明的,并且看起来像消失了.


"A" means alpha value and define the transparency ,if it is equal to 1 then complete Opaque and if 0 then complete transparent.
By changing the alpha value of lines,your problem will be solve.
After collision make alpha value equal to 0 then it will be transparent and seems like disappear.


这篇关于如何使用OpenGl在C ++中删除行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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