Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About Wizumwalt_

  • Rank
  1. Wizumwalt_

    need highlighting tips

    Ah, sorry, maybe I didn't give enough details. This is sort of a CAD like program I am writing which must show the model using a wire mesh so that people can pick out elements of the mesh to work with. What I want to do is make a single element of the mesh visually stand out when the mouse hovers over it, and instead of just change the colors of the wire (which looks cheap), I want to make it look nicer. So I can't change the fact that I'm displaying a wire mesh, but I do want to do something to that single element, fill it, make it glow, I'm looking for something cool.
  2. Wizumwalt_

    need highlighting tips

    I'm was wondering if there was a nice way to highlight a section of mesh besides the way I'm doing it now which is, when the mouse hovers over a mesh surface on my model, all I do is change the color of the wire for that section of mesh. I'm looking for something a bit fancier, nicer? A thicker glow maybe or just something cool, not so cheap looking. Anyone have ideas along w/ links or other info that would help me be able to do it.
  3. Wizumwalt_

    how to scale proportionately

    Quote:Original post by Zahlman Given the current x and y, and the window x and y: What do you mean by 'current x and y'? Certainly not the current mouse coords, right? Window x and y are gl canvas width and height?
  4. Wizumwalt_

    how to scale proportionately

    Ok, I see that now. I have X and Y equal and it scales proportionately, but I have left Z as zero so that my model does not get clipped on the near and far planes if it were to scale in and out. What I'm now trying to figure out is how to adjust the initial model size to fit the window once it's loaded. I have the window height and width from my reshape() method and in my display method I have the min and max width and height of the model, so now I'm just trying to figure out what the algorithm would be to set x and y in my glScale(x, y, 0.0) method when the model is initially loaded so that it fits the window. Do I take the width of the model and multiply it by some fraction of the window width? (I tried but then my proportions got all out of whack).
  5. How is a model scaled proportionaltely if the width of the window is wider than the height. In other words, if the model is 200 wide by 100 high and my window is say 600 x 400, and I decrement by 1 as I scale down the model, the model's x and y will soon be 100 wide and 0 high as I scale down making it terribly out of proportion. When I use keys to zoom in or out (scale), I increment or decrement to the x and y vars, but my model is just not staying in proportion as it changes size (note: the window is not chaning size, just the model). glScalef(x, y, 0.0f); Any help much appreciated.
  6. Wizumwalt_

    near and far planes

    Turns out I wasn't using the perspective matrix, I was still using the modelview matrix. Now I can manipulate it again. I don't understand it, but it works now. I was using code from examples I found in the red book.
  7. Wizumwalt_

    reset the viewing volume

    Is it good practice to use glOrtho from my display() method rather than my redisplay() because my problem is that I don't know the size of the model till it's loaded. I've been working w/ a model I already know the size of. It works like this. 1. Empty canvas initializes (redisplay() sets size of new window frame and viewing volume). 2. User loads a model. 3. I calculate the size of the model (i.e. min/max x, y, z, centroid, etc...) 4. Now I need to reset glOrtho's viewing volume according to model and not the one I just used to initialize my canvas w/ in the redisplay method. What method is that done with, or is it ok to call glOrtho again?
  8. Wizumwalt_

    near and far planes

    Quote:Original post by Kalasjniekof Try scaling the model down. ;) I can scale, but because my near and far planes are so out of whack, doesn't matter what I scale too, it's being clipped. I was mainly wondering if it was ok to use glFrustrum or gluPerspective w/ an orthographic projection.
  9. Wizumwalt_

    near and far planes

    Yep, orthographic is what I wanted and as you can see by my mention of the redbook, I did read that part. That's what I'm referring to. I already know how big my model is and it should fit within the near and far plane values that I have given it. I did that when getting my centroid. And when I use glOrtho, no matter what values I give the near and far plane, my model gets cliipped all the same.
  10. Wizumwalt_

    near and far planes

    I'm trying to set the near and far planes according to what model I render and I'm not sure how because this is an orthographic projection. I'm doing this using JOGL (Java API) and I was looking at glFrustrum and gluPerspective and if I understand all this correctly, it seems to be for perspective projections which is all the red book talks about in this context. My problem is that my models are being clipped either on the near or far planes and I'm trying to get them in my viewing volume correctly. Can I use these functions for orthographic projections? Any help much appreciated.
  11. Wizumwalt_

    model clipped wrongly

    Um, I don't know, could it? I don't think so. But I would like to know how to move 'just' the far and near planes around.
  12. Wizumwalt_

    model clipped wrongly

    I'm trying to get my camera positioned correctly on a finite 3d orthographic model I have. My models farthest point on the Z axis is -1.200000048 The models nearest point on the Z axis is 0.4825999737 My Z axis centroid point is -0.5024517178535461 My problem is that if I multiply the nearest Z point by 2 and place my camera on that z point (if I understand coorectly, then this should move the camera further away from the model so I can see all of it) by using the following java gluLookAt line ... glu.gluLookAt(centroid.getX() + xTrans, centroid.getY() + yTrans, centroid.getZ() + zTrans + (centroid.getMax_Z() * 2), centroid.getX() + xTrans, centroid.getY() + yTrans, centroid.getZ(), 0.0, 1.0, 0.0); ... then my model gets clipped from what looks to be the z-axis centroid and everything on back when I rotate it. Anyone have ideas on what is going on? I can't understand why it clips the back half of my model when I do this.
  13. Wizumwalt_

    getting absolute value

    I'm trying to adjust my camera and I have the z axis centroid which is sometimes a negative number and other times not. Since this function will be in my display() function, it gets called alot and I'm trying to figure out what the most efficient way is to get the absolute value of my smallest Z axis value (which can be pos or neg) so that I can multiply it by 2 and place my camera in that Z axis position away from my model (which should always be positive IIUC). I hope I'm on the right track as to how placing the camera should be done.
  14. Wizumwalt_

    how to set centroid

    Original post by FlyingDemon Quote: Also why are you doing two translations by xTrans, yTrans and zTrans? Should be something like this... gl.glScalef(xScale, yScale, zScale); gl.glTranslatef(xTrans, yTrans, zTrans); gl.glTranslatef((-1.0f * (float)centroid.getX()), (-1.0f * (float)centroid.getY()), (-1.0f * (float)centroid.getZ())); gl.glRotatef(xRot, 1.0f, 0.0f, 0.0f); gl.glRotatef(yRot, 0.0f, 1.0f, 0.0f); gl.glRotatef(zRot, 0.0f, 0.0f, 1.0f); This is all, ofourse, assuming that you have the centroid in object local space and not world space. Aside from the additional glTranslatef() which was a mistake on my part, I've got exactly that (and tried more combinations) other than that ... and it seems to make good logical since to me. But it's still not rotating correctly. I even rendered the centroid with a large point by making PointSize(10.0f) to test if I really had the right centroid and it shows up right in the center of my model, but the translation is not making the model rotate around the centroid. I think the negative translation is not correct somehow, I mean, I'm missing something more.
  15. Wizumwalt_

    how to set centroid

    Quote: Thats because when you rotate it, you are doing so around its relative v(0,0,0) and not the centroid. I think you have to translate again by its negative centroid, then rotate. Ok, I thought gluLookAt would move the camera to look at the centroid, but now I understand it's the model that has to move to the centroid so that I can rotate around it's center and not the current v(0, 0, 0) ... below is the order in which I'm doing my model tranformation, I scale, then translate, then rotate. So my problem is I still can't get the model to rotate around the centroid. I thought doing the negative translation for the centroid coordinates after I translated my model would do it but still not working. Anyone have any ideas what I'm doing wrong? --- public void display(GLDrawable drawable) { gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); gl.glColor3f(1.0f, 1.0f, 1.0f); gl.glMatrixMode(GL.GL_MODELVIEW); gl.glLoadIdentity(); //glu.gluLookAt(0.0, 0.0, 0.0, 0.0, 0.0, -100.0, 0.0, 1.0, 0.0); glu.gluLookAt(0.0, 0.0, 0.0 + centroid.getMaxRadius_Z(), centroid.getX(), centroid.getY(), centroid.getZ() + (centroid.getMaxRadius_Z() * 3), 0.0, 1.0, 0.0); // modeling transformation gl.glScalef(xScale, yScale, zScale); gl.glTranslatef(xTrans, yTrans, zTrans); // I multiplied by a -1 to move it to the centroid. gl.glTranslatef((-1.0f * (float)centroid.getX()), (-1.0f * (float)centroid.getY()), (-1.0f * (float)centroid.getZ())); gl.glTranslatef(xTrans, yTrans, zTrans); gl.glRotatef(xRot, 1.0f, 0.0f, 0.0f); gl.glRotatef(yRot, 0.0f, 1.0f, 0.0f); gl.glRotatef(zRot, 0.0f, 0.0f, 1.0f); gl.glEnable(GL.GL_BLEND); gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); model.draw(active_id); gl.glDisable(GL.GL_BLEND); gl.glFlush(); ...
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!