Click here to Skip to main content
15,881,852 members
Articles / Multimedia / OpenGL
Tip/Trick

OpenGL 3D graphics in MATLAB

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
7 Oct 2013CPOL 17.4K   520   1   1
In this article we use OpenGL interface for 3D scientific visualization.

Introduction

In this article we use OpenGL interface for 3D scientific visualization. OpenGL was developed by Silicon Graphics and was released in 1992. OpenGL is a cross-language programming interface (API) for rendering 2D and 3D computer graphics. OpenGL is faster and comfortable than virtual reality toolbox. You can make many points in OpenGL with a sphere and you can change these points faster than the virtual reality toolbox.

Using the code

It is very easy to use this project. In MATLAB you must define points of your object and you must define the adjacency matrix of your mesh. For example suppose that we want to create a spring, first we must define the Points:

C++
N=2000;
X_points=zeros(N,1);
Y_points=zeros(N,1);
Z_points=zeros(N,1);
Adj=zeros(N,N);
for i=1:N
        X_points(i)=cos(2*pi*5*i/N);
        Y_points(i)=sin(2*pi*5*i/N);
        Z_points(i)=(5*i/N-2)/4;
    if i<N
        Adj(i,i+1)=1;
    end
end
Showobject(X_points,Y_points,Z_points,Adj);

After you create your object you can zoom in and zoom out with right and left click on your object.

Points of Interest

You can use this for the finite element method (FEM). FEM is the mathematical approximation method for solving a partially differential equation (PDE).

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Iran (Islamic Republic of) Iran (Islamic Republic of)
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
Questionwhere is the source code for the dll ? Pin
projectmember7-Apr-15 21:55
projectmember7-Apr-15 21:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.