Pages: 1
  Print  
Author Topic: 3d models not working  (Read 3259 times)
Offline (Unknown gender) TheExDeus
Posted on: July 31, 2012, 10:22:46 AM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
poly, I think you made 3d model functions. Are they actually working? Is 3d working at all? Because I get some very weird problems with it. For example, this works fine in GM, but not in ENIGMA. I know culling doesn't work, but even if I remove it is still buggy. You should be able to see 4 shapes and move around with arrow keys. I see part of these shapes and when I move around they distort. What could be the problem? I want to render a point cloud, but if I can't get basic shapes going I don't see how I could do that.
« Last Edit: July 31, 2012, 01:42:10 PM by HaRRiKiRi » Logged
Offline (Male) polygone
Reply #1 Posted on: July 31, 2012, 12:00:55 PM

Contributor
Location: England
Joined: Mar 2009
Posts: 803

View Profile
Models should but working, reup the file it's messed.
Logged
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
Offline (Unknown gender) TheExDeus
Reply #2 Posted on: July 31, 2012, 01:43:33 PM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
Its not messed. Just right click -> save as. Or open it and File -> Save Page. Its just that browser opens it as a text file. Could you provide a simple FPS camera example? Like flying over a ground plane with some rectangles in the air?
Logged
Offline (Male) polygone
Reply #3 Posted on: July 31, 2012, 02:21:13 PM

Contributor
Location: England
Joined: Mar 2009
Posts: 803

View Profile
The problem is just with the code execution order, in the controller move the step code to the draw event and set it's depth to 2000. I didn't even know projection code worked in the step event in GM, but we're not going to be seeing that in ENIGMA. Unless hmm, what would happen if you set the projection at the end of the draw event instead of the start or it?
« Last Edit: July 31, 2012, 04:16:10 PM by polygone » Logged
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
Offline (Unknown gender) TheExDeus
Reply #4 Posted on: July 31, 2012, 04:32:42 PM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
Fair enough. Though the problem was also connected with having d3d_start and a lot of other d3d_ functions for every shape, so it was executed 4 times. As the shapes had lower depth they were executed first. Putting everything in correct place it worked. Also, I am happy that I can render a 300k point cloud with 0 performance hit. Good job with using gl lists. :)

edit: Though d3d_model_vertex_color don't seem to work properly. I can set one color (like c_lime), but if I set different colors for different vertices, then it doesn't draw anything...

edit2: Found the problem. Is with the __GETR, __GETG, __GETB functions inside GSd3d.cpp. You need to divide the values with 255 because GL color is from 0 to 1, not from 0 to 255. So the correct code should be:
Code: [Select]
#define __GETR(x) ((x & 0x0000FF))/255.0
#define __GETG(x) ((x & 0x00FF00)>>8)/255.0
#define __GETB(x) ((x & 0xFF0000)>>16)/255.0
Commit a fix if you want.
« Last Edit: July 31, 2012, 04:52:38 PM by HaRRiKiRi » Logged
Offline (Male) polygone
Reply #5 Posted on: July 31, 2012, 04:44:36 PM

Contributor
Location: England
Joined: Mar 2009
Posts: 803

View Profile
I noticed that, that's why I said to set the depth to 2000; it didn't make any difference when the projection was set in the step event. I've just tested moving the projection settings to the end of screen_redraw and it makes it work, I'm not sure if there will be any ramifications to doing that or not.
Logged
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
Offline (Unknown gender) TheExDeus
Reply #6 Posted on: July 31, 2012, 04:53:52 PM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
The weird effect was cool though. I guess what I got was a rotating rectangular culling window so it cut off the shapes. If it was merely a depth problem, then I will take notice.. I hope.
Logged
Offline (Male) polygone
Reply #7 Posted on: July 31, 2012, 04:56:39 PM

Contributor
Location: England
Joined: Mar 2009
Posts: 803

View Profile
Well I think moving the projection settings to the end of the screen_refresh will make things compatible with GM and allow setting the projection and such in events other than the draw event.
« Last Edit: August 13, 2012, 11:30:10 AM by polygone » Logged
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
Offline (Female) IsmAvatar
Reply #8 Posted on: August 02, 2012, 10:03:41 AM

LateralGM Developer
LGM Developer
Location: Pennsylvania/USA
Joined: Apr 2008
Posts: 886

View Profile Email
I'm going to admit total ignorance here about what you guys are talking about, but I just wanted to say that if you saw a neat effect from a GM-incompatability, but you think it might be useful, we can always just make another function for it.
Logged
Offline (Male) polygone
Reply #9 Posted on: August 02, 2012, 10:29:32 AM

Contributor
Location: England
Joined: Mar 2009
Posts: 803

View Profile
It wasn't that neat and you can replicate it by just not setting the 3d projection.
Logged
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
Offline (Unknown gender) TheExDeus
Reply #10 Posted on: August 02, 2012, 10:31:29 AM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
Well, you can replicate it anyway.  Ism, I had a basic problem with LGM for ages and never reported it, so why the hell I would not put it here. If you load a game (like drag a gmk on the LGM window) before LGM finished loading (the console doesn't show Done), then there will be an exception and you will have to reload LGM. I do think its a ENIGMA plugin error though, but maybe you knew how to fix it.
Logged
Offline (Male) polygone
Reply #11 Posted on: August 02, 2012, 10:46:05 AM

Contributor
Location: England
Joined: Mar 2009
Posts: 803

View Profile
Was it this shit harri?

http://pastebin.com/TqYgjNVE
Logged
I honestly don't know wtf I'm talking about but hopefully I can muddle my way through.
Offline (Unknown gender) TheExDeus
Reply #12 Posted on: August 02, 2012, 11:19:37 AM

Developer
Joined: Apr 2008
Posts: 1872

View Profile
Well its usually just:
Quote
Exception in thread "Thread-6" java.lang.NullPointerException
        at org.enigma.EnigmaRunner$3.run(EnigmaRunner.java:173)
At the beggining. But if I try do anything now, like File->New, then I get this. I can replicate it 100% of the time and I had it for years. Its not that big of a problem, but sometimes it launches for a longer time than others, and if I rush and try to open a project then I have to restart everything.
Logged
Offline (Female) IsmAvatar
Reply #13 Posted on: August 02, 2012, 04:41:28 PM

LateralGM Developer
LGM Developer
Location: Pennsylvania/USA
Joined: Apr 2008
Posts: 886

View Profile Email
Thank you for the detailed report and explaining the circumstances leading up to it. I was aware of the problem, but wasn't certain what caused it (only that it was intermittent), but you've pretty much zero'd it down, so now it should be much easier to provide a quick fix for it. I'll look into it when I get a chance. It is currently logged on http://enigma-dev.org/docs/Wiki/Plugin:Bugs
Logged
Pages: 1
  Print