【openGL】画正弦函数图像】的更多相关文章

#include "stdafx.h" #include <GL/glut.h> #include <stdlib.h> #include <math.h> #include <stdio.h> const GLfloat factor = 0.1f; void myDisplay(void) { GLfloat x; glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_LINES); glVertex2f(…
OpenGL 画出雷达动态扫描效果(一)中给出了已一张图片作为底图的雷达扫面程序 如果有漂亮的雷达底图的话,效果应该非常不错的,另外也可以直接手绘雷达框架 效果如下 雷达主体代码 glLineWidth(2.0); glColor4f(0.0f, 1.0f, 0.0f,1.0f); DrawCircle(); DrawCircle(0.4); glBegin(GL_LINES); glVertex2f(-,),glVertex2f(,); glVertex2f(,-),glVertex2f(,)…
『Catlike系列教程』第二篇来了~今天周六,早上(上午11点)醒来去超市买了一周的零食回来以后就玩了一整天游戏非常有负罪感.现在晚上九点天还亮着感觉像下午7点左右的样子好像还不是很晚...所以就写一点东西吧.这一篇是「Building a Graph」挑战一下试试吧. PART 1 概述 那么大概文章看下来我们预计要做以下事情. 使用一定数量的小方块表达函数图像 做一个 Shader 给图像上色使其更好看 给图像传入时间参数使其动起来 PART 2 画函数图像 首先我们确认一下要支持的功能细…
Delphi实例之绘制正弦函数图像 unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) Image1: TImage; Button1: TButton; Label1: TLabel; Label2: TLabel; Label3:…
原文作者:aircraft 原文链接:https://www.cnblogs.com/DOMLX/p/12054507.html 好多次都是画坐标轴的三条直线画不出来,虽然最后都解决了  但是还是耽误了我超级多时间  因为根本无法调试啊 就一个黑框框  其他图形又能画的出来 看到这种现象 真的是脑袋都要炸了好吧!!! 第一次没有画出来坐标轴直线是在c#的winform界面画坐标轴 我的画图代码大概是这样  先画了obj模型图像  然后 在画坐标轴直线   无论我怎么画都是画不出来 我脑袋都要炸了…
1. cv2.cvtcolor(img, cv2.COLOR_BGR2GRAY) # 将彩色图转换为灰度图 参数说明: img表示输入的图片, cv2.COLOR_BGR2GRAY表示颜色的变换形式 2. cv2.findContours(img,mode, method)  # 找出图中的轮廓值,得到的轮廓值都是嵌套格式的 参数说明:img表示输入的图片,mode表示轮廓检索模式,通常都使用RETR_TREE找出所有的轮廓值,method表示轮廓逼近方法,使用NONE表示所有轮廓都显示 3.…
1.画矩形 这个费了我半天劲,不知怎么就可以了. 复制来自:https://www.cnblogs.com/ymjyqsx/p/7390288.html import  matplotlib.pyplot  as plt fig = plt.figure()ax = fig.add_subplot(111)   #创建子图 rect = plt.Rectangle((0.1,0.2),0.4,0.3, color="red")    # (0.1,0.2)为左下角的坐标,0.4,0.3…
python三维图像输出的代码如下所示:#画3D函数图像输出from mpl_toolkits.mplot3d import Axes3Dfrom matplotlib import cmimport matplotlib.pyplot as pltimport numpy as npimport mpl_toolkits.mplot3dfigure=plt.figure()#ax = Axes3D(figure)ax=figure.gca(projection="3d")x1=np.…
利用Graphics类画任意显式函数图像,只需修改代码中的F()函数即可,另外调整timesx和timesy参数来分方向放大或缩小图像.需要重定义坐标系. package test; import javax.swing.*; import java.awt.Graphics; public class DrawFunction extends JFrame { static double timesx = 10, timesy = 10; double F(double x) { return…
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>函数图像绘制工具</title> <script type="text/javascript" src="js/funcImg.js"></script> <style> #div-img { /* 此决定画布的宽高 */…
❤ 关于几种显示工具 mricro:显示出来的左右脑是反着的: mricroN,SPM,xjview,BrainNetViewer:显示出的左右脑是正确的,并且对于做过仿射变换的图像可以自动识别并且校正显示为正确的左右脑. ❤ NIFTI mapping commands ① load_untouch_nii 以及 save_untouch_nii必须成对使用: ② load_nii 以及 save_nii 必须成对使用: ③ 若使用make_nii,则后续应当用 save_nii 保存图像.…
通过这个例子可以更加深刻的了解割圆术的原理,明白如何的化曲为直,且看代码: #include <windows.h> //#include <GLUT/glut.h> #include <GL/glut.h> #include <stdlib.h> #include <stdio.h> #include <math.h> const int n=10; const GLfloat R=0.5f; const GLfloat Pi=3.…
绘制一副3D图像 draw3D(X,Y,Z, angle) import numpy as np from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D #X,Y,Z are np.array #angle is a tuple, stands for the initial view angle of 3D figure def draw3D(X,Y,Z, angle): fig = plt.fi…
最终效果如下所示 Demo下载  http://files.cnblogs.com/xd-jinjian/Debug.zip 源代码下载 http://download.csdn.net/detail/xdjinjian/8266927 绘制扫面线部分代码如下,扫面部分可改进使用粒子系统,以增加真实感. glBegin(GL_TRIANGLE_FAN); glColor4f(0.0f, 0.0f, 0.0f,1.0f); glVertex2f(0.0f, 0.0f); ;i<N;++i) { p…
为了能以任意点为圆心画圆,我们可以把圆心先设为视点(相当于于将其平移到坐标原点),然后通过中点法扫描转换后,再恢复原来的视点(相当于将圆心平移回原来的位置). 圆心位于原点的圆有四条对称轴x=0,y=0,x=y和x=-y,从而圆上一点(x,y),可得到其关于四条对称轴的七个对称点,这称为八对称性,下面的函数就用来显示(x,y)及其七个对称点. void CirclePoints(int x,int y,long color,CDC *pDC) { //第1象限 pDC->SetPixel(x,y…
导入必要的库 import math import matplotlib.pyplot as plt import numpy as np import matplotlib as mpl mpl.rcParams['axes.unicode_minus'] = False 绘制softmax函数图像 fig = plt.figure(figsize=(6,4)) ax = fig.add_subplot(111) x = np.linspace(-10,10) y = sigmoid(x) a…
. 两点之间的连线称之为线段,在屏幕上显示线段放在现在已经不是稀奇的事情,大多数高级图形API都可以轻松实现,我尝试用OpenGL画线,在这里记录一下收获. . OpenGL这个级别的图形API,通常会提供一些绘制基本图形的接口,这些基本图形称之为图元,而OpenGL提供了点,线段,三角形三种图元绘制接口,说出来你可能不信,OpenGL就只能绘制这三种图形,本篇博文的主题是画线,OpenGL能直接绘制的图元之一. 用OpenGL绘制线段图元 给出两点的坐标,调用API即可直接画出线段. // 伪…
import matplotlib.pyplot as plt import numpy as np x = np.linspace(0, 1, 50) # 从0到1,等分50分 y = 210*(x**6)*((1-x)**4) # 这里是函数的表达式 plt.figure() # 定义一个图像窗口 plt.plot(x, y) # 绘制曲线 y plt.show()…
在循环语句中画出多个subplot图像代码如下 http://jonathansoma.com/lede/data-studio/classes/small-multiples/long-explanation-of-using-plt-subplots-to-create-small-multiples/ https://www.howtobuildsoftware.com/index.php/how-do/mww/python-loops-matplotlib-subplot-subplot…
今天我们先简单介绍Windows中常用的BMP文件格式,然后讲OpenGL的像素操作.虽然看起来内容可能有点多,但实际只有少量几个知识点,如果读者对诸如”显示BMP图象”等内容比较感兴趣的话,可能不知不觉就看完了. 像素操作可以很复杂,这里仅涉及了简单的部分,让大家对OpenGL像素操作有初步的印象. 学过多媒体技术的朋友可能知道,计算机保存图象的方法通常有两种:一是”矢量图”,一是”像素图”.矢量图保存了图象中每一几何物体的位置.形状.大小等信息,在显示图象时,根据这些信息计算得到完整的图象.…
高斯函数代码 const float CFFTOceanShader::_getGaussianRandomFloat() const { float u1 = rand() / (float)RAND_MAX; float u2 = rand() / (float)RAND_MAX; if (u1 < 1e-6f) u1 = 1e-6f; return sqrtf(-2.0f * logf(u1)) * cosf(2.0f * D3DX_PI * u2); }…
package com.zzw.TestSurfaceView; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Path; import android.util.AttributeSet; import android.util.Display…
#include<graphics.h>#include<math.h>int main(){    int gmode,gdriver=DETECT; double x1,y1,x2,y2;    initgraph(&gdriver,&gmode,"");    cleardevice(); setbkcolor(WHITE); setcolor(BLACK);    line(0,240,600,240);    line(570,220,…
#include <cmath> #include "glut.h" #include "iostream" using namespace std; void init(void) { glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glClear(GL_COLOR_BUFFER_BIT); cout << "init.." << endl; glLineWidth(1.0f);…
import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np fig = plt.figure() ax = Axes3D(fig) X = np.arange(-4, 4, 0.25) Y = np.arange(-4, 4, 0.25) X, Y = np.meshgrid(X, Y) R = np.sqrt(X**2 + Y**2) Z = np.sin(R) ax.pl…
近期由于兴趣所向.開始学习OpenGL绘图. 本文以"画球体"为点,小结一下近期所学. > 初识OpenGL ES 接触OpenGL是从Android開始的.众所周知,Android View 是线程不安全的,于是仅仅同意在主线程中对View进行操作.然而假如我们须要实现复杂的界面.特别是开发游戏,在主线程中画大量图像,会耗费比較长的时间.使得主线程没能及时响应用户输入,甚至出现ANR. 于是Android提供了一个 SurfaceView类,通过双缓冲机制(两块画布?三块画布?…
#include "stdafx.h" #include <GL/glut.h> #include <stdlib.h> #include <math.h> #include <stdio.h> void myDisplay(void) { glClear(GL_COLOR_BUFFER_BIT); glPointSize(5.0f); //修改点的尺寸,默认大小为1.0f glBegin(GL_POINTS); glVertex2f(0…
#include "stdafx.h" #include <GL/glut.h> #include <stdlib.h> #include <math.h> #include <stdio.h> const GLfloat PI = 3.14159265357f; void myDisplay(void) { GLfloat a = / ( - * cos( * PI / )); GLfloat bx = a*cos( * PI / );…
#include "stdafx.h" #include <GL/glut.h> #include <stdlib.h> #include <math.h> #include <stdio.h> ; const GLfloat R = 0.5f; const GLfloat PI = 3.24250265357f; void myDisplay(void) { glClear(GL_COLOR_BUFFER_BIT); glBegin(G…
这次使用OpenGL画圆,而且中间画一个实心的五角星. 1. 画实心五角: 由于之前使用Polygen画会出现故障,或许是各个GPU硬件也会不一样的,所以使用Polygen画实心五角星并不可靠: 所以这里直接使用三角形画出五角星,不须要Polygen. 2 画圆 由于GLEW里面没有现成的圆形,所以仅仅能使用人工定顶点,然后画圆的方法: 当中的数学原理能够參考这里:http://slabode.exofire.net/circle_draw.shtml 最后得到效果: 非常美丽,非常标准的五角星…