Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / what's wrong with this code, the cube is there but not the texture !

Author
Message
kamelito
19
Years of Service
User Offline
Joined: 25th Dec 2004
Location: France
Posted: 22nd Aug 2005 01:04
Hi,
what's wrong with this code, the cube is there but not the texture !
I know that the image is load (tested with ntfilemon so the pb is not there).
A strange behavior of the SDK, it look by default at d:\media, it even look at d:\media\d:\media after having added the jpg there to see if it could work.

thx

#include "DarkSDK.h"

void DarkSDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 0 );

dbLoadImage ( "d:/media/sophie.jpg", 1);
// dbLoadObject( "cube.3ds",1);
dbMakeObjectCube (1,50);
dbTextureObject ( 1, 1);

float i = 0;
while ( LoopSDK ( ) )
{

if ( dbEscapeKey ( ) )
return;

/* dbRotateObject ( 1, i, i, 0);
i += .1;
if (i >= 360)
i = 0;
*/
dbSync ( );
}
}

/kml
shiny
20
Years of Service
User Offline
Joined: 17th Jan 2004
Location: Santa Monica
Posted: 22nd Aug 2005 02:56 Edited at: 22nd Aug 2005 02:58
try putting sophie.jpg into the same directory as your c++ project, and then

dbLoadImage("sophie.jpg", 1);

roujesky
19
Years of Service
User Offline
Joined: 4th Jun 2004
Location:
Posted: 22nd Aug 2005 05:11
User is right, but if you want to leave the jpeg in your d drive, change the line:
dbLoadImage ( "d:/media/sophie.jpg", 1);
to
dbLoadImage ( "d:\\media\\sophie.jpg", 1);

This might fix you up.
kamelito
19
Years of Service
User Offline
Joined: 25th Dec 2004
Location: France
Posted: 22nd Aug 2005 14:13
Thanks, but Shiny suggestion is the first thing I've done, I changed it to a specified directory to see if the pb come from there.
Both solution (Shiny and Roujesky) didn't work.

I don't really understand why the image is not mapped.
Does dbLoadImage() block the execution of the code until the image is loaded ? or is it multithreaded and then the image is still not loaded that I apply the texture...

This is weird, does anyone have any other idea as why this code fail ?
Thanks

/kml
OSX Using Happy Dude
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 22nd Aug 2005 14:20
If there is no texture then its possible that the jpeg file is the problem - can you make it availiable.

Come to the third DarkBasic Pro Sci Fi Con - Be there and be square
Blog:http://spaces.msn.com/members/BouncyBrick/
Web Site:http://www.nicholaskingsley.co.uk
kamelito
19
Years of Service
User Offline
Joined: 25th Dec 2004
Location: France
Posted: 22nd Aug 2005 16:51
I don't think the pb come from the jgp.
It was a 763x961 jpg, I converted it to 158x200 (factor of 2) to see if the pb come from here, but it doesn't solve the problem.

I pick my Atari icon (can be seen in the forum under user) the cube is still not mapped

Does the code is ok ?
thanks

/kml
OSX Using Happy Dude
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 22nd Aug 2005 17:08 Edited at: 22nd Aug 2005 17:10
The code works fine here and textures the cube - I used that Atari logo.

DarkSDK wont texture objects with GIF files, but thats about it.

Therefore either the file isn't there or theres a problem with it.

Come to the third DarkBasic Pro Sci Fi Con - Be there and be square
Blog:http://spaces.msn.com/members/BouncyBrick/
Web Site:http://www.nicholaskingsley.co.uk
kamelito
19
Years of Service
User Offline
Joined: 25th Dec 2004
Location: France
Posted: 22nd Aug 2005 17:36
thanks for helping me to narrow the pb.
At the end it was a configuration issue, gfx driver to be more precise.
Upgrading to nvidia 77.77 drivers resolved the pb.

thanks a lot !

/kml
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 22nd Aug 2005 19:40
Well, there's a lesson for you - it was probably the odd size of the texture that did it. Stick to powers-of-2 square textures for maximum compatibility

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins and source code http://www.matrix1.demon.co.uk
kamelito
19
Years of Service
User Offline
Joined: 25th Dec 2004
Location: France
Posted: 22nd Aug 2005 21:20
Well you're right and wrong IanM
As I stated above, I also tried the 158x200 resolution which is a factor of 2.
It was really a driver issue, after upgrading it, even the odd resolution texture work fine. (I will in the future of course use a factor of 2 resolution).
Two lessons learned in fact
cheers

/kml
shiny
20
Years of Service
User Offline
Joined: 17th Jan 2004
Location: Santa Monica
Posted: 22nd Aug 2005 22:43
how is 158x200 a power of 2?? - not a good texture size. try -

32, 64, 128, 256, 512, 1024, 2048, etc...

kamelito
19
Years of Service
User Offline
Joined: 25th Dec 2004
Location: France
Posted: 23rd Aug 2005 00:21
I was not really good at math as you find out
Nontheless its just recommanded and the problem was a driver issue.
Anyway you're right !

/kml
OSX Using Happy Dude
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 23rd Aug 2005 00:38
Amazing what new drivers will do.

Come to the third DarkBasic Pro Sci Fi Con - Be there and be square
Blog:http://spaces.msn.com/members/BouncyBrick/
Web Site:http://www.nicholaskingsley.co.uk
kamelito
19
Years of Service
User Offline
Joined: 25th Dec 2004
Location: France
Posted: 23rd Aug 2005 00:50
I don't really follow you...
I work in the past in tech support then QA, and I always told beta-testers to upgrade to the latest drivers (being sound, gfx ...) and use the latest version before reporting a bug.
Thing I've not done myself in this case. But as the code worked for you it as to work for me. So I tried the new nvidia and it solve the problem, what's amazing here ?

/kml
OSX Using Happy Dude
20
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 23rd Aug 2005 09:28
The fact that you need new drivers.

Come to the third DarkBasic Pro Sci Fi Con - Be there and be square
Blog:http://spaces.msn.com/members/BouncyBrick/
Web Site:http://www.nicholaskingsley.co.uk

Login to post a reply

Server time is: 2024-04-26 09:19:29
Your offset time is: 2024-04-26 09:19:29