opengl 读取obj模型

本文详细介绍了如何使用OpenGL解析和加载.obj模型文件,包括顶点、纹理坐标和法线数据的处理,以及如何将这些数据上传到GPU进行渲染。
摘要由CSDN通过智能技术生成

```cpp
在这里插入代码片
// #include <glut.h>
#include <iostream>
#include <math.h>
#include <string>
#include <stdio.h>
#include <sstream>
#include <fstream>
#include <windows.h>
using namespace std;

int v_num = 0;  //��¼�������
int f_num = 0;  //��¼�������
int vn_num = 0; //��¼���������
int vt_num = 0; //��¼�������������

GLfloat **vArr;  //��ŵ�Ķ�ά����
GLfloat **vnArr; //��ŷ���Ķ�ά����
GLfloat **vtArr; //�����������Ķ�ά����

int **fvArr; //����涥��Ķ�ά����
int **fnArr; //����淨��Ķ�ά����
int **ftArr; //�������������Ķ�ά����

GLfloat angle_galaxy = 0.0f; //��ϵ��ת���ٶ�
GLfloat galaxy_r = 0.5;
GLfloat galaxy_g = 0.0;
GLfloat galaxy_b = 0.0;
GLfloat emission_galaxy[3];

GLfloat blank_Emission[4] = {0.0f, 0.0f, 0.0f, 0.0f};
void destoryObj()
{
    v_num = 0;  //��¼�������
    f_num = 0;  //��¼�������
    vn_num = 0; //��¼���������
    vt_num = 0; //��¼�������������

    vArr = NULL;
    vnArr = NULL;
    vtArr = NULL;
    fvArr = NULL;
    fnArr = NULL;
    ft
解释这段代码: module signal_source( input clk_in, // input clk_en, // output reg [9:0] data_sawtooth0_i, // output reg [9:0] data_sawtooth0_q, output reg [9:0] data_sawtooth1_i, // output reg [9:0] data_sawtooth1_q, output reg [9:0] data_sin_i, // output reg [9:0] data_cos_q ); ///////////////////////////////////////// // �������Dz� //////////////////////////////////////////// always @(posedge clk_in )begin if(clk_en==1) begin //30p72m data_sawtooth0_i <= data_sawtooth0_i + 8; data_sawtooth0_q <= data_sawtooth0_q + 8; end end // �������Dz�1 always @(posedge clk_in )begin if(clk_en==1) begin //30p72m data_sawtooth1_i <= data_sawtooth1_i + 8; data_sawtooth1_q <= data_sawtooth1_q - 8; end end ////////////////////////////////////////////////// //�������Ҳ������з������� /////////////////////////////////////////////////////// //sin_cos_data_out reg [5:0]data_sin_count; always @(posedge clk_in )begin if(clk_en) begin //30p72m tx_clken clk_div4_en data_sin_count <= data_sin_count + 1'b1; case (data_sin_count) 6'd0 : begin data_sin_i <= 10'd0; data_cos_q <= 10'd524; end 6'd1 : begin data_sin_i <= 10'd49; data_cos_q <= 10'd527; end 6'd2 : begin data_sin_i <= 10'd97; data_cos_q <= 10'd534; end 6'd3 : begin data_sin_i <= 10'd145; data_cos_q <= 10'd546; end 6'd4 : begin data_sin_i <= 10'd191; data_cos_q <= 10'd562; end 6'd5 : begin data_sin_i <= 10'd235; data_cos_q <= 10'd583; end 6'd6 : begin data_sin_i <= 10'd277; data_cos_q <= 10'd609; end
05-30
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值