Beispiel #1
0
void
main() 
{

/* Setup GL environment */
(void)GLenvsetup();


(void)GLinit();
rept_mode=SUMMARY;

/* Detail Record Processing */
while ( (jefld_ptr=GLjegetnxt(line)) != NULL) {

	(void)GLheadchk();

	if (GLctrlbrk(jefld_ptr) == JETRUE) {
		(void)GLsubtotals(jefld_ptr);
	}

	(void)GLdtl(jefld_ptr);
}

(void) GLfinals();

(void)GLinit();
rept_mode=DETAILED;

/* Detail Record Processing */
while ( (jefld_ptr=GLjegetnxt(line)) != NULL) {

	(void)GLheadchk();

	if (GLctrlbrk(jefld_ptr) == JETRUE) {
		(void)GLsubtotals(jefld_ptr);

		(void)GLheadchk();

		(void)GLnewheads();
	}

	(void)GLdtl(jefld_ptr);
}

(void) GLfinals();

/* Restore working directory */
chdir(cwdstr);

} /* end of main */
Beispiel #2
0
int
JMglrpt(void)
{

(void)GLinit();

/* Detail Record Processing */
while ( (jefld_ptr=GLjegetnxt(line)) != NULL) {

	(void)GLheadchk();

	if (GLctrlbrk(jefld_ptr) == JETRUE) {
		(void)GLsubtotals(jefld_ptr);

		(void)GLheadchk();

		(void)GLnewheads();
	}
	
	(void)GLprtdtl(jefld_ptr);
}

(void) GLfinals();

return (JESUCCESS);
} /* end of main */
Beispiel #3
0
int main()
{
    int x,y,z;
    GLinit();

    GLsetdisplay(1024,768,8,0);
	glTranslatef( 0.0, 0.0, -25.0);

    while( 0==0 ) {
		ProcessEvents();
		glColor3d(255,0,0);
		glBegin(GL_LINES);
		for (z=-10;z<11;z++){
		    glVertex3f(-10,z,-10);
		    glVertex3f(10,z,-10);
		}

		for (x=-10;x<11;x++){
			glVertex3f(x,10,-10);
			glVertex3f(x,-10,-10);
		}
		glEnd();


		glRotatef(0.1,0,1,0);


		GLscreenswap();
    }
    GLterminate();
    return 0;
}
Beispiel #4
0
void
main()
{

/* Setup GL environment */
(void)GLenvsetup();

/* Open new00 file */
(void)GLclsu();

(void)GLinit();

/* Detail Record Processing */
while ( (jefld_ptr=GLjegetnxt(line)) != NULL) {

	if (GLctrlbrk(jefld_ptr) == JETRUE)
		(void)GLsubtotals(jefld_ptr);

	(void)GLdtl(jefld_ptr);
}

(void) GLfinals();

/* close new00 */
if (fclose(new00_fp) == EOF)
	perror("could not close new00");



/* Restore working directory */
chdir(cwdstr);

} /* end of main */
Beispiel #5
0
int main(int argc,char ** argv)
{
    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    glutInitWindowSize(400,400);
    glutInitWindowPosition(200,200);
    glutCreateWindow("   Nfcj - OpenGl");
    GLinit();
    glutDisplayFunc(GLdis);
    glutReshapeFunc(GLres);
    glutMainLoop();
    return 0;
}
int main(int argc, char* argv[]) {
  if(argc < 5) {
    std::cout << "Usage: " << argv[0] << " originalMeshOBJ flattenedMeshOBJ textureImage flattenedImage" << std::endl;
    return EXIT_FAILURE;
  }
  char* originalMeshName = argv[1];
  char* flattenedMeshName = argv[2];
  char* textureImageName = argv[3];
  char* flattenedImageName = argv[4];

  cv::Mat textureImage = cv::imread(textureImageName);
  int width, height;
  width = textureImage.cols;
  height = textureImage.rows;
  textureImage.release();
  // std::cout << "Width: " << width << std::endl
  // 	    << "Height: " << height << std::endl;
  
  GLFWwindow* window;
  GLinit(&window, width, height);

  // int maxSize;
  // const GLubyte* version;
  // glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxSize);
  // std::cout << "Max texture size: " << maxSize << std::endl;
  // version = glGetString(GL_VERSION);
  // std::cout << "Version: " << version << std::endl;

  // Create Vertex Array Object
  GLuint vao;
  glGenVertexArrays(1, &vao);
  glBindVertexArray(vao);

  // Create a Vertex Buffer Object and copy the vertex data to it
  GLuint vbo;
  glGenBuffers(1, &vbo);

  GLfloat vertices[] = {
    // coord, color, texcoord
    -1.0f,  1.0f, 0.0f, 0.0f, // Top-left
    1.0f,  1.0f, 1.0f, 0.0f, // Top-right
    1.0f, -1.0f, 1.0f, 1.0f, // Bottom-right
    -1.0f, -1.0f, 0.0f, 1.0f  // Bottom-left
  };

  glBindBuffer(GL_ARRAY_BUFFER, vbo);
  glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);

  GLuint ebo;
  glGenBuffers(1, &ebo);

  GLuint elements[] = {
    0, 1, 2,
    2, 3, 0
  };

  glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo);
  glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(elements), elements, GL_STATIC_DRAW);

  GLuint frameBuffer;
  glGenFramebuffers(1, &frameBuffer);

  glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer);

  GLuint texColorBuffer;
  glGenTextures(1, &texColorBuffer);
  glBindTexture(GL_TEXTURE_2D, texColorBuffer);

  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);

  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

  glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texColorBuffer, 0);

  GLuint vertexShader, fragmentShader, shaderProgram;
  createShaderProgram(vertexSource, fragmentSource, vertexShader, fragmentShader, shaderProgram);

  specifyScreenVertexAttributes(shaderProgram);

  cv::Mat img;
  img.create(height, width, CV_8UC3);

    GLuint red, blue, green;
    loadTextures(textureImageName, red, blue, green);

    // Set texture background color
    // float color[] = { 1.0f, 0.0f, 0.0f, 1.0f };
    // glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, color);

    // Clear the screen to black
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT);

    // Draw
    glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);  

    glTexToCVmat(img, width, height);

    // glDeleteTextures(1, &tex);

  cv::imwrite(flattenedImageName, img);

  // Swap buffers
  glfwSwapBuffers(window);

  glDeleteProgram(shaderProgram);
  glDeleteShader(fragmentShader);
  glDeleteShader(vertexShader);

  glDeleteBuffers(1, &ebo);
  glDeleteBuffers(1, &vbo);
  glDeleteVertexArrays(1, &vao);

  glDeleteFramebuffers(1, &frameBuffer);

  glfwTerminate();

  return 0;
}