Results 1 to 2 of 2

Thread: load code after converting figure

  1. #1
    Member Newbie
    Join Date
    May 2001
    bogota, colombia

    load code after converting figure


    I have changed a figure I had in .x to code in .cpp, with the help of "3D Exploration Plugin: CPP Export filter." What is the best way to insert this code in my OpenGL App?

    I donīt get what I wiil do with "sample_MATERIAL materials" & "face_indicies[8416][9]".

    my code:
    This file was produced by 3D Exploration plugin: CPP Export filter.
    3D Exploration, Copyright (c) 1999-2000 X Dimension Software, WWW
    #include <windows.h>
    #include <GL\gl.h>
    #include <GL\glu.h>
    struct sample_MATERIAL{
    GLfloat ambient[3];
    GLfloat diffuse[3];
    GLfloat specular[3];
    GLfloat emission[3];
    GLfloat alpha;
    GLfloat phExp;
    int texture;
    static sample_MATERIAL materials [1] = {
    {{0.0f,0.0f,0.0f},{0.956863f,0.576471f,0.576471f}, {0.898039f,0.898039f,0.898039f},{0.0f,0.0f,0.0f},
    0.25f,23.0f,-1} //Material #1

    // 4593 Verticies
    // 0 Texture Coordinates
    // 4964 Normals
    // 8416 Triangles

    static short face_indicies[8416][9] = {
    // Object #0
    {333,335,334 ,0,1,2 ,0,0,0}, {336,337,333 ,3,4,0 ,0,0,0}, {338,340,339 ,5,6,7 ,0,0,0},
    {341,340,342 ,8,6,9 ,0,0,0}, {343,344,342 ,10,11,9 ,0,0,0}, {345,344,346 ,12,11,13 ,0,0,0},
    {346,348,347 ,13,14,15 ,0,0,0}, {349,350,348 ,16,17,14 ,0,0,0},

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Fargo, ND

    Re: load code after converting figure

    You'll use the stuff in materials in the glMaterial function and the indices array will tell you the indices of the vertices, normals, and texcoord arrays that you need to use for each face.

    It looks like for each set of 9 numbers you probably have 3 coordinates for the vertex, 3 for the normal, then 3 more (prossibly 2 for texcoord and 1 for material index?)
    *edit* Not sure what I was thinking before, those last 3 are probably all indices to texcoords, which don't exist in this case so they are all set to 0. *end edit*

    If I'm interpretting things coorectly, for drawing face1 you should draw face0 of object0 by doing something like...

    // you've only got one material so you should really only do this line once.




    Hope that makes sense.

    *added stuff*
    Just thought I'd clarify the pseudocode a bit, as I'm not sure how clear it was after reading it over again today. The DrawVertex function would probably look something like this, where vertices represents a global array with all your vertex data...

    void DrawVertex(int nIndex)

    Hope that helps.

    [This message has been edited by Deiussum (edited 05-30-2001).]
    Software Engineer and OpenGL enthusiast

Similar Threads

  1. Converting rotation code to GLM
    By imported_paul_g_griffiths in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 01-21-2017, 09:36 AM
  2. Problem with converting my code from C to C++
    By Dan_182 in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 10-31-2013, 06:36 PM
  3. noob cannot figure out what is wrong - code crash.
    By newsb in forum OpenGL: Basic Coding
    Replies: 14
    Last Post: 01-23-2012, 05:02 AM
  4. Converting code from Linux to Windows
    By pvncheck in forum OpenGL: Windows
    Replies: 5
    Last Post: 05-17-2011, 08:13 AM
  5. converting glut code to plain windows ogl code
    By TheLastMohican in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 03-10-2003, 09:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean