Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: OpenGL 3.x cube problem

  1. #1

    OpenGL 3.x cube problem

    System: Vista/WindowsXP
    Compiler/IDE: Delphi2009
    Libraries: OpenGL 3.x
    Technique: Rendering Cube / Vector & Matrix Math / Conversion from cpp

    Next in my opengl3.x adventures is trying to display a cube, but i must be doing something wrong.

    The original is available from: http://nopper.tv/opengl_3_2.html (example03)

    This is my attempt: http://www.noeska.net/downloads/Ogl3Cube1.zip .

    Who can help me to find out what i do wrong. Also i found the original not to be logic as in the render part i do not see references as to what is rendered?
    http://3das.noeska.com - create adventure games without programming

  2. #2

    Re: OpenGL 3.x cube problem

    Try altering the attach function to this:
    Code:
    procedure TGLSLProgram.Attach(ashader: TShader);
    begin
     inherited Attach(ashader);
     ashader.Compile();
     writeln(ashader.log);
     glAttachObjectARB(FProgramObject, ashader.FShaderObject);
     glDeleteObjectARB(ashader.FShaderObject);
    end;
    At least on my computer with a fairly new card I get "error C0201: unsupported version 150"
    Peregrinus, expectavi pedes meos in cymbalis
    Nullus norvegicorum sole urinat

  3. #3

    Re: OpenGL 3.x cube problem

    On my pc with latest ati drivers i get the following from the log:
    18:11:59 Vertex shader was successfully compiled to run on hardware.
    18:11:59 Fragment shader was successfully compiled to run on hardware. WARNING: 0:3: warning(#239) Declaration should include a precision qualifier or the default precision should have been previously declared
    18:11:59 Fragment shader(s) linked, vertex shader(s) linked. WARNING: 0:3: warning(#239) Declaration should include a precision qualifier or the default precision should have been previously declared

    I also tried lowering the version in the shaders but no cube visible yet ... But then again the cpp original also shows a black screen on my pc...
    http://3das.noeska.com - create adventure games without programming

  4. #4

    Re: OpenGL 3.x cube problem

    The results from:
    Code:
     // http://www.opengl.org/sdk/docs/man/x...rmLocation.xml
     g_projectionLocation := glslsimpleprog.GetUniformLocation('projectionMatrix');
    
     // http://www.opengl.org/sdk/docs/man/x...rmLocation.xml
     g_modelViewLocation := glslsimpleprog.GetUniformLocation('modelViewMatrix');
    
     // http://www.opengl.org/sdk/docs/man/x...ibLocation.xml
     g_vertexLocation := glslsimpleprog.GetAttribLocation('vertex');
    
     // http://www.opengl.org/sdk/docs/man/x...ibLocation.xml
     g_normalLocation := glslsimpleprog.GetAttribLocation('normal');
    are:
    19:36:58 1
    19:36:58 0
    19:36:58 -1
    19:36:58 -1

    Now the -1 does not look correct ...
    http://3das.noeska.com - create adventure games without programming

  5. #5

    Re: OpenGL 3.x cube problem

    He Noeska,

    Cool to see that you are getting into OpenGL 3.x. I have been working with it for a few months now. I spotted two errors in your program.

    First check the glGetAttribLocation defenition in the dgl header. It takes a string while it should take a PGLChar. Then these lines will return good indices:

    // http://www.opengl.org/sdk/docs/man/x...ibLocation.xml
    g_vertexLocation := glslsimpleprog.GetAttribLocation('vertex');

    // http://www.opengl.org/sdk/docs/man/x...ibLocation.xml
    g_normalLocation := glslsimpleprog.GetAttribLocation('normal');

    Second look into vertex array objects. These are required to when using VBO`s in OGL 3.x. You seem to be using them in your first tutorial.
    http://www.opengl.org/wiki/Vertex_Array_Objects

    The examples you are using arent proper OGL 3.x. They might work on nvidia because they usually permit more errors but these demo`s wont work on ati.

    Also I see you are using OGL 3.2. Make sure when using ATI you use the latest catalyst 9.12 drivers. These is the first version that supports 3.2 properly.

    If you still have problems pm me. I can send you the code of my new framework that works on ati and nvidia correctly.

    Regards,

    Luuk

  6. #6

    Re: OpenGL 3.x cube problem

    I filed a bugreport on the dglopengl header using string instead of pglchar.
    With a quick change on the local copy of it i now get correct answers 1 and 0.

    With the c source not using vertex array object i asumed that to be optional, so tomorow i do a rewrite including them also.

    But should not opengl 3.x work the same regardless of your videocard being ati or nvidia? I do not want seperate code paths.
    http://3das.noeska.com - create adventure games without programming

  7. #7

    Re: OpenGL 3.x cube problem

    If you stick to the base that should be the case but like i said before the code c code you use isnt correct OGL 3.x code

  8. #8

    Re: OpenGL 3.x cube problem

    On the opengl site they are presented as opengl 3.2 example code ;-)
    So this is going to be more a challenge then i expected it to be.
    Do you have some pointers to proper documentation / examples?

    Also adding a vao does not help :-(

    Here is my new sourcecode: http://www.noeska.net/downloads/Ogl3Cube2.zip
    http://3das.noeska.com - create adventure games without programming

  9. #9

    Re: OpenGL 3.x cube problem

    He noeska,

    Here are some examples which I found verry usefull:

    http://www.g-truc.net/post-0233.html

    Also I`m currently working on my website and my OGL3.2 framework should be on svn somewhere next week.

    Luuk

  10. #10

    Re: OpenGL 3.x cube problem

    Found some bugs in passing the arrays trough the calculations. Fixed that.
    But still no cube :-(

    Latest version:
    http://www.noeska.net/downloads/Ogl3Cube3.zip
    http://3das.noeska.com - create adventure games without programming

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •