本文整理汇总了C++中quad函数的典型用法代码示例。如果您正苦于以下问题:C++ quad函数的具体用法?C++ quad怎么用?C++ quad使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了quad函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: glGenLists
GLuint GLWidget::makeObject()
{
GLuint list = glGenLists(1);
glNewList(list, GL_COMPILE);
glBegin(GL_QUADS);
GLdouble x1 = +0.06;
GLdouble y1 = -0.14;
GLdouble x2 = +0.14;
GLdouble y2 = -0.06;
GLdouble x3 = +0.08;
GLdouble y3 = +0.00;
GLdouble x4 = +0.30;
GLdouble y4 = +0.22;
quad(x1, y1, x2, y2, y2, x2, y1, x1);
quad(x3, y3, x4, y4, y4, x4, y3, x3);
extrude(x1, y1, x2, y2);
extrude(x2, y2, y2, x2);
extrude(y2, x2, y1, x1);
extrude(y1, x1, x1, y1);
extrude(x3, y3, x4, y4);
extrude(x4, y4, y4, x4);
extrude(y4, x4, y3, x3);
const double Pi = 3.14159265358979323846;
const int NumSectors = 200;
for (int i = 0; i < NumSectors; ++i) {
double angle1 = (i * 2 * Pi) / NumSectors;
GLdouble x5 = 0.30 * sin(angle1);
GLdouble y5 = 0.30 * cos(angle1);
GLdouble x6 = 0.20 * sin(angle1);
GLdouble y6 = 0.20 * cos(angle1);
double angle2 = ((i + 1) * 2 * Pi) / NumSectors;
GLdouble x7 = 0.20 * sin(angle2);
GLdouble y7 = 0.20 * cos(angle2);
GLdouble x8 = 0.30 * sin(angle2);
GLdouble y8 = 0.30 * cos(angle2);
quad(x5, y5, x6, y6, x7, y7, x8, y8);
extrude(x6, y6, x7, y7);
extrude(x8, y8, x5, y5);
}
glEnd();
glEndList();
return list;
}
开发者ID:pkestene,项目名称:ramsesGPU,代码行数:54,代码来源:glwidget.cpp
示例2: quad
double quad(double left, double right, double fleft, double fright, double lrarea) {
double mid, fmid, larea, rarea;
mid = (left + right) / 2;
fmid = F(mid);
larea = (fleft + fmid) * (mid - left) / 2;
rarea = (fmid + fright) * (right - mid) / 2;
if( fabs((larea + rarea) - lrarea) > EPSILON ) {
larea = quad(left, mid, fleft, fmid, larea);
rarea = quad(mid, right, fmid, fright, rarea);
}
return (larea + rarea);
}
开发者ID:robevans,项目名称:MPI,代码行数:13,代码来源:aquadsequential.c
示例3: quad
void Renderer::createGeometry()
{
vertices.clear();
normals.clear();
qreal x1 = +0.06f;
qreal y1 = -0.14f;
qreal x2 = +0.14f;
qreal y2 = -0.06f;
qreal x3 = +0.08f;
qreal y3 = +0.00f;
qreal x4 = +0.30f;
qreal y4 = +0.22f;
quad(x1, y1, x2, y2, y2, x2, y1, x1);
quad(x3, y3, x4, y4, y4, x4, y3, x3);
extrude(x1, y1, x2, y2);
extrude(x2, y2, y2, x2);
extrude(y2, x2, y1, x1);
extrude(y1, x1, x1, y1);
extrude(x3, y3, x4, y4);
extrude(x4, y4, y4, x4);
extrude(y4, x4, y3, x3);
const qreal Pi = 3.14159f;
const int NumSectors = 100;
for (int i = 0; i < NumSectors; ++i) {
qreal angle1 = (i * 2 * Pi) / NumSectors;
qreal x5 = 0.30 * sin(angle1);
qreal y5 = 0.30 * cos(angle1);
qreal x6 = 0.20 * sin(angle1);
qreal y6 = 0.20 * cos(angle1);
qreal angle2 = ((i + 1) * 2 * Pi) / NumSectors;
qreal x7 = 0.20 * sin(angle2);
qreal y7 = 0.20 * cos(angle2);
qreal x8 = 0.30 * sin(angle2);
qreal y8 = 0.30 * cos(angle2);
quad(x5, y5, x6, y6, x7, y7, x8, y8);
extrude(x6, y6, x7, y7);
extrude(x8, y8, x5, y5);
}
for (int i = 0;i < vertices.size();i++)
vertices[i] *= 2.0f;
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:50,代码来源:glwidget.cpp
示例4: BaseWalls
void BaseWalls(trix_mesh *mwhite, trix_mesh *mblack, trix_vertex *v, int x, int y, int w, int h) {
// west
if (x == 0) {
quad(mwhite, &v[17], &v[21], &v[18], &v[14]);
quad(mblack, &v[0], &v[17], &v[14], &v[1]);
}
// east
if (x + 1 == w) {
quad(mwhite, &v[15], &v[19], &v[20], &v[16]);
quad(mblack, &v[4], &v[15], &v[16], &v[5]);
}
// north
if (y == 0) {
tri(mwhite, &v[17], &v[29], &v[21]);
tri(mwhite, &v[29], &v[20], &v[21]);
tri(mwhite, &v[16], &v[20], &v[29]);
quad(mblack, &v[0], &v[27], &v[29], &v[17]);
quad(mblack, &v[27], &v[5], &v[16], &v[29]);
}
// south
if (y + 1 == h) {
tri(mwhite, &v[14], &v[18], &v[28]);
tri(mwhite, &v[28], &v[18], &v[19]);
tri(mwhite, &v[15], &v[28], &v[19]);
quad(mblack, &v[1], &v[14], &v[28], &v[26]);
quad(mblack, &v[28], &v[15], &v[4], &v[26]);
}
}
开发者ID:anoved,项目名称:ridge-o-gram,代码行数:35,代码来源:rog.c
示例5: transformCylindric
/**
* Tranforms points from cartesian to cylindric coordinates
*/
void transformCylindric(struct system *System)
{
point tmpPoint; // Temporary point to transform coordinates
for (uint_fast32_t i = 0; i < System->numPoints; i++)
{
tmpPoint = System->points[i];
tmpPoint.x = sqrt(quad(System->points[i].x) + quad(System->points[i].y));
tmpPoint.y = atan2(System->points[i].y, System->points[i].x);
System->points[i] = tmpPoint;
}
}
开发者ID:exitus23,项目名称:STMelectrostatics,代码行数:17,代码来源:calc.c
示例6: m_count
Logo::Logo()
: m_count(0)
{
m_data.resize(2500 * 6);
const GLfloat x1 = +0.06f;
const GLfloat y1 = -0.14f;
const GLfloat x2 = +0.14f;
const GLfloat y2 = -0.06f;
const GLfloat x3 = +0.08f;
const GLfloat y3 = +0.00f;
const GLfloat x4 = +0.30f;
const GLfloat y4 = +0.22f;
quad(x1, y1, x2, y2, y2, x2, y1, x1);
quad(x3, y3, x4, y4, y4, x4, y3, x3);
extrude(x1, y1, x2, y2);
extrude(x2, y2, y2, x2);
extrude(y2, x2, y1, x1);
extrude(y1, x1, x1, y1);
extrude(x3, y3, x4, y4);
extrude(x4, y4, y4, x4);
extrude(y4, x4, y3, x3);
const int NumSectors = 100;
for (int i = 0; i < NumSectors; ++i) {
GLfloat angle = (i * 2 * M_PI) / NumSectors;
GLfloat angleSin = qSin(angle);
GLfloat angleCos = qCos(angle);
const GLfloat x5 = 0.30f * angleSin;
const GLfloat y5 = 0.30f * angleCos;
const GLfloat x6 = 0.20f * angleSin;
const GLfloat y6 = 0.20f * angleCos;
angle = ((i + 1) * 2 * M_PI) / NumSectors;
angleSin = qSin(angle);
angleCos = qCos(angle);
const GLfloat x7 = 0.20f * angleSin;
const GLfloat y7 = 0.20f * angleCos;
const GLfloat x8 = 0.30f * angleSin;
const GLfloat y8 = 0.30f * angleCos;
quad(x5, y5, x6, y6, x7, y7, x8, y8);
extrude(x6, y6, x7, y7);
extrude(x8, y8, x5, y5);
}
}
开发者ID:erikhvatum,项目名称:multiple_gl_viewport_fps_toy,代码行数:50,代码来源:logo.cpp
示例7: mue
double
mue(double beta, double p) {
double temp,result;
double gama;
gama = 1 + 2*quad(beta);
/* temp = 1 + (p*quad(beta))/gama + (p*(p+2)*qquad(beta))/(2*quad(gama)); */
temp = 1 + (p*quad(beta))/gama + (p*(p+2)*pow(beta,4))/(2*quad(gama));
result = 1 - pow(gama, -(p/2.0))*temp;
return result;
}
开发者ID:mfeurer,项目名称:metafeatures,代码行数:15,代码来源:crit_val.c
示例8: getPopupMenuInfo
bool ExternalPopupMenu::showInternal()
{
// Blink core reuses the PopupMenu of an element. For simplicity, we do
// recreate the actual external popup everytime.
if (m_webExternalPopupMenu) {
m_webExternalPopupMenu->close();
m_webExternalPopupMenu = 0;
}
WebPopupMenuInfo info;
getPopupMenuInfo(info, *m_ownerElement);
if (info.items.isEmpty())
return false;
WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(m_localFrame.get());
m_webExternalPopupMenu = webframe->client()->createExternalPopupMenu(info, this);
if (m_webExternalPopupMenu) {
LayoutObject* layoutObject = m_ownerElement->layoutObject();
if (!layoutObject || !layoutObject->isBox())
return false;
FloatQuad quad(toLayoutBox(layoutObject)->localToAbsoluteQuad(FloatQuad(toLayoutBox(layoutObject)->borderBoundingBox())));
IntRect rect(quad.enclosingBoundingBox());
IntRect rectInViewport = m_localFrame->view()->soonToBeRemovedContentsToUnscaledViewport(rect);
// TODO(tkent): If the anchor rectangle is not visible, we should not
// show a popup.
m_webExternalPopupMenu->show(rectInViewport);
m_shownDOMTreeVersion = m_ownerElement->document().domTreeVersion();
return true;
} else {
// The client might refuse to create a popup (when there is already one pending to be shown for example).
didCancel();
return false;
}
}
开发者ID:astojilj,项目名称:chromium-crosswalk,代码行数:33,代码来源:ExternalPopupMenu.cpp
示例9: retransformSpheroidal
/**
* Transforms points back from prolate spheroidal to cylindric coordinates
*/
void retransformSpheroidal(struct tip *Tip)
{
point tmpPoint; // Temporary point to transform coordinates
for (uint_fast32_t i = 0; i < Tip->numPoints; i++)
{
tmpPoint = Tip->points[i];
tmpPoint.x = Tip->a * sqrt((quad(Tip->points[i].x) - 1) *
(1 - quad(Tip->points[i].z)));
tmpPoint.y = Tip->points[i].y;
tmpPoint.z = Tip->a * Tip->points[i].x * Tip->points[i].z;
Tip->points[i] = tmpPoint;
}
}
开发者ID:exitus23,项目名称:STMelectrostatics,代码行数:19,代码来源:calc.c
示例10: resource
JQuadPtr WCachedTexture::GetQuad(float offX, float offY, float width, float height, const string& resname)
{
if (!texture) return JQuadPtr();
if (width == 0.0f || width > static_cast<float> (texture->mWidth)) width = static_cast<float> (texture->mWidth);
if (height == 0.0f || height > static_cast<float> (texture->mHeight)) height = static_cast<float> (texture->mHeight);
// If we're fetching a card resource, but it's not available yet, we'll be attempting to get the Quad from the temporary back image.
// If that's the case, don't stash a separate tracked quad entry for each card name in the the Back/BackThumbnail's resource
string resource(resname);
if (mFilename == kGenericCard || mFilename == kGenericThumbCard)
{
// if we're the back or thumb_back file, but we've been asked for a card ID, then assign it
// a placeholder ID. Reason being, hotspots on quads are different (ie centered) for card images, so we'll store a separate quad for cards
if (resname != kGenericCardID && resname != kGenericCardThumbnailID)
resource = kPlaceholderID;
}
std::map<string, JQuadPtr>::iterator iter = mTrackedQuads.find(resource);
if (iter != mTrackedQuads.end())
return iter->second;
JQuadPtr quad(NEW JQuad(texture, offX, offY, width, height));
//Update JQ's values to what we called this with.
quad->SetTextureRect(offX, offY, width, height);
mTrackedQuads.insert(std::pair<string, JQuadPtr>(resource, quad));
return quad;
}
开发者ID:zwvc,项目名称:wagic-x,代码行数:30,代码来源:WCachedResource.cpp
示例11: quad
// -----------------------------------------------------------------
// Name : withHoverGeometry
// -----------------------------------------------------------------
Button * Button::withHoverGeometry(ITexture * pTex, IGeometryQuads * pGeo)
{
m_pGeometryHover = pGeo;
QuadData quad(0, m_iWidth, 0, m_iHeight, pTex);
pGeo->build(&quad);
return this;
}
开发者ID:jotak,项目名称:jogy,代码行数:10,代码来源:Button.cpp
示例12: TEST_F
TEST_F(GeneratorsBenchmark, benchmarkHyperbolicGeneratorWithSequentialQuadtree) {
count n = 100000;
double s = 1.0;
double alpha = 1;
vector<double> angles(n);
vector<double> radii(n);
HyperbolicSpace::fillPoints(angles, radii, s, alpha);
double R = s*HyperbolicSpace::hyperbolicAreaToRadius(n);
double r = HyperbolicSpace::hyperbolicRadiusToEuclidean(R);
Quadtree<index> quad(r);
for (index i = 0; i < n; i++) {
quad.addContent(i, angles[i], radii[i]);
}
angles.clear();
radii.clear();
quad.trim();
quad.sortPointsInLeaves();
quad.reindex();
quad.extractCoordinates(angles, radii);
HyperbolicGenerator gen;
Graph G = gen.generate(angles, radii, quad, R);
EXPECT_EQ(n, G.numberOfNodes());
}
开发者ID:maxvogel,项目名称:NetworKit-mirror2,代码行数:29,代码来源:GeneratorsBenchmark.cpp
示例13: main
//int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pScmdline, int iCmdshow)
int main(int _argc, char** _argv)
{
EEDesc desc;
desc.applicationName = L"Emerald"; //窗口名称
desc.isFullScreen = false; //是否全屏
desc.width = 800; //窗口宽度
desc.height = 450; //窗口高度
desc.isSSAA = true; //是开启抗锯齿
desc.isVsync = false; //是否垂直同步
EEInitialize();
EETexture tex0(L"Texture\\etc\\101087.jpg");
EETexture tex1(L"Texture\\etc\\xmyrz.jpg");
//EETexture bgTex(L"Texture\\test3.gif");
//EETexture bgTex(L"Texture\\Project Diva Freedom\\主界面\\默认主题\\背景.jpg");
EEQuad2D quad(Rect_Float(0, 0, (float)EEGetWidth(), (float)EEGetHeight()), tex1);
EEContrastAndBrightC cb(tex1);
cb.SetContrast(200.f);
cb.SetBright(0.1f);
while (EERun())
{
EEBeginScene(EEColor::BLACK);
quad.Process();
printf("%d ", EEGetFPS());
EEEndScene();
}
EEShutdown();
return 0;
}
开发者ID:NinjaRhyme,项目名称:Emerald,代码行数:35,代码来源:ContrastAndBright.cpp
示例14: main
int main(void)
{
InitPeripherals();
// if (InitBatteryMonitorHardware()) {
// mBlueON;
// }
EnablePWM();
mRedON;
mGreenOFF;
mBlueOFF;
mYellowOFF;
// hardware devices
UsbInterface usb;
ZigbeeInterface zig;
MPU6050 imu(MPU6050_ADDRESS);
// initialize IMU
imu.setCommDelay(50); // 50usec delay when trying reads
imu.setCommRetries(3); // try at most 3 times before bailing
// instantiate the main object
Quadrotor quad(QUAD_ID, &imu, &usb, &zig);
quad.init();
mRedOFF;
// enter main run loop, blocks forever
quad.run();
return 0;
}
开发者ID:vincentwenxuan,项目名称:smores_document,代码行数:31,代码来源:main.cpp
示例15: dist
Nebula::Nebula()
{
//nebula functionality currently only implemented for windows
//TODO: port for non windows functionality
#ifdef _WIN32
const unsigned int num_quads = 12;
std::tr1::mt19937 eng;
std::tr1::normal_distribution<float> dist(0, 0.25f);
std::vector<Texture> textures;
std::vector<std::string> nebula_files = Directory::GetFiles( root_assets_path + "/assets/nebula" );
for( unsigned int i = 0; i < nebula_files.size(); i++ )
textures.push_back( Texture( nebula_files[i] ) );
for( unsigned int i = 0; i < num_quads; i++ )
{
const float random_angle = (float)(rand() % 360);
//GeoVector random_rotation_axis( (float)(rand() % 1000), (float)(rand() % 1000), (float)(rand() % 1000) );
GeoVector random_rotation_axis( 0, 1, 0 );
random_rotation_axis.Normalize();
RenderableObject quad( textures[rand() % textures.size()], GeometryFactory().GenerateXYUnitSquare() );
quad.RotateInObjectspace( random_rotation_axis.ToXMFloat3(), random_angle );
//quad.Scale( 1 + dist(eng), 1 + dist(eng), 1 + dist(eng) );
quad.Translate( 0, 0, 2 );
quad.Translate( dist(eng), dist(eng), dist(eng) );
quad.SetTechnique( "AdditiveParticle" );
quads.push_back( quad );
}
#endif
}
开发者ID:MishaConway,项目名称:simple3d,代码行数:33,代码来源:Nebula.cpp
示例16: MENU_render
void MENU_render()
{
glPushMatrix();
glLoadIdentity();
glTranslatef(0.0f,0.0f, -40.0f);
glPushMatrix();
glColor4f(0.0f, 0.0f, 0.0f, 0.5f);
glTranslatef(-menu_x-board_x*0.125f, 0.0f, 0.0f);
glScalef(board_x*0.75f, board_y, 1.0f);
quad();
glPopMatrix();
if(game_state == INTRO)
{
font_printf_guay(-menu_x-board_x*0.14f - 10.0f,3.3f,-4.f,4.3f,"Cubyshot");
font_printf_guay(-menu_x-board_x*0.14f - 10.0f,0.8f,-4.f,1.8f,"press fire button to play!");
}
else if(game_state == DEAD)
{
font_printf_guay(-menu_x-board_x*0.14f - 10.0f,3.3f,-4.f,4.3f,"you are dead");
font_printf_guay(-menu_x-board_x*0.14f - 10.0f,0.8f,-4.f,1.8f,"press fire button to restart!");
font_printf_guay(-menu_x-board_x*0.14f - 10.0f,-1.8f,-4.f,1.8f,"your score: %d",pj_score);
}
else if(game_state == PAUSE)
{
font_printf_guay(-menu_x-board_x*0.14f - 10.0f,3.3f,-4.f,4.3f,"Pause");
}
else if(game_state == INTER_LEVEL)
{
font_printf_guay(-menu_x-board_x*0.14f - 10.0f,3.3f,-4.f,4.3f,"LEVEL");
font_printf_guay(-menu_x-board_x*0.14f - 10.0f,-1.3f,-4.f,4.3f,"COMPLETED");
font_printf_guay(-menu_x-board_x*0.14f - 10.0f,-5.8f,-4.f,1.8f,"press enter to next level");
}
font_printf_guay(-0.5f*board_x,-board_y*.5f,-4.f,2.3f,"score: %d", pj_score);
if(final_boss != 0)
{
//boss life bar
glPushMatrix();
float life_max = board_x*0.75f;
float life = final_boss->life*life_max;
glTranslatef(life*0.5f - board_x*0.40f, board_y*0.45f, 0.0f);
glScalef(life*0.5f, 0.2f, 0.2f);
cube_w();
glPopMatrix();
}
glPopMatrix();
}
开发者ID:javisantana,项目名称:cubyshot,代码行数:60,代码来源:menu.cpp
示例17: quad
void FaceSpatializeIndexed<BasicTraits>::CategoryRaw::addData (OpenSGFaceBase<OpenSGTraits>* node, const FaceIterator& face)
{
GeoPositions3f::StoredFieldType* p = m_coord->getFieldPtr();
GeoNormals3f::StoredFieldType* n = m_normal->getFieldPtr();
//GeoIndicesUI32::StoredFieldType* i = m_index->getFieldPtr();
// find offset of positions and normals in the new geometry
u32 i, k;
m_offsetIt = m_offset.find(face.getGeometry());
if (m_offsetIt == m_offset.end()) {
// insert new offsets entry into map
HashMapPair offsetPair =
m_offset.insert(HashMap::value_type(face.getGeometry(), quad()));
m_offsetIt = offsetPair.first;
m_offsetIt->second.position = m_coord->size();
GeoPositionsPtr faceP = m_original.getPositions();
addRefCP(faceP);
for (k=0; k<faceP->getSize(); ++k) {
p->addValue(faceP->getValue(k));
}
if (m_hasNormal) {
m_offsetIt->second.normal = m_normal->size();
GeoNormalsPtr faceN = m_original.getNormals();
addRefCP(faceN);
for (k=0; k<faceN->getSize(); ++k) {
n->addValue(faceN->getValue(k));
}
subRefCP(faceN);
}
subRefCP(faceP);
}
// insert indices
if (face.getLength() == 3) {
for (k=0; k<3; ++k) {
m_index->insertValue(face.getPositionIndex(k)+m_offsetIt->second.position, m_quadOffset++);
i = 1;
if (m_hasNormal) {
m_index->insertValue(face.getNormalIndex(k)+m_offsetIt->second.normal, m_quadOffset++);
++i;
}
for (; i<m_indexStride; ++i) {
m_index->insertValue(0, m_quadOffset++);
}
}
} else {
for (k=0; k<4; ++k) {
m_index->addValue(face.getPositionIndex(k)+m_offsetIt->second.position);
i = 1;
if (m_hasNormal) {
m_index->addValue(face.getNormalIndex(k)+m_offsetIt->second.normal);
++i;
}
for (; i<m_indexStride; ++i) {
m_index->addValue(0);
}
}
}
}
开发者ID:BackupTheBerlios,项目名称:opensgplus,代码行数:60,代码来源:OSGGVFaceSpatializeIndexed.cpp
示例18: quad
// -----------------------------------------------------------------
// Name : withGeometry
// -----------------------------------------------------------------
Image * Image::withGeometry(ITexture * pTex, IGeometryQuads * pGeo)
{
m_pGeometry = pGeo;
QuadData quad(0, m_iWidth, 0, m_iHeight, pTex);
pGeo->build(&quad);
return this;
}
开发者ID:jotak,项目名称:jogy,代码行数:10,代码来源:Image.cpp
示例19: FREE
// -----------------------------------------------------------------
// Name : attachImage
// -----------------------------------------------------------------
void Button::attachImage(ITexture * pTex, IGeometryQuads * pImageGeo)
{
FREE(m_pGeometryAttachedImage);
QuadData quad(0, m_iWidth, 0, m_iHeight, pTex);
m_pGeometryAttachedImage = pImageGeo;
m_pGeometryAttachedImage->build(&quad);
}
开发者ID:jotak,项目名称:jogy,代码行数:10,代码来源:Button.cpp
示例20: main
int main( int argc, char **argv ) {
QApplication a( argc, argv );
OctreeNode n1;
GLWidget *w = new GLWidget();
GLData* g = w->addObject();
GLData* rnd = w->addObject();
RandomSource src( rnd );
QObject::connect( w->timer, SIGNAL(timeout()), &src, SLOT(timeOutSlot()) );
std::cout << " genVBO()\n";
/*
g->setTriangles();
g->setPosition(1,0,-6);
g->setUsageStaticDraw();
g->addVertex(-1.0f,-1.0f, 0.0f, 1.0f,0.0f,0.0f, boost::bind(&OctreeNode::indexSwap, &n1, _1, _2) );
g->addVertex( 1.0f,-1.0f, 0.0f, 0.0f,1.0f,0.0f, boost::bind(&OctreeNode::indexSwap, &n1, _1, _2) );
g->addVertex( 0.0f, 1.0f, 0.0f, 0.0f,0.0f,1.0f, boost::bind(&OctreeNode::indexSwap, &n1, _1, _2) );
g->addVertex( 1.0f, 1.0f, 0.0f, 1.0f,0.0f,1.0f, boost::bind(&OctreeNode::indexSwap, &n1, _1, _2) );
g->addVertex( -1.0f, 1.0f, 0.0f, 1.0f,1.0f,1.0f, boost::bind(&OctreeNode::indexSwap, &n1, _1, _2) );
g->addVertex( -2.0f, 0.0f, 0.0f, 1.0f,1.0f,1.0f, boost::bind(&OctreeNode::indexSwap, &n1, _1, _2) );
std::vector<GLuint> poly(3);
//poly.resize(3);
poly[0]=0; poly[1]=1; poly[2]=2;
g->addPolygon( poly );
poly[0]=2; poly[1]=1; poly[2]=3;
g->addPolygon( poly );
poly[0]=0; poly[1]=2; poly[2]=4;
g->addPolygon( poly );
poly[0]=0; poly[1]=5; poly[2]=4;
g->addPolygon( poly );
g->print();
//std::cout << "removePolygon()\n";
//g.removePolygon(0);
std::cout << "removeVertex(4)\n";
g->removeVertex(4);
g->print();
*/
// now try a quad.
OctreeNode n2;
GLData* q = w->addObject();
q->setQuads();
q->setPosition(2,0,-6);
q->setUsageStaticDraw();
q->addVertex(-3.0f,0.0f,0.0f,0.0f,0.0f,1.0f, boost::bind(&OctreeNode::indexSwap, &n2, _1, _2));
q->addVertex(-3.0f,1.0f,0.0f,0.0f,0.0f,1.0f, boost::bind(&OctreeNode::indexSwap, &n2, _1, _2));
q->addVertex(-4.0f,1.0f,0.0f,0.0f,0.0f,1.0f, boost::bind(&OctreeNode::indexSwap, &n2, _1, _2));
q->addVertex(-4.0f,0.0f,0.0f,0.0f,0.0f,1.0f, boost::bind(&OctreeNode::indexSwap, &n2, _1, _2));
std::vector<GLuint> quad(4);
quad[0]=0; quad[1]=1; quad[2]=2; quad[3]=3;
q->addPolygon(quad);
q->print();
std::cout << "Q removeVertex(3)\n";
//q->removeVertex(0);
q->print();
w->show();
return a.exec();
}
开发者ID:DavidNicholls,项目名称:opencamlib,代码行数:60,代码来源:vbo_tst.cpp
注:本文中的quad函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论