pfff, uz to vidim, ctverec mam zadavany v souradnicich s f a trojuhelniky davam naprimo ... ted otazka, jak to mam prevest, ab to fungovalo?
Predem diky
pfff, uz to vidim, ctverec mam zadavany v souradnicich s f a trojuhelniky davam naprimo ... ted otazka, jak to mam prevest, ab to fungovalo?
Predem diky
Ahoj,
mam mensi problem s openGL, kdyz pouziju nasledujici kus kodu :
int DrawGLScene(GLvoid) // Here's Where We Do All The Drawing
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer
glLoadIdentity(); // Reset The Current Modelview Matrix
glTranslatef(-1.5f,0.0f,-6.0f); // Move Left 1.5 Units And Into The Screen 6.0
glBegin(GL_TRIANGLES); // Drawing Using Triangles
glVertex3f( 0.0f, 1.0f, 0.0f); // Top
glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
glVertex3f( 1.0f, -1.0f, 0.0f); // Bottom Right
glEnd(); // Finished Drawing The Triangle
glTranslatef(3.0f,0.0f,0.0f); // Move Right 3 Units
glBegin(GL_QUADS); // Draw A Quad
glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left
glVertex3f( 1.0f, 1.0f, 0.0f); // Top Right
glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right
glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
glEnd(); // Done Drawing The Quad
return TRUE; // Keep Going
}
vykresli mi to vlevo trojuhlenik, vpravo ctverec,
ovsem kdyz kod upravim a budu tam chtit vykreslit trs trojuhelniku, nestane se nic a po spusteni je pouze vpravo ctverec, ovsem s barvou nastavenou na trs trojuhelniku, tudiz jako by to ten cely kod preskocilo a nevim proc...
tady upraveny kod:
int DrawGLScene(GLvoid) // Here's Where We Do All The Drawing
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer
glLoadIdentity(); // Reset The Current Modelview Matrix
glTranslatef(-1.5f,0.0f,-6.0f); // Move Left 1.5 Units And Into The Screen 6.0
glColor3f(1.0f, 0.0f, 0.0f);
glBegin(GL_TRIANGLE_FAN); // vykresleni trsu trojuhelniku
glVertex2i(300, 150);
glVertex2i(250, 160);
glVertex2i(270, 190);
glVertex2i(290, 200);
glVertex2i(310, 200);
glVertex2i(330, 190);
glVertex2i(350, 160);
glEnd(); // Finished Drawing The Triangle
glTranslatef(3.0f,0.0f,0.0f); // Move Right 3 Units
glBegin(GL_QUADS); // Draw A Quad
glVertex3f(-1.0f, 1.0f, 0.0f); // Top Left
glVertex3f( 1.0f, 1.0f, 0.0f); // Top Right
glVertex3f( 1.0f,-1.0f, 0.0f); // Bottom Right
glVertex3f(-1.0f,-1.0f, 0.0f); // Bottom Left
glEnd(); // Done Drawing The Quad
return TRUE; // Keep Going
}
Omlouvam se, to jsem zapomnel pripsat - Visual Studio 2010
Zacinam si hrat s openGL v C++ a hned ze zacatku mam problem...
Zkousim triialni kod, co mi jen vytvori prazdne okno:
[code]#pragma comment(lib,"glut32.lib")
#include <gl/glut.h>
void WinMain(int argc, char** argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH);
glutInitWindowSize(500,500);
glutInitWindowPosition(0,0);
glutCreateWindow("Simple"); /* ... */
}[/code]
A stále dokola mi to vyhazuje tyto chyby:
[code]error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup c:\Users\kafooo\documents\visual studio 2010\Projects\learning_opengl\learning_opengl\MSVCRTD.lib(crtexe.obj) learning_opengl
[/code]
[code]LNK1120: 1 unresolved externals c:\users\kafooo\documents\visual studio 2010\Projects\learning_opengl\Debug\learning_opengl.exe 1 1 learning_opengl
[/code]
Na netu jsem nasel, ze to casto byva chybnym odkazem na .h a .lib soubor, ale ty mam ve spravnych slozkach, na glut32.lib jsem pro jistotu zadal cestu pres link preferences a stale stejna chyba...
Predem diky za pomoc