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.


Messages - AGP

Pages: 1 [2] 3 4 ... 116
16
Support / Re: Cpct?
« on: August 03, 2021, 07:57:47 pm »
The NullPointerException only says, "Object reference not set to an instance of an object." Very useful, so I printed both the stack and the following messages:
Quote
NullReference:    at Object3D.render(Boolean software, Single mx, Single my, Single scalex, Single scaley, Single divx, Single divy, Boolean mayOptimize, Int32 tc, FrameBuffer buffer)
   at WorldProcessor.processInternal(FrameBuffer buffer, List`1 objectList, Portals portals, Camera camera, Boolean software, Single mx, Single my, Boolean mayOptimize, Boolean hasToSort, Int32 start, Int32 end, Single camScaleX, Single camScaleY, Boolean gl)
   at WorldProcessor.process(FrameBuffer buffer, List`1 objectList, Portals portals, Camera camera, Boolean software, Single mx, Single my, Boolean mayOptimize, Boolean hasToSort, Int32 start, Int32 end, Single camScaleX, Single camScaleY, Boolean gl)
   at World.renderScene(FrameBuffer buffer)
Object3D.render(): compiled. Is visList null? False
Object3D.render(): compiled. Is visList null? False
[ 8/4/2021 3:25:24 AM ] - WARNING: World.renderScene(): There's a problem with the object list not being consistent during rendering. This is often caused by concurrent modification of BR3D objects on a thread different from the rendering thread! Is camera null? False Is visList? False

17
Support / Re: Cpct?
« on: August 02, 2021, 10:12:49 pm »
On occasions whose particularities I've yet to identify, I can't get rid of the following message.

Quote
WARNING: World.renderScene(): There's a problem with the object list not being consistent during rendering. This is often caused by concurrent modification of BR3D objects on a thread different from the rendering thread! Is camera null? False Is visList? False

Also, only the Skybox renders when compiled...

18
Support / Re: Cpct?
« on: July 07, 2021, 09:19:51 am »
Yeah, I added a try-catch to the entire method. It gets me through initialization, then it stops happening. Still, I'm not getting anything drawn when compiling the objects.

19
Support / Re: Cpct?
« on: July 04, 2021, 07:33:33 pm »
It has to be GL.DrawElements(primitiveType, indexCount, DrawElementsType.UnsignedInt, indices.array) because there's a printout right after it that doesn't get printed.

20
Support / Re: Cpct?
« on: July 04, 2021, 07:54:37 am »
It's infuriating that although I don't know why the indexed flag is true, the following block produces the following output. I don't suppose anyone would have any insights here?

Code: [Select]
              do {
                     if (indexed) {
                            GL.BindBuffer(BufferTarget.ElementArrayBuffer, indicesId);
                                   System.Console.WriteLine("CompiledInstance.renderVBO(): Is indices null? "+(indices==null));
                                   if (indices==null){
                                          indexed = false;//A HACK
                                                               System.Console.WriteLine("HACKHACKHACKHACKHACKHACK");
                                                 indices = new IntBuffer(tris.Count * 3);
                                   return;}
                            if (indexed){//A HACK
                            GL.DrawElements(primitiveType, indexCount, DrawElementsType.UnsignedInt, indices.array);
                                   System.Console.WriteLine("CompiledInstance.renderVBO(): BindBuffer()?");
                            GL.BindBuffer(BufferTarget.ElementArrayBuffer, 0);}
                     } else {
                            System.Console.WriteLine("\n\nCompiledInstance.renderVBO(): GL.DrawArrays(...).\n");
                            GL.DrawArrays(primitiveType, 0, cnt);
                     }
              }

Quote
CompiledInstance.renderVBO(): Is indices null? True
HACKHACKHACKHACKHACKHACK

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at co.ratto.threed.CompiledInstance.renderVBO(Boolean vertexAlpha, IRenderHook hook)
   at co.ratto.threed.CompiledInstance.render(Int32 myID, IRenderer renderer, Single[] ambient, Single[] cols, Boolean intoDepthMap, Camera cam, Single[][] lights, Boolean wireFrame, Object[] data)
   at co.ratto.threed.GLRenderer.drawVertexArray(VisList visList, Int32 start, Int32 end, FrameBuffer buffer, World world)
   at co.ratto.threed.World.draw(FrameBuffer buffer, Boolean wireframe, UInt32 frameColor, Int32 start, Int32 end)
   at co.ratto.threed.World.draw(FrameBuffer buffer, Boolean wireframe, UInt32 frameColor)
   at co.ratto.threed.World.draw(FrameBuffer buffer)
   at co.ratto.threed.SkyBox.render(World world, FrameBuffer buffer)
   at LivingForest.draw()
   at LivingForest.gameLoop()
   at LivingForest.OnUpdateFrame(FrameEventArgs e)
   at OpenTK.GameWindow.RaiseUpdateFrame(Stopwatch watch, Double elapsed, Double& timestamp)
   at OpenTK.GameWindow.DispatchUpdateFrame(Stopwatch watch)
   at OpenTK.GameWindow.Run(Double updates_per_second, Double frames_per_second)
   at LivingForest..ctor()
   at LivingForest.Main(String[] args)

21
Support / Re: Cpct?
« on: June 28, 2021, 07:44:50 pm »
I put in a bizarre wait of 2.5 seconds and cleared that block as far is this bit. Now, no matter what I try indices is null. What I'm trying is hacky, anyway, so I'd rather ask you when indices in CompiledInstance.renderVBO() might be null. The C# runtime operates very differently from the JVM.

Code: [Select]
              do {
                     if (indexed) {
                            GL.BindBuffer(BufferTarget.ElementArrayBuffer, indicesId);
                                   System.Console.WriteLine("CompiledInstance.renderVBO(): Is indices null? "+(indices==null));
                                          if (indices==null){
                                                 indices = new IntBuffer(tris.Count * 3);
                                                 //return;
                                                 while (indices == null)
                                                 continue;}
                            GL.DrawElements(primitiveType, indexCount, DrawElementsType.UnsignedInt, indices.array);
                                   System.Console.WriteLine("CompiledInstance.renderVBO(): BindBuffer()?");
                            GL.BindBuffer(BufferTarget.ElementArrayBuffer, 0);
                     } else {
                            System.Console.WriteLine("\n\nCompiledInstance.renderVBO(): GL.DrawArrays(...).\n");
                            GL.DrawArrays(primitiveType, 0, cnt);
                     }
              }

22
Support / Re: Cpct?
« on: June 25, 2021, 09:24:33 am »
I think that I've figured out my problem with CompiledInstance memory errors: I had to delete the reflection (I really wish you would forget Java 1.1 ever existed), and I can't see how your code ever calls Object3DCompiler.compile(...) (or Versionhelper5.compile(...) for that matter). Help me out?

23
Support / Re: Cpct?
« on: May 19, 2021, 09:24:42 am »
Never mind that. After too long with no success, I've started rendering things beautifully. A lot of different problems at the moment, like the fact that no compiled object is working. Only so many blitting methods work at all, for that matter, maxPolysVisible can't be much more than 512k for some reason, and a few other mysteries.

Oh, and C# can't catch exceptions across threads, which is a nuisance. I may have to switch to Tasks, if that's doable.

24
Support / Re: Cpct?
« on: May 19, 2021, 12:51:53 am »
Our little engine has a very specific approach to OpenGL, so online examples aren't always very helpful. I have found the following answer (https://stackoverflow.com/questions/61030683/opengl-opentk-drawing-with-indices-attempted-to-read-or-write-protected-memo) to a similar problem, but I can't fit it into the pipeline. GLRenderer.renderVertexArray(int) is currently throwing:
Quote
Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
   at OpenTK.Graphics.OpenGL.GL.DrawArrays(PrimitiveType mode, Int32 first, Int32 count)
   at co.ratto.threed.GLRenderer.renderVertexArray(Int32 curPos)
   at co.ratto.threed.GLRenderer.drawVertexArray(VisList visList, Int32 start, Int32 end, FrameBuffer buffer, World world)
   at co.ratto.threed.World.draw(FrameBuffer buffer, Boolean wireframe, UInt32 frameColor, Int32 start, Int32 end)
   at co.ratto.threed.World.draw(FrameBuffer buffer, Boolean wireframe, UInt32 frameColor)
   at co.ratto.threed.World.draw(FrameBuffer buffer)
   at co.ratto.threed.SkyBox.render(World world, FrameBuffer buffer)
   at LivingForest.draw()
   at LivingForest.gameLoop()
   at LivingForest.OnUpdateFrame(FrameEventArgs e)
   at OpenTK.GameWindow.RaiseUpdateFrame(Stopwatch watch, Double elapsed, Double& timestamp)
   at OpenTK.GameWindow.DispatchUpdateFrame(Stopwatch watch)
   at OpenTK.GameWindow.Run(Double updates_per_second, Double frames_per_second)
   at LivingForest..ctor()
   at LivingForest.Main(String[] args)

And this is my port (almost identical to yours):
Code: [Select]
       private void createVertexArrays(int max) {
              GL.EnableClientState(ArrayCap.TextureCoordArray);
              for (int i = 0; i < max; i++) {
                     multiTextures[i] = new FloatBuffer(VertexArraySize * 2);
                     GL.ActiveTexture((TextureUnit)stageMap[i]);
                     GL.TexCoordPointer(2, TexCoordPointerType.Float, 8, multiTextures[i].array);
                     if (i == 0) {
                            textures = multiTextures[0];
                            buffersEnabled[0] = true;
                     }
              }
       }
       private void renderVertexArray(int curPos) {
              if (curPos != 0) {
                     bool dissed = false;
                     // For Projective the Texture Coordinates from ...
                     for (int i = 0; i < projective.Length; i++) {
                            if (projective[i] && buffersEnabled[i]) {
                                   GL.ActiveTexture((TextureUnit)stageMap[i]);
                                   GL.DisableClientState(ArrayCap.TextureCoordArray);
                                   dissed = true;
                            }
                     }
                     GL.DrawArrays(PrimitiveType.Triangles, 0, curPos);
                     if (dissed) {
                            // And on again if necessary. Actually, that should be dead, but you are not in it in the driver.
                            for (int i = 0; i < projective.Length; i++) {
                                   if (projective[i] && buffersEnabled[i]) {
                                          GL.ActiveTexture((TextureUnit)stageMap[i]);
                                          GL.EnableClientState(ArrayCap.TextureCoordArray);
                                   }
                            }
                     }
              }
       }

If you have any insights I would greatly appreciate them.

25
Support / Re: Cpct?
« on: April 23, 2021, 07:50:28 am »
The ARBMultitexture lines are commented out in the above code. But I found GL.ActiveTexture((TextureUnit)stageMap), which I hope is the same. Still, no progress on the vertex array problem. As for PrimtiveType.Triangles, I'm confident about it.

26
Support / Re: Cpct?
« on: April 22, 2021, 09:01:40 pm »
This is what my renderVertexArray(int) method looks like, because I couldn't find OpenTK equivalents for the ARBMultitexture stuff. Could that be the problem?

Code: [Select]
       private void renderVertexArray(int curPos) {
              if (curPos != 0) {
                     bool dissed = false;
                     // For Projective the texture coordinates from ...
                     for (int i = 0; i < projective.Length; i++) {
                            if (projective[i] && buffersEnabled[i]) {
//                                   ARBMultitexture.glClientActiveTextureARB(stageMap[i]);
                                   GL.DisableClientState(ArrayCap.TextureCoordArray);
                                   dissed = true;
                            }
                     }
                     GL.DrawArrays(PrimitiveType.Triangles, 0, curPos);
                     if (dissed) {
                            // And on again if required. Actually, this should be dead, but you are not in the driver.
                            for (int i = 0; i < projective.Length; i++) {
                                   if (projective[i] && buffersEnabled[i]) {
//                                          ARBMultitexture.glClientActiveTextureARB(stageMap[i]);
                                          GL.EnableClientState(ArrayCap.TextureCoordArray);
                                   }
                            }
                     }
              }
       }

27
Support / Re: Cpct?
« on: April 20, 2021, 07:46:54 am »
I'm porting GLSLShader and ShadowHelper right now. Around line 382, ShadowHelper does world.setAmbientLight(col.getRed(), col.getRed(), col.getBlue()). Is that a bug or did you use red twice on purpose?

28
Support / Re: Cpct?
« on: April 19, 2021, 07:42:00 pm »
But is it possible to have a mistake in the code and still have it sometimes work (a single bush from that forest will render without hitch with vertex arrays)?

29
Support / Re: Cpct?
« on: April 19, 2021, 07:51:56 am »
But what does it tell you that when this complex forest model gets drawn it is only when vertex arrays are disabled? Also, why do wireframes always work?

30
Support / Re: Cpct?
« on: April 18, 2021, 11:55:46 pm »
My big stress test case is only clearing the screen. The same forest model renders on a model tester if and only if glVertexArrays is set to false. On the stress test, with a player, two skyboxes and some NPCs even without vertex arrays nothing gets drawn. But wireframe always works, on both the loader and the stress test, whether or not vertex arrays are being used. I'm not sure how helpful the following printout will be, but I feel like renderVertexArray(int) should be printing contiguous numbers.

Code: [Select]
renderVertexArray(int): 3
renderVertexArray(int): 3
renderVertexArray(int): 3
renderVertexArray(int): 9
renderVertexArray(int): 51
renderVertexArray(int): 30
renderVertexArray(int): 120
renderVertexArray(int): 18
renderVertexArray(int): 120
renderVertexArray(int): 12
renderVertexArray(int): 120
renderVertexArray(int): 12
renderVertexArray(int): 6
renderVertexArray(int): 6
renderVertexArray(int): 3
renderVertexArray(int): 6
renderVertexArray(int): 6
renderVertexArray(int): 6
renderVertexArray(int): 6
renderVertexArray(int): 15
renderVertexArray(int): 3
renderVertexArray(int): 9
renderVertexArray(int): 3
renderVertexArray(int): 435
renderVertexArray(int): 51
renderVertexArray(int): 48
renderVertexArray(int): 3
renderVertexArray(int): 12
renderVertexArray(int): 3
renderVertexArray(int): 6
renderVertexArray(int): 3
renderVertexArray(int): 30
renderVertexArray(int): 3
renderVertexArray(int): 159
renderVertexArray(int): 3
renderVertexArray(int): 9
renderVertexArray(int): 3
renderVertexArray(int): 18
renderVertexArray(int): 3
renderVertexArray(int): 279
renderVertexArray(int): 18
renderVertexArray(int): 24
renderVertexArray(int): 12
renderVertexArray(int): 18
renderVertexArray(int): 3
renderVertexArray(int): 36
renderVertexArray(int): 18
renderVertexArray(int): 36
renderVertexArray(int): 18
renderVertexArray(int): 24
renderVertexArray(int): 81
renderVertexArray(int): 3
renderVertexArray(int): 3
renderVertexArray(int): 9
renderVertexArray(int): 15
renderVertexArray(int): 6
renderVertexArray(int): 6
renderVertexArray(int): 6
renderVertexArray(int): 3
renderVertexArray(int): 6
renderVertexArray(int): 12
renderVertexArray(int): 12
renderVertexArray(int): 18
renderVertexArray(int): 225
renderVertexArray(int): 3
renderVertexArray(int): 186
renderVertexArray(int): 3
renderVertexArray(int): 12
renderVertexArray(int): 6
renderVertexArray(int): 69
renderVertexArray(int): 168
renderVertexArray(int): 18
renderVertexArray(int): 444
renderVertexArray(int): 6
renderVertexArray(int): 15
renderVertexArray(int): 3
renderVertexArray(int): 3
renderVertexArray(int): 36
renderVertexArray(int): 240
renderVertexArray(int): 3
renderVertexArray(int): 6
renderVertexArray(int): 3
renderVertexArray(int): 3
renderVertexArray(int): 6
renderVertexArray(int): 12
renderVertexArray(int): 456
renderVertexArray(int): 21

Pages: 1 [2] 3 4 ... 116