Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I've noticed a few things, particularly with how you set up the projection matrix. For starters, gluProject doesn't return a value, unless you're using some kind of wrapper or weird api. gluLookAt is used more often. </p> <p>Next, assuming the scale, rotate, and translate functions are intended to change the modelview matrix, you need to reverse their order. OpenGL doesn't actually move objects around; instead it effectively moves the origin around, and renders each object using the new definition of &lt;0,0,0>. Thus you 'move' to where you want it to render, then you rotate the axes as needed, then you stretch out the grid.</p> <p>As for the clipping problem, you may want to give <a href="http://pyopengl.sourceforge.net/documentation/manual/glClipPlane.3G.xml" rel="nofollow">glClipPlane()</a> a good look over. If everything else <em>mostly</em> works, but there seems to be some rounding error, try changing the near clipping plane in your perspective(,,,) function from 0.1 to 1.0 (smaller values tend to mess with the z-buffer).</p> <p>I see a lot of unfamiliar syntax, so I think you're using some kind of wrapper; but here are some (Qt) code fragments from my own GL project that I use. Might help, dunno:</p> <pre><code>//This gets called during resize, as well as once during initialization void GLWidget::resizeGL(int width, int height) { int side = qMin(width, height); padX = (width-side)/2.0; padY = (height-side)/2.0; glViewport(padX, padY, side, side); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(60.0, 1.0, 1.0, 2400.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); } //This fragment gets called at the top of every paint event: glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); glLightfv(GL_LIGHT0, GL_POSITION, FV0001); camMain.stepVars(); gluLookAt(camMain.Pos[0],camMain.Pos[1],camMain.Pos[2], camMain.Aim[0],camMain.Aim[1],camMain.Aim[2], 0.0,1.0,0.0); glPolygonMode(GL_FRONT_AND_BACK, drawMode); //And this fragment represents a typical draw event void GLWidget::drawFleet(tFleet* tIn) { if (tIn-&gt;firstShip != 0){ glPushMatrix(); glTranslatef(tIn-&gt;Pos[0], tIn-&gt;Pos[1], tIn-&gt;Pos[2]); glRotatef(tIn-&gt;Yaw, 0.0, 1.0, 0.0); glRotatef(tIn-&gt;Pitch,0,0,1); drawShip(tIn-&gt;firstShip); glPopMatrix(); } } </code></pre> <p>I'm working on the assumption that you're newish to GL, so my apologies if I come off as a little pedantic.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload