编码的 3D 游戏
3D 培训
我写的 3D 游戏培训编程
glUseProgram(m_programSkyBox.Program);
glGenBuffers(1, &skyBoxVertexBuffer);
glBindBuffer(GL_ARRAY_BUFFER, skyBoxVertexBuffer);
float vertices[24] = {
-1.0, -1.0, 1.0,
1.0, -1.0, 1.0,
-1.0, 1.0, 1.0,
1.0, 1.0, 1.0,
-1.0, -1.0, -1.0,
1.0, -1.0, -1.0,
-1.0, 1.0, -1.0,
1.0, 1.0, -1.0,
};
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
glGenBuffers(1, &skyBoxIndexBuffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, skyBoxIndexBuffer);
GLubyte indices[14] = {0, 1, 2, 3, 7, 1, 5, 4, 7, 6, 2, 4, 0, 1};
绘图 skybox:
glClearColor(0.5f, 0.5f, 0.5f, 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glUseProgram(m_programSkyBox.Program);
glDisable(GL_DEPTH_TEST); // skybox should be drawn behind anything else
glBindTexture(GL_TEXTURE_CUBE_MAP, m_textures.Cubemap);
glBin
- 2022-07-02 11:39:51下载
- 积分:1
自己开发的Android 直接发送短信方法附上代码
这是一个自己开发的Android 直接发送短信方法附上代码,Android 发短信功能,包括了对内容合法性的验证,发送完成弹出提示。自己开发的直接发送短信的方法:
private void sendSMS(String telNo,String smsStr,View v){
PendingIntent pi=
PendingIntent.getActivity(this, 0, new Intent(this,Sample_11_1.class), 0);
SmsManager sms=SmsManager.getDefault();
sms.sendTextMessage(telNo, null, smsStr, pi, null);
//短信发送成功给予提示
Toast.makeText(
Sample_11_1.this, //上下文
"恭喜你,短信发送成功!", //提示内容
5000 //信息显示时间
).show();
v.setEnabled(true);//短信发送完成后恢复发送按钮的可用状态
}
对手机号码和短信内容的验证部分:
//获取输入的电话号码
EditText etTel=(EditText)findViewById(R.id.EditText02);
String telStr=etTel.getText().toString();
//获取输入的短信内容
EditText etSms=(EditText)findViewById(R.id.EditText01);
String smsStr=etSms.getText().toString();
//判断号码字符串是否合法
if(PhoneNumberUtils.isGlobalPhoneNumber(telStr)){//合法则发送短信
v.setEnabled(false);//短信发送完成前将发送按钮设置为不可用
sendSMS(telStr,smsStr,v);
}
else{//不合法则提示
Toast.makeText(
Sample_11_1.this, //上下文
"电话号码不符合格式!!!
- 2022-08-23 23:05:12下载
- 积分:1