Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - wruiwr

#1
Hi EgonOlsen!

Thank you for your reply!
But, where should I call resize(), and how to set the width and height according the change of the window? Besides, it's software rendering, so is it possible to use it?
#2
Support / a question about "Using jPCT in Swing" in wiki
September 19, 2014, 04:09:32 PM
Hi,

I tried the example in "Using jPCT in Swing", and I have a question that after I dragged the edge of the window, the window became bigger, but the 3D world rendered did not change its size with the window. So, I wonder how to make the size of the rendered 3D world to change with the window, when dragging the edge of the window. Dose anyone know about some solution about this?
#3
Wow, right, I got it. Thank you! Now they are shown on the same screen ;D Another thing I was wondering now is to use applet and software rendering to implement Anaglyph 3d, any idea about how to do this?  :)

[attachment deleted by admin]
#4
I set to sleep longer, so I can see, firstly, the red cone was shown up once on the left side and disappeared, then the cyan one was shown up on the right side once and disappeared, then red one again, so I can not get both red one and cyan one on the screen at the same time. Therefore, I attached two photos...
The tested code is simple as below:

import com.threed.jpct._
import org.lwjgl.opengl.GL11

class HelloWorld {
  var world:World = null
  var cameraLeft:Camera = null
  var cameraRight:Camera = null
  var cone:Object3D = null

  def AnaglyphExample = {

    world = new World

    val tm: TextureManager = TextureManager.getInstance()
    tm.addTexture("Cone", new Texture("textures/jplogo.jpg"))

    cone = Primitives.getCone(32,1f)
    cone.setTexture("Cone")
    cone.setEnvmapped(Object3D.ENVMAP_ENABLED)
    cone.build()

    world.addObject(cone)

    val buffer = new FrameBuffer(800, 600,    FrameBuffer.SAMPLINGMODE_NORMAL)
    buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE)
    buffer.enableRenderer(IRenderer.RENDERER_OPENGL)

    while (!org.lwjgl.opengl.Display.isCloseRequested) {

      buffer.clear()
      cameraLeft = world.getCamera
      cameraLeft.setPosition(0.2f, -0f, -10f)
      GL11.glColorMask(true,false,false,true)
      world.renderScene(buffer)
      world.draw(buffer)
      buffer.update()
      buffer.displayGLOnly()
      Thread.sleep(1000)
      buffer.clearZBufferOnly()
      cameraRight = world.getCamera
      cameraRight.setPosition(-0.2f,-0f,-10f)
      GL11.glColorMask(false,true,true,true)
      world.renderScene(buffer)
      world.draw(buffer)
      buffer.update()
      buffer.displayGLOnly()
      Thread.sleep(1000)
    }

    buffer.disableRenderer(IRenderer.RENDERER_OPENGL)
    buffer.dispose()
    System.exit(0)
  }
}

  object HelloWorld{
    def main (args: Array[String]) {
      val app = new HelloWorld
      app.AnaglyphExample
    }
  }




[attachment deleted by admin]
#5
Thanks for your reply!!!
I tried the code below, and I can see red and cyan Cone now, but a problem is the red one is show on the left first and then cyan on the right, such as blinking. Is it because the camera setting problems or others?

while (!org.lwjgl.opengl.Display.isCloseRequested) {
      buffer.clear()
      cameraLeft = world.getCamera
      cameraLeft.setPosition(0.2f, -0f, -10f)
      //cameraLeft.lookAt(cone.getTranslation)
      GL11.glColorMask(true,false,false,true)
      world.renderScene(buffer)
      world.draw(buffer)
      buffer.update()
      buffer.displayGLOnly()
      Thread.sleep(10)
      buffer.clearZBufferOnly()
      cameraRight = world.getCamera
      cameraRight.setPosition(-0.2f,-0f,-10f)
      GL11.glColorMask(false,true,true,true)
      world.renderScene(buffer)
      world.draw(buffer)
      buffer.update()
      buffer.displayGLOnly()
      Thread.sleep(10)
    }


#6
Did anyone implemented anaglyph 3D by jPCT before so that the object can be seen by 3D glasses? I know opengl has glColorMask to do this, but I didn't find it in jPCT...if cannot use glColorMask, is it possible to use shaders? Any idea about this? So, how to implement anaglyph 3D by jPCT exactly?