עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

בעיה ב- OpenGL ב- C++

Featured Replies

פורסם

שלום,

אני מנסה לצייר גליל ב- OpenGL ומשום מה הוא מראה לי מסך ריק במקום את הגליל.

מצ"ב קוד. אודה אם תוכלו להגיד לי מה הבעיה .

תודה

#include<glut.h>
float angle=0.;
GLUquadric *IDquadric;
void display()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glPushMatrix();// הכנסה למחסנית
glTranslatef(0.,-1.5,0.);// קביעת המיקום של הספרה על פני החלון
glColor3d(0,1,1);// קביעת צבע הספרה לכחול
gluCylinder(IDquadric,2.0f,2.0f,1.0f,25,32);
glPopMatrix();//הוצאה מהמחסנית
glutSwapBuffers();
glFlush();
}
void idle()
{
angle+=0.2;
if(angle>360.) angle-=360.;
glutPostRedisplay();
}
void myinit()
{
glClearColor(1.0,1.0,1.0,1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-6.,6.,-6.,6.,-6.,6.);
glMatrixMode(GL_MODELVIEW);
IDquadric=gluNewQuadric(); // Create A Pointer To The Quadric Object ( NEW )
gluQuadricNormals(IDquadric, GLU_SMOOTH);
}
void main(int argc,char** argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH | GLUT_RGB);
glutInitWindowSize(400,400);
glutInitWindowPosition(10,10);
glutCreateWindow("3d objects");
glutDisplayFunc(display);
glutIdleFunc(idle);
glEnable(GL_DEPTH_TEST);
myinit();
glutMainLoop();
}

פורסם

OpenGL הוא קצת כאב ראש כי יש מליון פרמטרים שכולם צריכים להיות נכונים או לפחות מתאימים. כל אחד שתשכח יכול לגרום לשלל עצום של בעיות שהדיווח עליהן בעייתי. לא קנפגת shading ו-lighting, לדוגמא.

כדי לראות שזכרת לקנפג כל מה שצריך, עדיף שתוריד דוגמא פועלת מ-nehe או מקום אחר, ואז תשווה פעולה פעולה.

אם כל הקינפוגים נראים לך נכונים, אז אחד הדברים שאפשר לבדוק זה את מצב השגיאה של opengl - אחרי כל פעולה תבדוק סטטוס השגיאה.

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.