OK, I feel pretty embarrassed everytime I write something here, because I know that my programming knowledge of pool is very shallow.... but nonetheless.
That's life... so I live with it.
So I realized that for glTranslatef, I just had to add z in the brackets. OK good.
Now for snpirntf, I also realized that it requires stdio.h header file, and on top of that the command seem to be _snprintf and not just snprintf, so I made that change as well.
Here is the error now:
'_snprintf': cannot convert parameter 1 from 'char (*)[40]' to 'char *'
Mike, I understand your frustration on me but... be nice...
C++ openGL : Lag issue
Quote:'_snprintf': cannot convert parameter 1 from 'char (*)[40]' to 'char *'
So can you show me the line where you use it, and the line where you declare the buffer?
Quote:
Mike, I understand your frustration on me but... be nice...
I was being nice. I was giving you the knowledge on how to find the solutions/answers to your questions yourself. This is by far more useful then spoon feeding you the answers which won't really help you learn.
There are times to post questions here and you should never feel embarassed about doing so, even for very basic one. We all start someplace. Just wish I had a site like this when I first started programming. But sometimes replies can take, hours, days or just never come to certain questions. This can be frustrating and discouraging.
Some people don't know about the help feature(s), or how to use MSDN/google to effectively search for answers. So I was merely pointing out resources to help you, help yourself, in the future.
Quote:Original post by pkiskool
Now for snpirntf, I also realized that it requires stdio.h header file, and on top of that the command seem to be _snprintf and not just snprintf, so I made that change as well.
Here is the error now:
'_snprintf': cannot convert parameter 1 from 'char (*)[40]' to 'char *'
Mike, I understand your frustration on me but... be nice...
There should not be an '&' before that parameter in the code you were shown. :)
Quote:Original post by ZahlmanQuote:Original post by pkiskool
Now for snpirntf, I also realized that it requires stdio.h header file, and on top of that the command seem to be _snprintf and not just snprintf, so I made that change as well.
Here is the error now:
'_snprintf': cannot convert parameter 1 from 'char (*)[40]' to 'char *'
Mike, I understand your frustration on me but... be nice...
There should not be an '&' before that parameter in the code you were shown. :)
Oops. Let me fix that so nobody knows it was my fault :D
OK everyone.
Thanks for the help... especially erissian.
The text rendering works great and looks great.
However, I don't think the drawing list is working properly, as I don't see anything on the screen anymore...
No error or warning on the code... so I'm not sure what the problem is...
Here's my source code. (lot shorter!0
[Edited by - pkiskool on March 10, 2009 1:46:57 PM]
Thanks for the help... especially erissian.
The text rendering works great and looks great.
However, I don't think the drawing list is working properly, as I don't see anything on the screen anymore...
No error or warning on the code... so I'm not sure what the problem is...
Here's my source code. (lot shorter!0
//HEADER FILES#include "glut.h"#include <iostream>#include <iomanip>#include <fstream>#include <cstdlib>#include <cmath>#include <math.h>#include <string>#include <stdlib.h>#define TINY 1.0e-20;#define NRANSI#define GL_PI 3.1415f#include "nrutil.h" //NR#include "nrutil.cpp" //NR#include "ludcmp.h" //NR#include "lubksb.h" //NR#include "matcalc2.h" #include "matcalc3.h" #include "front.h"// Rotation amountsstatic GLdouble xRot = 0.0f;static GLdouble yRot = 0.0f;static GLdouble zRot = 0.0f;static GLdouble eyeX = 0.0f;static GLdouble eyeY = -1.0f;static GLdouble eyeZ = 2500.0f;static GLdouble centerX = 0.0f;static GLdouble centerY = 0.0f;static GLdouble centerZ = 0.0f;static GLdouble upX = 0.0f;static GLdouble upY = 0.0f;static GLdouble upZ = 1.0f;static GLdouble scale = 1.0f;bool GeometryFlag;bool ZoomInFlag;bool ZoomOutFlag;bool NumFlag;bool LegendFlag=true;int numb=0;GLdouble y, x; double gridspace = 12.0f;unsigned int now, last;////////////////////////////////////////////// Text rendering function////////////////////////////////////////////void render_text(float x, float y, char* s){ glRasterPos2f(x,y); for ( unsigned int i=0; i < strlen( s ); i++ ) glutBitmapCharacter(GLUT_BITMAP_9_BY_15,s);}///////////////////////////////////////////////////////////// Setup the rendering state//////////////////////////////////////////////////////////// Called to draw scenevoid RenderScene(void) { /*now = GetTickCount(); //comment THIS (only // parts) out TO GO MANAUL//////////////////////////////////////////////////////////////////////////////// if (now-last>100){ //THE NUMBER HERE CONTROLS THE SPEED - 1000 IS 1 SECOND last = now; // front(); // if (SolutionFlag==true) {// matcalc3(); // SolutionFlag=false; // } // } //*/ int i, j; int Gc = gridspace*(n-1)/2, Gt = (gridspace * n)/2-(gridspace/2); double k; GLdouble fCurrSize; // Save current size // Clear the window with current clearing color glClear(GL_COLOR_BUFFER_BIT); // Save matrix state and do the rotation glPushMatrix(); glRotatef(xRot, 1.0f, 0.0f, 0.0f); glRotatef(yRot, 0.0f, 1.0f, 0.0f); glRotatef(zRot, 0.0f, 0.0f, 1.0f); char text_buffer[100]; // should be big enough _snprintf(text_buffer, 40, "FILL TIME %d SEC", filltime ); glColor3f(1.0f, 1.0f, 1.0f); render_text( 50-Gc, 5+Gc, text_buffer ); // Set up x lines for(y = - Gc; y <= (gridspace * n)/2-(gridspace/2); y += gridspace) { // Set the line width glLineWidth(2); // Draw the upper line glBegin(GL_LINES); glColor3f(0.1843f, 0.3098f, 0.1843f); glVertex3f( - Gc, y, 0); glVertex3f(- Gc + gridspace*(m-1), y, 0); // Draw the lower line glColor3f(0.1843f, 0.3098f, 0.1843f); glVertex3f( - Gc, y, - 5); glVertex3f(- Gc + gridspace*(m-1), y, - 5); } // Set up y lines for(x = - Gc; x <= - Gc + gridspace*(m-1); x += gridspace) { // Draw the upper line glColor3f(0.1843f, 0.3098f, 0.1843f); glVertex3f(x, - Gc, 0); glVertex3f(x, Gc, 0); // Draw the lower line glBegin(GL_LINES); glColor3f(0.1843f, 0.3098f, 0.1843f); glVertex3f(x, - Gc, -5); glVertex3f(x, Gc, -5); } //1D case if (n==1) { for(x = - Gc; x <= - Gc + gridspace*(m-1); x += gridspace) { // Set the line width // Draw the upper line glColor3f(0.1843f, 0.3098f, 0.1843f); glVertex3f(x, - ((gridspace * (n+1)*0.3)/2-(gridspace/2)), 0); glVertex3f(x, ((gridspace * (n+1)*0.3)/2-(gridspace/2)), 0); // Draw the lower line glColor3f(0.1843f, 0.3098f, 0.1843f); glVertex3f(x, - ((gridspace * (n+1)*0.3)/2-(gridspace/2)), -5); glVertex3f(x, ((gridspace * (n+1)*0.3)/2-(gridspace/2)), -5); } } // Set up z lines (4 corners) - thickness to the plate glColor3f(0.1843f, 0.3098f, 0.1843f); glVertex3f( - Gc, - Gc, 0); glVertex3f( - Gc, - Gc, -5); glColor3f(0.1843f, 0.3098f, 0.1843f); glVertex3f( - Gc, (gridspace * n)/2-(gridspace/2), 0); glVertex3f( - Gc, (gridspace * n)/2-(gridspace/2), -5); glColor3f(0.1843f, 0.3098f, 0.1843f); glVertex3f(- Gc + gridspace*(m-1), - Gc, 0); glVertex3f(- Gc + gridspace*(m-1), - Gc, -5); glColor3f(0.1843f, 0.3098f, 0.1843f); glVertex3f(- Gc + gridspace*(m-1), (gridspace * n)/2-(gridspace/2), 0); glVertex3f(- Gc + gridspace*(m-1), (gridspace * n)/2-(gridspace/2), -5); glEnd(); //Draw circle (last wetted node) for (i=0; i<=n-1; i++) { for (j=1; j<=m; j++) { if (type[i*m+j]==1) { //'o' - display with a hollow white circle /*glBegin(GL_LINE_LOOP); //De-bug mode for flow fronts glColor3f(0.000f, 0.000f, 1.000f); for (k=0; k<=360; k+=5) { glVertex2f( (-(gridspace * n)/2-(gridspace/2)+j*gridspace) + sin(k) * 3.5, ( ((gridspace * n)/2-(gridspace/2) - (i*gridspace)) + cos(k) * 3.5) ); }*/ glBegin(GL_TRIANGLE_FAN); glColor3f(0.000f, 0.000f, 1.000f); for (k=0; k<=360; k+=15) { glVertex2f( (-(gridspace * n)/2-(gridspace/2)+j*gridspace) + sin(k*0.0174) * 3.5, ( ((gridspace * n)/2-(gridspace/2) - (i*gridspace)) + cos(k*0.0174) * 3.5) ); } glEnd(); } else if (type[i*m+j]==0) { //'i' - display with a red cube glBegin(GL_TRIANGLE_FAN); glColor3f(1.0f, 0.0f, 0.0f); //Red for (k=0; k<=360; k+=15) { glVertex2f( (-(gridspace * n)/2-(gridspace/2)+j*gridspace) + sin(k*0.0174) * 3.5, ( ((gridspace * n)/2-(gridspace/2) - (i*gridspace)) + cos(k*0.0174) * 3.5) ); } glEnd(); } else if (type[i*m+j]==2) { //'x' - display with a white filled circle glBegin(GL_TRIANGLE_FAN); //COLOR CODE if (pres[i*m+j] >= 0 && pres[i*m+j] < inpres*1000/12*1) glColor3f(0.000f, 0.000f, 1.000f); //Slate Blue if (pres[i*m+j] >= inpres*1000/12*1 && pres[i*m+j] < inpres*1000/12*2) glColor3f(0.000f, 0.5000f, 1.000f); //Sky Blue if (pres[i*m+j] >= inpres*1000/12*2 && pres[i*m+j] < inpres*1000/12*3) glColor3f(0.000f, 0.800f, 1.000f); //Medium Torquoise if (pres[i*m+j] >= inpres*1000/12*3 && pres[i*m+j] < inpres*1000/12*4) glColor3f(0.000f, 1.000f, 1.000f); //Aquamarine if (pres[i*m+j] >= inpres*1000/12*4 && pres[i*m+j] < inpres*1000/12*5) glColor3f(0.000f, 1.000f, 0.600f); //Spring Green if (pres[i*m+j] >= inpres*1000/12*5 && pres[i*m+j] < inpres*1000/12*6) glColor3f(0.000f, 1.000f, 0.000f); //Lime Green if (pres[i*m+j] >= inpres*1000/12*6 && pres[i*m+j] < inpres*1000/12*7) glColor3f(0.500f, 0.900f, 0.0f); //Green if (pres[i*m+j] >= inpres*1000/12*7 && pres[i*m+j] < inpres*1000/12*8) glColor3f(0.800f, 0.900f, 0.000f); //Medium Spring Green if (pres[i*m+j] >= inpres*1000/12*8 && pres[i*m+j] < inpres*1000/12*9) glColor3f(1.000f, 1.000f, 0.000f); if (pres[i*m+j] >= inpres*1000/12*9 && pres[i*m+j] < inpres*1000/12*10) glColor3f(1.000f, 0.800f, 0.000f); //Coral if (pres[i*m+j] >= inpres*1000/12*10 && pres[i*m+j] < inpres*1000/12*11) glColor3f(1.000f, 0.500f, 0.000f); if (pres[i*m+j] >= inpres*1000/12*11 && pres[i*m+j] < inpres*1000/12*12) glColor3f(1.0f, 0.0f, 0.0f); //changed to Red for (k=0; k<=360; k+=15) { glVertex2f( (-(gridspace * n)/2-(gridspace/2)+j*gridspace) + sin(k*0.0174) * 3.5, ( ((gridspace * n)/2-(gridspace/2) - (i*gridspace)) + cos(k*0.0174) * 3.5) ); } glEnd(); } else if (type[i*m+j]==4) { //'+' - display with a white cube glColor3f(0.9882f, 0.9882f, 0.9882f); glRectf((-(gridspace * n)/2-(gridspace/2)+j*gridspace) - 4, ( ((gridspace * n)/2-(gridspace/2) - i*gridspace) ) -4, (-(gridspace * n)/2-(gridspace/2)+j*gridspace) + 4, ( ((gridspace * n)/2-(gridspace/2) - i*gridspace) ) +4); glEnd(); } }//end of for j }//end of for i for (i=0; i<=n-1; i++) { for (j=1; j<=m; j++) { //Flow front display if (xseg[i*m+j] <= 0.999 && xseg[i*m+j] >= -0.01) { //xseg has a value if (type[i*m+j]==3 && (type[i*m+j+1]==1 || type[i*m+j+1]==0 || type[i*m+j+1]==2)) { //glBegin(GL_LINE_LOOP); glBegin(GL_TRIANGLE_FAN); glColor3f(0.000f, 0.000f, 1.000f); //Blue for (k=0; k<=360; k+=15) { glVertex2f( -(gridspace * n)/2-(gridspace/2)+(j+1)*gridspace - (gridspace*xseg[i*m+j]) + sin(k*0.0174) * 3.5, ((gridspace * n)/2 - (gridspace/2) - i*gridspace) + cos(k*0.0174) * 3.5); } glEnd(); } else if ((type[i*m+j]==1 || type[i*m+j]==0 || type[i*m+j]==2) && type[i*m+j+1]==3) { //glBegin(GL_LINE_LOOP); glBegin(GL_TRIANGLE_FAN); glColor3f(0.000f, 0.000f, 1.000f); //Blue for (k=0; k<=360; k+=15) { glVertex2f( -(gridspace * n)/2-(gridspace/2)+j*gridspace + (gridspace*xseg[i*m+j]) + sin(k*0.0174) * 3.5, ((gridspace * n)/2-(gridspace/2) - i*gridspace) + cos(k*0.0174) * 3.5); } glEnd(); } } }//end of for j }//end of for i for (i=0; i<=n-2; i++) { for (j=1; j<=m; j++) { if (yseg[i*m+j] <= 0.999 && yseg[i*m+j] >= -0.01) { //yseg has a value if (type[i*m+j]==3 && (type[i*m+j+m]==1 || type[i*m+j+m]==0 || type[i*m+j+m]==2)) { glBegin(GL_TRIANGLE_FAN); glColor3f(0.000f, 0.000f, 1.000f); //Blue for (k=0; k<=360; k+=15) { glVertex2f( (-(gridspace * n)/2-(gridspace/2)+j*gridspace) + sin(k*0.0174) * 3.5 , ((gridspace * n)/2-(gridspace/2) - (i+1)*gridspace) + (gridspace*yseg[i*m+j]) + cos(k*0.0174) * 3.5); } glEnd(); } else if ( (type[i*m+j]==1 || type[i*m+j]==0 || type[i*m+j]==2) && type[i*m+j+m]==3) { //glBegin(GL_LINE_LOOP); glBegin(GL_TRIANGLE_FAN); glColor3f(0.000f, 0.000f, 1.000f); //Blue for (k=0; k<=360; k+=15) { glVertex2f( (-(gridspace * n)/2-(gridspace/2)+j*gridspace) + sin(k*0.0174) * 3.5, ((gridspace * n)/2-(gridspace/2) - i*gridspace) - (gridspace * yseg[i*m+j]) + cos(k*0.0174) * 3.5); } glEnd(); } } } } if (NumFlag == true) { //Set up node number fonts int nodecount=0; for (y = (gridspace * n)/2-(gridspace/2); y >= - Gc; y -= gridspace) { for (x = - Gc ; x <= - Gc + gridspace*(m-1); x += gridspace) { nodecount += 1; glColor3f(1.0f, 1.0f, 1.0f); _snprintf(text_buffer, 40, "%d", nodecount ); render_text( x-2.5,y, text_buffer ); } } } if (LegendFlag == true) { int in, la, dv; glBegin(GL_LINES); glLineWidth(0.5); glColor3f(1.0f, 1.0f, 1.0f); for (la = 8; la <= 104; la += 8) { glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - la); glVertex2f(- Gc - 43, (gridspace * n)/2-(gridspace/2) - la); } glEnd(); in = inpres * 1000; for (dv = 12, la = 8; dv >= 0 && la <= 104; dv --, la += 8) { _snprintf(text_buffer, 40, "%d", in * dv/12); render_text( - Gc - 39, (gridspace * n)/2-(gridspace/2) - la, text_buffer ); } glBegin(GL_QUADS); glColor3f(1.000f, 0.000f, 0.000f); //Red glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 8); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 8); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 16); glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 16); glColor3f(1.000f, 0.500f, 0.000f); //Orange Red glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 16); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 16); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 24); glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 24); glColor3f(1.000f, 0.800f, 0.000f); //Coral glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 24); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 24); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 32); glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 32); glColor3f(1.000f, 1.000f, 0.000f); //Yellow glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 32); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 32); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 40); glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 40); glColor3f(0.800f, 0.900f, 0.000); //Medium Spring Green glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 40); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 40); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 48); glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 48); glColor3f(0.5f, 0.9f, 0.0f); //Green glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 48); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 48); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 56); glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 56); glColor3f(0.000f, 1.000f, 0.000f); //Lime Green glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 56); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 56); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 64); glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 64); glColor3f(0.000f, 1.000f, 0.498f); //Spring Green glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 64); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 64); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 72); glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 72); glColor3f(0.0f, 1.0f, 1.0f); //Aquamarine glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 72); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 72); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 80); glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 80); glColor3f(0.0f, 0.8f, 1.0f); //Medium Torquoise glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 80); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 80); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 88); glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 88); glColor3f(0.0f, 0.5000f, 1.000f); //Sky Blue glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 88); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 88); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 96); glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 96); glColor3f(0.000f, 0.000f, 1.000f); //Slate Blue glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 96); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 96); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 104); glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 104); glEnd(); } // Restore transformations glPopMatrix(); // Flush drawing commands glutSwapBuffers(); glutPostRedisplay(); //change buffer, 2 buffers enables smooth drawing in one go glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(eyeX,eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ); } void SetupRC(void) { // Black background glClearColor(0.0f, 0.0f, 0.0f, 1.0f ); }void ChangeSize(int w, int h) { GLfloat fAspect; // Prevent a divide by zero if(h == 0) h = 1; // Set Viewport to window dimensions glViewport(0, 0, w, h); fAspect = (GLfloat)w/(GLfloat)h; // Reset coordinate system glMatrixMode(GL_PROJECTION); glLoadIdentity(); // Produce the perspective projection gluPerspective(5.0f, fAspect, 1.0, 6000.0); }void OtherKeys(unsigned char key, int z, int a) { if(key == 't') { // 't' starts the flow during manual mode if (GeometryFlag==false) GeometryFlag=true; else if (GeometryFlag==true) GeometryFlag=false; } if (GeometryFlag==true) { front(); } if (SolutionFlag==true) { matcalc3(); SolutionFlag=false; } if(key == 'n') { // 'n' toggles the node number display on/off if (NumFlag==false) NumFlag=true; else if (NumFlag==true) NumFlag=false; } if(key == 'p') { // 'p' pauses the flow during auto mode cout << "Paused." << "\n"; system ("pause"); } if (key == 'l') { // 'l' toggles the legend displa on/off if (LegendFlag==false) LegendFlag=true; else if (LegendFlag==true) LegendFlag=false; } if (key == ']') { // ']' increases the time step during flow t += 1; } if (key == '[') { // ']' increases the time step during flow t -= 1; } if(key == 'q') { // 'q' zoodel_x in the view eyeZ += 25; } if(key == 'a') { // 'a' zoodel_x out the view eyeZ -= 25; } }void SpecialKeys(int key, int x, int y) { if(key == GLUT_KEY_UP) { //rotates about x xRot -= 5.0f; } if(key == GLUT_KEY_DOWN) { xRot += 5.0f; } if(key == GLUT_KEY_LEFT) { //rotates about y yRot -= 5.0f; } if(key == GLUT_KEY_RIGHT) { yRot += 5.0f; } if(key == GLUT_KEY_HOME) { //rotates about z zRot -= 5.0f; } if(key == GLUT_KEY_END) { zRot += 5.0f; } if(key == GLUT_KEY_PAGE_UP) { //pans along x-positive eyeX -= 5.0f; centerX -= 5.0f; } if(key == GLUT_KEY_INSERT) { //pans along x-negative eyeX += 5.0f; centerX += 5.0f; } if(zRot > 356.0f) zRot = 0.0f; if(zRot < -1.0f) zRot = 355.0f; if(xRot > 356.0f) xRot = 0.0f; if(xRot < -1.0f) xRot = 355.0f; if(yRot > 356.0f) yRot = 0.0f; if(yRot < -1.0f) yRot = 355.0f; }int main (int argc, char **argv){ //last = GetTickCount(); //Comment THIS out TO GO MANUAL/////////////////////////////////////////////////////////////////////////////////////////////////// cout << "Enter distance between the nodes (m): "; cin >> del_x; cout << "\n"; cout << "Enter time step (s): "; cin >> t; cout << "\n"; cout << "Enter viscosity of resin: "; cin >> visco; cout << "\n"; cout << "Enter porosity of fibre: "; cin >> poro; cout << "\n"; matcalc2(); //Draw after each time step glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(1152,864); glutCreateWindow("Simulation of VARTM Resin Impregnation Process"); glutReshapeFunc(ChangeSize); glutSpecialFunc(SpecialKeys); glutDisplayFunc(RenderScene); glutKeyboardFunc(OtherKeys); SetupRC(); glutMainLoop();}
[Edited by - pkiskool on March 10, 2009 1:46:57 PM]
You build your list before initializing GL. Put that snippet right before glutMainLoop().
Wait, it's not even there anymore! That can't help :)
Also, take advantage of that text function!
Ok, so you did!
Edit: No fair changing things when I'm not looking!
Wait, it's not even there anymore! That can't help :)
Also, take advantage of that text function!
//nevermind
Ok, so you did!
Edit: No fair changing things when I'm not looking!
Ooops I sourced the wrong code - that one is the version W/O the display list.
Here is the correct one.
This one does show me a few circles, but not every circle.
I have to look in further to see what is going on but mean while I guess you could have a look as well.
Cheers!
Here is the correct one.
//HEADER FILES#include "glut.h"#include <iostream>#include <iomanip>#include <fstream>#include <cstdlib>#include <cmath>#include <math.h>#include <string>#include <stdlib.h>#define TINY 1.0e-20;#define NRANSI#define GL_PI 3.1415f#include "nrutil.h" //NR#include "nrutil.cpp" //NR#include "ludcmp.h" //NR#include "lubksb.h" //NR#include "matcalc2.h" #include "matcalc3.h" #include "front.h"// Rotation amountsstatic GLdouble xRot = 0.0f;static GLdouble yRot = 0.0f;static GLdouble zRot = 0.0f;static GLdouble eyeX = 0.0f;static GLdouble eyeY = -1.0f;static GLdouble eyeZ = 2500.0f;static GLdouble centerX = 0.0f;static GLdouble centerY = 0.0f;static GLdouble centerZ = 0.0f;static GLdouble upX = 0.0f;static GLdouble upY = 0.0f;static GLdouble upZ = 1.0f;static GLdouble scale = 1.0f;bool GeometryFlag;bool ZoomInFlag;bool ZoomOutFlag;bool NumFlag;bool LegendFlag=true;int numb=0;GLdouble y, x; double gridspace = 12.0f;unsigned int now, last;// this can be a globalGLuint circle;#pragma warning( disable : 4996 )////////////////////////////////////////////// Text rendering function////////////////////////////////////////////void render_text(float x, float y, char* s){ glRasterPos2f(x,y); for ( unsigned int i=0; i < strlen( s ); i++ ) glutBitmapCharacter(GLUT_BITMAP_9_BY_15,s);}///////////////////////////////////////////////////////////// Setup the rendering state//////////////////////////////////////////////////////////// Called to draw scenevoid RenderScene(void) { /*now = GetTickCount(); //comment THIS (only // parts) out TO GO MANAUL//////////////////////////////////////////////////////////////////////////////// if (now-last>100){ //THE NUMBER HERE CONTROLS THE SPEED - 1000 IS 1 SECOND last = now; // front(); // if (SolutionFlag==true) {// matcalc3(); // SolutionFlag=false; // } // } //*/ int i, j; int Gc = gridspace*(n-1)/2, Gt = (gridspace * n)/2-(gridspace/2); double k; GLdouble fCurrSize; // Save current size // Clear the window with current clearing color glClear(GL_COLOR_BUFFER_BIT); // Save matrix state and do the rotation glPushMatrix(); glRotatef(xRot, 1.0f, 0.0f, 0.0f); glRotatef(yRot, 0.0f, 1.0f, 0.0f); glRotatef(zRot, 0.0f, 0.0f, 1.0f); char text_buffer[100]; // should be big enough _snprintf(text_buffer, 40, "FILL TIME %d SEC", filltime ); glColor3f(1.0f, 1.0f, 1.0f); render_text( 50-Gc, 5+Gc, text_buffer ); // Set up x lines for(y = - Gc; y <= (gridspace * n)/2-(gridspace/2); y += gridspace) { // Set the line width glLineWidth(2); // Draw the upper line glBegin(GL_LINES); glColor3f(0.1843f, 0.3098f, 0.1843f); glVertex3f( - Gc, y, 0); glVertex3f(- Gc + gridspace*(m-1), y, 0); // Draw the lower line glColor3f(0.1843f, 0.3098f, 0.1843f); glVertex3f( - Gc, y, - 5); glVertex3f(- Gc + gridspace*(m-1), y, - 5); } // Set up y lines for(x = - Gc; x <= - Gc + gridspace*(m-1); x += gridspace) { // Draw the upper line glColor3f(0.1843f, 0.3098f, 0.1843f); glVertex3f(x, - Gc, 0); glVertex3f(x, Gc, 0); // Draw the lower line glBegin(GL_LINES); glColor3f(0.1843f, 0.3098f, 0.1843f); glVertex3f(x, - Gc, -5); glVertex3f(x, Gc, -5); } //1D case if (n==1) { for(x = - Gc; x <= - Gc + gridspace*(m-1); x += gridspace) { // Set the line width // Draw the upper line glColor3f(0.1843f, 0.3098f, 0.1843f); glVertex3f(x, - ((gridspace * (n+1)*0.3)/2-(gridspace/2)), 0); glVertex3f(x, ((gridspace * (n+1)*0.3)/2-(gridspace/2)), 0); // Draw the lower line glColor3f(0.1843f, 0.3098f, 0.1843f); glVertex3f(x, - ((gridspace * (n+1)*0.3)/2-(gridspace/2)), -5); glVertex3f(x, ((gridspace * (n+1)*0.3)/2-(gridspace/2)), -5); } } // Set up z lines (4 corners) - thickness to the plate glColor3f(0.1843f, 0.3098f, 0.1843f); glVertex3f( - Gc, - Gc, 0); glVertex3f( - Gc, - Gc, -5); glColor3f(0.1843f, 0.3098f, 0.1843f); glVertex3f( - Gc, (gridspace * n)/2-(gridspace/2), 0); glVertex3f( - Gc, (gridspace * n)/2-(gridspace/2), -5); glColor3f(0.1843f, 0.3098f, 0.1843f); glVertex3f(- Gc + gridspace*(m-1), - Gc, 0); glVertex3f(- Gc + gridspace*(m-1), - Gc, -5); glColor3f(0.1843f, 0.3098f, 0.1843f); glVertex3f(- Gc + gridspace*(m-1), (gridspace * n)/2-(gridspace/2), 0); glVertex3f(- Gc + gridspace*(m-1), (gridspace * n)/2-(gridspace/2), -5); glEnd(); //Draw circle (last wetted node) for (i=0; i<=n-1; i++) { for (j=1; j<=m; j++) { if (type[i*m+j]==1) { //'o' - display with a hollow white circle /*glBegin(GL_LINE_LOOP); //De-bug mode for flow fronts glColor3f(0.000f, 0.000f, 1.000f); for (k=0; k<=360; k+=5) { glVertex2f( (-(gridspace * n)/2-(gridspace/2)+j*gridspace) + sin(k) * 3.5, ( ((gridspace * n)/2-(gridspace/2) - (i*gridspace)) + cos(k) * 3.5) ); }*/ glPushMatrix(); glTranslatef( (-(gridspace * n)/2-(gridspace/2)+j*gridspace), ((gridspace * n)/2-(gridspace/2) - (i*gridspace)),0 ); glColor3f(0.000f, 0.000f, 1.000f); glCallList( circle ); glPopMatrix(); } else if (type[i*m+j]==0) { //'i' - display with a red cube glPushMatrix(); glTranslatef( (-(gridspace * n)/2-(gridspace/2)+j*gridspace), ((gridspace * n)/2-(gridspace/2) - (i*gridspace)),0 ); glColor3f(1.0f, 0.0f, 0.0f); glCallList( circle ); glPopMatrix(); } else if (type[i*m+j]==2) { //'x' - display with a white filled circle glBegin(GL_TRIANGLE_FAN); //COLOR CODE if (pres[i*m+j] >= 0 && pres[i*m+j] < inpres*1000/12*1) glColor3f(0.000f, 0.000f, 1.000f); //Slate Blue if (pres[i*m+j] >= inpres*1000/12*1 && pres[i*m+j] < inpres*1000/12*2) glColor3f(0.000f, 0.5000f, 1.000f); //Sky Blue if (pres[i*m+j] >= inpres*1000/12*2 && pres[i*m+j] < inpres*1000/12*3) glColor3f(0.000f, 0.800f, 1.000f); //Medium Torquoise if (pres[i*m+j] >= inpres*1000/12*3 && pres[i*m+j] < inpres*1000/12*4) glColor3f(0.000f, 1.000f, 1.000f); //Aquamarine if (pres[i*m+j] >= inpres*1000/12*4 && pres[i*m+j] < inpres*1000/12*5) glColor3f(0.000f, 1.000f, 0.600f); //Spring Green if (pres[i*m+j] >= inpres*1000/12*5 && pres[i*m+j] < inpres*1000/12*6) glColor3f(0.000f, 1.000f, 0.000f); //Lime Green if (pres[i*m+j] >= inpres*1000/12*6 && pres[i*m+j] < inpres*1000/12*7) glColor3f(0.500f, 0.900f, 0.0f); //Green if (pres[i*m+j] >= inpres*1000/12*7 && pres[i*m+j] < inpres*1000/12*8) glColor3f(0.800f, 0.900f, 0.000f); //Medium Spring Green if (pres[i*m+j] >= inpres*1000/12*8 && pres[i*m+j] < inpres*1000/12*9) glColor3f(1.000f, 1.000f, 0.000f); if (pres[i*m+j] >= inpres*1000/12*9 && pres[i*m+j] < inpres*1000/12*10) glColor3f(1.000f, 0.800f, 0.000f); //Coral if (pres[i*m+j] >= inpres*1000/12*10 && pres[i*m+j] < inpres*1000/12*11) glColor3f(1.000f, 0.500f, 0.000f); if (pres[i*m+j] >= inpres*1000/12*11 && pres[i*m+j] < inpres*1000/12*12) glColor3f(1.0f, 0.0f, 0.0f); //changed to Red for (k=0; k<=360; k+=15) { glVertex2f( (-(gridspace * n)/2-(gridspace/2)+j*gridspace) + sin(k*0.0174) * 3.5, ( ((gridspace * n)/2-(gridspace/2) - (i*gridspace)) + cos(k*0.0174) * 3.5) ); } glEnd(); } else if (type[i*m+j]==4) { //'+' - display with a white cube glColor3f(0.9882f, 0.9882f, 0.9882f); glRectf((-(gridspace * n)/2-(gridspace/2)+j*gridspace) - 4, ( ((gridspace * n)/2-(gridspace/2) - i*gridspace) ) -4, (-(gridspace * n)/2-(gridspace/2)+j*gridspace) + 4, ( ((gridspace * n)/2-(gridspace/2) - i*gridspace) ) +4); glEnd(); } }//end of for j }//end of for i for (i=0; i<=n-1; i++) { for (j=1; j<=m; j++) { //Flow front display if (xseg[i*m+j] <= 0.999 && xseg[i*m+j] >= -0.01) { //xseg has a value if (type[i*m+j]==3 && (type[i*m+j+1]==1 || type[i*m+j+1]==0 || type[i*m+j+1]==2)) { glPushMatrix(); glTranslatef( -(gridspace * n)/2-(gridspace/2)+(j+1)*gridspace - (gridspace*xseg[i*m+j]), ((gridspace * n)/2 - (gridspace/2) - i*gridspace),0); glColor3f(0.000f, 0.000f, 1.000f); glCallList( circle ); glPopMatrix(); } else if ((type[i*m+j]==1 || type[i*m+j]==0 || type[i*m+j]==2) && type[i*m+j+1]==3) { glPushMatrix(); glTranslatef( -(gridspace * n)/2-(gridspace/2)+j*gridspace + (gridspace*xseg[i*m+j]) , ((gridspace * n)/2 - (gridspace/2) - i*gridspace),0); glColor3f(0.000f, 0.000f, 1.000f); glCallList( circle ); glPopMatrix(); } } }//end of for j }//end of for i for (i=0; i<=n-2; i++) { for (j=1; j<=m; j++) { if (yseg[i*m+j] <= 0.999 && yseg[i*m+j] >= -0.01) { //yseg has a value if (type[i*m+j]==3 && (type[i*m+j+m]==1 || type[i*m+j+m]==0 || type[i*m+j+m]==2)) { glPushMatrix(); glTranslatef( (-(gridspace * n)/2-(gridspace/2)+j*gridspace) , ((gridspace * n)/2-(gridspace/2) - (i+1)*gridspace) + (gridspace*yseg[i*m+j]),0); glColor3f(0.000f, 0.000f, 1.000f); glCallList( circle ); glPopMatrix(); } else if ( (type[i*m+j]==1 || type[i*m+j]==0 || type[i*m+j]==2) && type[i*m+j+m]==3) { glPushMatrix(); glTranslatef( (-(gridspace * n)/2-(gridspace/2)+j*gridspace) , ((gridspace * n)/2-(gridspace/2) - i*gridspace) - (gridspace * yseg[i*m+j]),0); glColor3f(0.000f, 0.000f, 1.000f); glCallList( circle ); glPopMatrix(); } } } } if (NumFlag == true) { //Set up node number fonts int nodecount=0; for (y = (gridspace * n)/2-(gridspace/2); y >= - Gc; y -= gridspace) { for (x = - Gc ; x <= - Gc + gridspace*(m-1); x += gridspace) { nodecount += 1; glColor3f(1.0f, 1.0f, 1.0f); _snprintf(text_buffer, 40, "%d", nodecount ); render_text( x-2.5,y, text_buffer ); } } } if (LegendFlag == true) { int in, la, dv; glBegin(GL_LINES); glLineWidth(0.5); glColor3f(1.0f, 1.0f, 1.0f); for (la = 8; la <= 104; la += 8) { glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - la); glVertex2f(- Gc - 43, (gridspace * n)/2-(gridspace/2) - la); } glEnd(); in = inpres * 1000; for (dv = 12, la = 8; dv >= 0 && la <= 104; dv --, la += 8) { _snprintf(text_buffer, 40, "%d", in * dv/12); render_text( - Gc - 39, (gridspace * n)/2-(gridspace/2) - la, text_buffer ); } glBegin(GL_QUADS); glColor3f(1.000f, 0.000f, 0.000f); //Red glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 8); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 8); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 16); glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 16); glColor3f(1.000f, 0.500f, 0.000f); //Orange Red glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 16); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 16); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 24); glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 24); glColor3f(1.000f, 0.800f, 0.000f); //Coral glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 24); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 24); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 32); glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 32); glColor3f(1.000f, 1.000f, 0.000f); //Yellow glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 32); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 32); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 40); glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 40); glColor3f(0.800f, 0.900f, 0.000); //Medium Spring Green glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 40); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 40); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 48); glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 48); glColor3f(0.5f, 0.9f, 0.0f); //Green glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 48); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 48); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 56); glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 56); glColor3f(0.000f, 1.000f, 0.000f); //Lime Green glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 56); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 56); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 64); glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 64); glColor3f(0.000f, 1.000f, 0.498f); //Spring Green glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 64); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 64); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 72); glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 72); glColor3f(0.0f, 1.0f, 1.0f); //Aquamarine glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 72); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 72); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 80); glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 80); glColor3f(0.0f, 0.8f, 1.0f); //Medium Torquoise glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 80); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 80); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 88); glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 88); glColor3f(0.0f, 0.5f, 1.0f); //Sky Blue glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 88); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 88); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 96); glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 96); glColor3f(0.0f, 0.0f, 1.0f); //Slate Blue glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 96); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 96); glVertex2f(- Gc - 45, (gridspace * n)/2-(gridspace/2) - 104); glVertex2f(- Gc - 50, (gridspace * n)/2-(gridspace/2) - 104); glEnd(); _snprintf(text_buffer, 40, "UNIT: Pa"); glColor3f(1.000f, 1.000f, 1.000f); render_text( - Gc - 50, (gridspace * n)/2-(gridspace/2) - 116, text_buffer ); } // Restore transformations glPopMatrix(); // Flush drawing commands glutSwapBuffers(); glutPostRedisplay(); //change buffer, 2 buffers enables smooth drawing in one go glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(eyeX,eyeY, eyeZ, centerX, centerY, centerZ, upX, upY, upZ); } void SetupRC(void) { // Black background glClearColor(0.0f, 0.0f, 0.0f, 1.0f ); }void ChangeSize(int w, int h) { GLfloat fAspect; // Prevent a divide by zero if(h == 0) h = 1; // Set Viewport to window dimensions glViewport(0, 0, w, h); fAspect = (GLfloat)w/(GLfloat)h; // Reset coordinate system glMatrixMode(GL_PROJECTION); glLoadIdentity(); // Produce the perspective projection gluPerspective(5.0f, fAspect, 1.0, 6000.0); }void OtherKeys(unsigned char key, int z, int a) { if(key == 't') { // 't' starts the flow during manual mode if (GeometryFlag==false) GeometryFlag=true; else if (GeometryFlag==true) GeometryFlag=false; } if (GeometryFlag==true) { front(); } if (SolutionFlag==true) { matcalc3(); SolutionFlag=false; } if(key == 'n') { // 'n' toggles the node number display on/off if (NumFlag==false) NumFlag=true; else if (NumFlag==true) NumFlag=false; } if(key == 'p') { // 'p' pauses the flow during auto mode cout << "Paused." << "\n"; system ("pause"); } if (key == 'l') { // 'l' toggles the legend displa on/off if (LegendFlag==false) LegendFlag=true; else if (LegendFlag==true) LegendFlag=false; } if (key == ']') { // ']' increases the time step during flow t += 1; } if (key == '[') { // ']' increases the time step during flow t -= 1; } if(key == 'q') { // 'q' zoodel_x in the view eyeZ += 25; } if(key == 'a') { // 'a' zoodel_x out the view eyeZ -= 25; } }void SpecialKeys(int key, int x, int y) { if(key == GLUT_KEY_UP) { //rotates about x xRot -= 5.0f; } if(key == GLUT_KEY_DOWN) { xRot += 5.0f; } if(key == GLUT_KEY_LEFT) { //rotates about y yRot -= 5.0f; } if(key == GLUT_KEY_RIGHT) { yRot += 5.0f; } if(key == GLUT_KEY_HOME) { //rotates about z zRot -= 5.0f; } if(key == GLUT_KEY_END) { zRot += 5.0f; } if(key == GLUT_KEY_PAGE_UP) { //pans along x-positive eyeX -= 5.0f; centerX -= 5.0f; } if(key == GLUT_KEY_INSERT) { //pans along x-negative eyeX += 5.0f; centerX += 5.0f; } if(zRot > 356.0f) zRot = 0.0f; if(zRot < -1.0f) zRot = 355.0f; if(xRot > 356.0f) xRot = 0.0f; if(xRot < -1.0f) xRot = 355.0f; if(yRot > 356.0f) yRot = 0.0f; if(yRot < -1.0f) yRot = 355.0f; }int main (int argc, char **argv){ //last = GetTickCount(); //Comment THIS out TO GO MANUAL/////////////////////////////////////////////////////////////////////////////////////////////////// int k; cout << "Enter distance between the nodes (m): "; cin >> del_x; cout << "\n"; cout << "Enter time step (s): "; cin >> t; cout << "\n"; cout << "Enter viscosity of resin: "; cin >> visco; cout << "\n"; cout << "Enter porosity of fibre: "; cin >> poro; cout << "\n"; matcalc2(); // This section gets run once, before you ever render // Tells GL we are creating a new list glNewList( circle, GL_COMPILE ); glBegin(GL_TRIANGLE_FAN); for (k=0; k<=360; k+=15) glVertex2f( sin(k*0.0174) * 3.5, cos(k*0.0174) * 3.5 ); glEnd(); glEndList(); glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(1152,864); glutCreateWindow("Simulation of VARTM Resin Impregnation Process"); glutReshapeFunc(ChangeSize); glutSpecialFunc(SpecialKeys); glutDisplayFunc(RenderScene); glutKeyboardFunc(OtherKeys); SetupRC(); glutMainLoop();}
This one does show me a few circles, but not every circle.
I have to look in further to see what is going on but mean while I guess you could have a look as well.
Cheers!
OK - so the reason why there's only a few circles showing, is because I forgot to edit one of the section (GL_TRIANGLE_FAN is still being used there).
So when I update that part with display list, there is essentially no circles.
Only lines and text are rendered - and the rendering is done only once.
Initially, when I press 't', this would trigger the timer and I was able to see the flow. But pressing 't' now doesn't do anything - the timer stays still.
So when I update that part with display list, there is essentially no circles.
Only lines and text are rendered - and the rendering is done only once.
Initially, when I press 't', this would trigger the timer and I was able to see the flow. But pressing 't' now doesn't do anything - the timer stays still.
Quote:Original post by pkiskool
OK - so the reason why there's only a few circles showing, is because I forgot to edit one of the section (GL_TRIANGLE_FAN is still being used there).
So when I update that part with display list, there is essentially no circles.
Only lines and text are rendered - and the rendering is done only once.
Initially, when I press 't', this would trigger the timer and I was able to see the flow. But pressing 't' now doesn't do anything - the timer stays still.
It's hard to tell from what I can see, but it looks like GeometryFlag is related to front(), and the only call to it in the render function is commented out. What is front()?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement