Click here to Skip to main content
Click here to Skip to main content
Articles » Multimedia » OpenGL » General » Downloads
 
Add your own
alternative version

Achieving PostScript and Wmf outputs for OpenGL

, 9 Jun 2003
This article explains how to generate resolution independent versions of 3D meshes rendered by OpenGL/MFC programs, i.e. how to export the rendering results to vectorial formats such as encapsulated postscript (EPS) and Windows enhanced metafile (EMF) formats. The main goal consists of being able to
gl_export.zip
Src
Mesh.dsp
Mesh.dsw
Mesh.plg
Mesh.aps
Mesh.clw
Lib3D
res
Mesh.ico
MeshDoc.ico
Toolbar.bmp
Mesh.ncb
Mesh.opt
Bin
knot2.wrl
mnt.wrl
mannequin.wrl
venus.wrl
knot1.wrl
nefertiti.wrl
geosphere.wrl
metafile.emf
Mesh.exe
samples_eps.zip
nefertiti_flat.eps
nefertiti_line_light.eps
nefertiti_line.eps
nefertiti_line_color.eps
nefertiti_smooth_light.eps
nefertiti_line_smooth_light.eps
nefertiti_vertex_color.eps
sample_ppt.zip
sample.ppt
//********************************************
// Vector3d.h
//********************************************
// alliez@usc.edu
// Created : 10/12/97
// Modified : 19/01/98
//********************************************

#ifndef _VECTOR_3D_
#define _VECTOR_3D_

#include "Object3d.h"

class CVertex3d;

class CVector3d : public CObject3d
{

private :

	// Geometry
	float m_x;
	float m_y;
	float m_z;

public :

	CVector3d() { m_x = m_y = m_z = 0.0f; } 
	virtual ~CVector3d();
	
	// Constructors
	CVector3d(const float x,const float y,const float z);
	CVector3d(CVector3d &vector);
	CVector3d(CVector3d *pVector);
	CVector3d(CVertex3d *pVertex1,CVertex3d *pVertex2);
	CVector3d(CVertex3d &vertex1,CVertex3d &vertex2);

	// Debug
	void Trace();

	// Data setting
	virtual int GetType();
	void Clear(void);
	void Set(CVector3d *pVector);
	void Set(CVector3d &vector);
	void Set(CVertex3d *pVertex1,CVertex3d *pVertex2);
	void Set(const float x,const float y,const float z);
	void Copy(CVector3d &vector);
	void Copy(CVector3d *pVector);

	// Per coordinate (explicit inline functions)
	void x(float x) {	m_x = x; }
	void y(float y) {	m_y = y; }
	void z(float z) {	m_z = z; } 

	// Data access (explicit inline functions)
	float x(void) { return m_x; }
	float y(void) { return m_y; }
	float z(void) { return m_z; }

	// Operators
	CVector3d operator=(CVector3d& vector); // Setting
	void operator+=(CVector3d* pVector);
	void operator/=(float factor);
	void operator*=(float factor);

	void Inner(CVector3d& vector);
	static CVector3d Inner(CVector3d* u,CVector3d* v); // Stupid c++

	// Misc
	void NormalizeL2(void);
	void NormalizeL2(float value);
	double GetNormL2(void);
	double GetNormL2Square(void);
	int Collinear(CVector3d *pVector);
	int Collinear(CVector3d &vector);

	void RotateXZ(float alpha);

};

// External operators
CVector3d operator+(CVector3d& u,CVector3d& v); // Add
CVector3d operator-(CVector3d& u,CVector3d& v); // Subtract
CVector3d operator^(CVector3d& u,CVector3d& v); // Inner

#endif // _VECTOR_3D_

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Pierre Alliez

France France
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.1411023.1 | Last Updated 10 Jun 2003
Article Copyright 2001 by Pierre Alliez
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid