Submit
065f0635a4c94d685583c20132a4559d
0
Ed_Mack 101 Jul 13, 2003 at 05:19

Here’s a really good tutorial on loading .3ds files in C (I plan to use it too) :D

Sorry, look below (delete this post please)

Ed Mack

065f0635a4c94d685583c20132a4559d
0
Ed_Mack 101 Jul 12, 2003 at 03:17

Here’s a .3ds loading openGL dooda:

http://www.home.no/apron/english/apron.htm?tut_gl (scroll down)

Need to sleep,

Ed Mack

In response to CPU clock speed
6ad5f8c742f1e8ec61000e2b0900fc76
0
davepermen 101 Jul 11, 2003 at 17:24

very nice piece of code.. i’ve played around with it (2209 MHz here..:D)

by dividing through some value, we can make it run much faster (1sec is so slow… at least, to just wait and do nothing..)

..ulValue.QuadPart = ulTicks.QuadPart + ulFreq.QuadPart/16;..
..return (DWORD)((ulEAX_EDX.QuadPart - ulStartCounter.QuadPart)*16/1000000);..

for example.. i tested it by dividing trough 256, and still got 2209 MHz.. and you could call it 256 times per second.. quite fine, not?..

just a suggestion..

you should store the value in the end anyways, and use it directly.. if you need to.

In response to CPU clock speed
Fdbdc4176840d77fe6a8deca457595ab
0
dk 158 Jul 11, 2003 at 16:49

You can use assembly to calculate the CPU clock speed using the ‘rdtsc’ instruction.

#include <stdio.h>
#include <windows.h>

DWORD GetCPUSpeed();

int main() {
    DWORD TheSpeed;
    
    if (TheSpeed = GetCPUSpeed())
 printf("CPU Speed: %u MHz\n", TheSpeed);
    else
 printf("Your hardware does not support a high-resolution counter.\n");
    
    return 0;
}


DWORD GetCPUSpeed() {
    LARGE_INTEGER ulFreq, ulTicks, ulValue, ulStartCounter, ulEAX_EDX;

    // Query for high-resolution counter frequency (this is not the CPU frequency):
    if (QueryPerformanceFrequency(&ulFreq)) {
 // Query current value:
 QueryPerformanceCounter(&ulTicks);
 // Calculate end value (one second interval); this is (current + frequency)
 ulValue.QuadPart = ulTicks.QuadPart + ulFreq.QuadPart;
 // Read CPU time-stamp counter:
 __asm RDTSC
 // And save in ulEAX_EDX:
 __asm mov ulEAX_EDX.LowPart, EAX
 __asm mov ulEAX_EDX.HighPart, EDX
 // Store starting counter value:
 ulStartCounter.QuadPart = ulEAX_EDX.QuadPart;
 // Loop for one second (measured with the high-resolution counter):
 do {
    QueryPerformanceCounter(&ulTicks);
 } while (ulTicks.QuadPart <= ulValue.QuadPart);
 // Now again read CPU time-stamp counter:
 __asm RDTSC
 // And save:
 __asm mov ulEAX_EDX.LowPart, EAX
 __asm mov ulEAX_EDX.HighPart, EDX
 // Calculate number of cycles done in interval; 1000000 Hz = 1 MHz
 return (DWORD) ((ulEAX_EDX.QuadPart - ulStartCounter.QuadPart) / 1000000);
    } else {
 // No high-resolution counter present:
 return 0;
    }
}
In response to complied_vertex_array
6ad5f8c742f1e8ec61000e2b0900fc76
0
davepermen 101 Jul 11, 2003 at 12:48

just forget about compiled vertex array..

it was useful for multipassing on pre-t&l hw. today, they are “void” functions..

at least on nvidia hw.

and i think its the same on ati hw..

it was great the days of quake3.. and if you want to optimize for RealyOldCards ™ (pre geforce!!), then, okay, use it. else, forget about it.

In response to complied_vertex_array
Db7c6256c6650d0a94ac64a980503733
0
MA_Mestre 101 Jul 11, 2003 at 12:38

to do so, i suggest to dive into the quite new ARB_vertex_object_buffer extension. it is about the fastest

i usually work with vertex_object, i know it. But, using vertex_objetct don’t exclude to work with compiled_vertex, are compatibles. The compiled_vertex use information about shared vertex to reduce work.

In response to complied_vertex_array
6ad5f8c742f1e8ec61000e2b0900fc76
0
davepermen 101 Jul 11, 2003 at 10:57

they are obsolente, but not because of display lists, but because of hardware changes..

with the time of hardware T&L (gf1 +, radeon +, etc..), the extension got quite obsolente, with the time of programable shadings it got even useless.. reasons unimportant..

at least: today we store our geometry at best directly on the gpu, and, placed there, we can draw it very fast.

to do so, i suggest to dive into the quite new ARB_vertex_object_buffer extension. it is about the fastest way to draw geometry.

In response to textures
Db7c6256c6650d0a94ac64a980503733
0
MA_Mestre 101 Jul 11, 2003 at 09:43

like davepermen said, set white color before draw the textured quad

Maybe this…


glColor3u (255,255,255)
glEnable (G_TEXTURE2D)
DrawQuad ….
glDisable (G_TEXTURE2D)
glColor3u (255,0,0)
DrawRedLines…

In response to textures
6ad5f8c742f1e8ec61000e2b0900fc76
0
davepermen 101 Jul 10, 2003 at 13:01

you set color back to white before drawing the quad?

27340afba8e6bbd010c1e520a843e50f
0
moomin 101 Jul 10, 2003 at 07:34

Ah okay cheers for that

In response to DirectSound issues
994af94f871438b5fe2c0d002b3c659d
0
ray_f 101 Jul 10, 2003 at 04:05

DS will return 0x80070057 when attempting to create an DS buffer in unsupported format…

However, it is wired to see that error in DXDIAG which should be using some low-res anyway…

In the mean time, look for the latest drivers, and install DX9a if possible…

In response to DirectMusic
994af94f871438b5fe2c0d002b3c659d
0
ray_f 101 Jul 10, 2003 at 04:01

Check out the samples in DirectX SDK, there are load of sample code running DirectMusic. :)

E05263ec846eb85da803f56e2917962d
0
Noor 101 Jul 09, 2003 at 18:37

Moomin, just in the future reference, you can submit such news in the submission link found in the main page. By doing that, more people can see it.

Fdbdc4176840d77fe6a8deca457595ab
0
dk 158 Jul 09, 2003 at 16:58

Very interesting. Thanks moomin for letting us know.
Getting a log would be fantastic.

I’ll try to be there.

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Jul 09, 2003 at 14:21

cool, i’ll try to be there…
if i’m not there i’ll idle in the channel and safe a log for devmaster

0684f9d33f52fa189aad7ac9e8c87510
0
baldurk 101 Jul 05, 2003 at 07:37

There is no way to draw anything in OpenGL, without OpenGL commands. The easy way is to use the data from the model file, and pass it to OpenGL via appropriate commands. The hard way, and never used way, is to manually do it.

3a28227e8f3c9837610adb0c0a76e654
0
like_gobeawan 101 Jul 05, 2003 at 06:34

hi all,

thanks a lot for the reply. in the end, i decided to use 3dmax to model the objects i want, then use a opengl loader for 3dmax format file. (give up… nobody recommend me to use opengl itself =p )

initially, i thought that by using opengl itself to model the object, i don’t have to convert the 3dmax / maya codes into opengl to be manipulated. the project i want to do is to make real time user interaction on the model.

so by using opengl to model the object itself, it enables me to store the object data in my data structure, and render it faster in C++/C# implementation.
right now, i’m still not clear about the project design and feasibility by converting 3dmax model into opengl. anyone would like to comment or suggest something ?

:blink: :rolleyes: :)

In response to Texture Loading
C7787dfbc6b0c78ef4a2a8e7cfe1366c
0
keless 101 Jul 05, 2003 at 06:13

First of all, you should concider what resource types some of your models will require. If you’re supporting .3ds or Md3 you’re almost bound to .BMP or .TGA

C7787dfbc6b0c78ef4a2a8e7cfe1366c
0
keless 101 Jul 05, 2003 at 06:06

The reason you dont want to handcode the object is because anything larger than a cube requires a great number of lines of code. And they all look like this:
glBegin(GL_TRIANGLE_STRIP);
glVertex3f(1.0f, 1.0f, 1.0f);
glVertex3f(3.0f, 246.0f, 234.0f);
glVertex3f(246.0f, 234.0f, 2465.0f);
glVertex3f(45.0f, 543.0f, 65.0f);
glVertex3f(1.0f, 54.0f, 634.0f);
glVertex3f(234.0f, 524.0f, 1.0f);
glVertex3f(2654.0f, 234.0f, 1.0f);
glVertex3f(1.0f, 352.0f, 1.0f);
glEnd();

Or something to that degree, but with less spastic numbers. Now imagine trying to come up with the verticies for a 1000 poly model. (thats 1000 triangles, so if you were to do it with GL_TRIANGLES, 3000 glVertex3f() calls) What a nightmare, huh? So you need to let the artist make the object, and instead write a class that will load in that object and draw it efficiently. This is much easier to do.

I dont know why you dont want to use models made by professional modeling programs, but perhaps its because you want to make them yourself and you dont have the money for 3DS Max? First of all, there are many models people have made which they have given for free use on the Internet. Apart from that, there are also openSource modelers that you can use for free.

Hope this helps.

27340afba8e6bbd010c1e520a843e50f
0
moomin 101 Jul 04, 2003 at 08:00

Arse there’s like these big saucer shaped ships just hovering over my workplace.

Mkay

PS can I get a custom title since I er, sort of contribute, and I will seriously try to provide an article by this weekend, I’m currently rebuilding all of my default OGL files (keyboard, mousr, init, etc bla blah mr Absinth|)

27340afba8e6bbd010c1e520a843e50f
0
moomin 101 Jul 04, 2003 at 07:58

Well basically a seperate place, just to spice things up. Think of it as sort of having your own hosted website on devmaster. Oviously it would be massively restricted as to what you can post/upload. But at least it gives something different to the websites out there. I won’t be nasty, but rather straight to the point. Devmaster is fighting in rather a niche area especially ssince www.gametutorials.com is around, devmaster must provide some originality and, my idea is a way too sort of give that. I do whole hearlty agree with the issue of spamming, maybe the person has to reach a certain number of posts AND have contributed a certain number of articles.

PS I work as a programmer for a large utility company in the UK and the emailer disclaimer is HUUUUUUUUUUUUUUUUUGGGGGGGGGGGGGE

PSS I was introduced to Mr Absinth last night, aaaarg

Fdbdc4176840d77fe6a8deca457595ab
0
dk 158 Jul 04, 2003 at 03:05

Do you mean something similar to Code Snippets? That’s a good idea…but why not use the forums for feedback and suggestions? That is, you can post it here, and then when it’s ready, it can be moved to the main page as a formal article.
Or do you mean, you’d like a seperate place to do all that?

0684f9d33f52fa189aad7ac9e8c87510
0
baldurk 101 Jul 03, 2003 at 17:10

the only problem is when to judge someone worthy of a blog. It can’t be post count only. The decision of apex perhaps?

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Jul 01, 2003 at 17:02

it’s actually quite simple. check out video for windows. it lets you stream in avi video files into your app easily. if you are not under windows i’d check out ogg.
vfw delivers you video frames as DIBs which you can simply load into opengl textures.

In response to Texture Loading
27340afba8e6bbd010c1e520a843e50f
0
moomin 101 Jul 01, 2003 at 12:39

Hmmmmm, I suppose this isn’t really an opengl issue, and is really a personal decision. BMP’s are fine(ish) just their lack of alpha (although you can “fix” this, and the comperatively large filesize). For testing/learning BMPs are fine

Welcome to DevMaster, a community-driven game development website of posts and resources!

Recent Tags

indie × 5
game-development × 5
ios × 3
android × 3
algorithm × 1
effects × 1
physics × 1
iphone × 1
c# × 1
mobile × 1
physics-engines × 1
native × 1
macos × 1
sound × 1
music × 1
networking × 1
testing × 1
multiplayer × 1
design-patterns × 1
game-programming × 1
3d-engine × 1
shaders × 1
cross-platform × 1
gaming × 1
game-industry × 1