PDA

View Full Version : Take a look at where there is wrong, thank you



beginnertom
02-25-2010, 01:28 AM
http://hellotom3389.blog.com/files/2010/02/mytexta.jpg
http://hellotom3389.blog.com/files/2010/02/textb5.jpg
http://hellotom3389.blog.com/files/2010/02/mytextc.jpg
http://hellotom3389.blog.com/files/2010/02/mytextd.jpg
thank for you help

ZbuffeR
02-25-2010, 01:46 AM
I took a look.
Too bad it is impossible to help you do something I do not understand.

I don't know, if you can express yourself, just ask someone around you to write it for you.

beginnertom
02-25-2010, 04:31 AM
hi zBuffer,

I do not know how to express.
Function of the error.
Or a code error.
Can you help me do.
I do not know how to express .my english are very bad(that's not my fault ,When I had just graduated from college, the English have been not used )

Mikael Korpela
02-25-2010, 04:50 AM
what are you trying to do?
paste your code, link to other websites that describe what you are trying to do, give us something to work with..

beginnertom
02-25-2010, 05:01 AM
hi Mikael Korpela
Code is not on my machine. Next time I re-paste.

beginnertom
02-25-2010, 07:43 PM
#include <stdlib.h>
#include <GL/glut.h>
#include "mytriangle.h"
int width, height;

typedef struct box
{
GLfloat x,
GLfloat y,
GLfloat z
}box;

box a={0,0,1};
box b={0,0.9,-0.3};
box c={-0.8,-0.4,-0.3};
box d={0.8,-0.4,-0.3};

void myinit(void)
{

glClearColor(0.0, 0.0, 0.0, 1.0);

glEnable(GL_DEPTH_TEST);
glShadeModel(GL_FLAT);


}


void display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glColor3f(1,0,0);
for(int j=0;j<9;j++)
{
{for(int i=0;i<3;i++)
glCallList(1);
for(int i=0;i<3;i++)
glCallList(1);
for(int i=0;i<3;i++)
glCallList(1);
for(int i=0;i<3;i++)
glCallList(1);}
}

glutSwapBuffers();
}

void myReshape(int w, int h)
{
width = w;
height = h;
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective (45.0, (GLfloat) w/(GLfloat) h, 3.0, 10.0);
//gluFristum
glMatrixMode(GL_MODELVIEW);
glLoadIdentity ();
glTranslatef (0.0, 0.0, -4.0); /* move object into view */
}


void
keyboard(unsigned char c, int x, int y)
{
switch(c) {
case 27:
exit(1);
default:
break;
}
glutPostRedisplay();

}



/* Main Loop
*/
int main(int argc, char** argv)
{
glutInitWindowSize(380, 380);
glutInit(&amp;argc, argv);
glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutCreateWindow("mytest1");
myinit();
glutReshapeFunc(myReshape);
glutDisplayFunc(display);
glutKeyboardFunc(keyboard);


glutMainLoop();
return 0;
}

Mikael Korpela
02-26-2010, 04:39 AM
To me it seems amazing that, that code renders anything at all.
Where do you setup that display list that you call (3+3+3+3)*9 times per frame?

beginnertom
02-28-2010, 12:48 AM
hello mikael korpela.
This is my understanding fault.
I wrote the code is wrong.
Now I understand that this code means.
The intention of this program is split triangle.
I will be re-issued a new, simple code to the explanatory notes. (Inside recursion),
Sometimes you see the master code will be a little difficult to understand.
But you understand the master found very keen.

beginnertom
02-28-2010, 12:56 AM
http://hellotom3389.blog.com/files/2010/02/moon22.jpg
http://hellotom3389.blog.com/files/2010/02/moon.jpg