Submit
In response to textures
F923e021a633170fb10416df23dffddd
0
urika 101 Jul 16, 2003 at 12:41

thank u! ,i found the answer myself though (the white thing of course) :blush:

In response to I love asm...
065f0635a4c94d685583c20132a4559d
0
Ed_Mack 101 Jul 16, 2003 at 02:30

Aww, I had a 500+, it was my lovechild :D I sat and made strange things in BASIC all day long, it was great fun. At that time I had no real idea how much programming could do, but was able to make use of the joystick and the circle drawer :) I miss it now come to think of it..

Now gcc + Flash make up my programming/scripting suppliment.

In response to Creating gimbel lock
F33eec98e0fc761467c315aad881c035
0
Jesse_M 101 Jul 15, 2003 at 17:23

I once suffered from gimbal lock. Or at least I *think* it was gimbal lock. I wrote a camera class and was testing in on a 2d grid. Rotating pitch and yaw was perfect, but as soon as I tried to roll it began to fudge the previous 2 axis. The more you fidel with it, the more it messed up.

I fixed this with quaternions however. Funny story… When I looked up “gimbal lock” on google it came up with this site for a band called “gimbal lock”. They’re a bunch of math geeks who named themselves after the matrix problem. I laughed my ass off.

In response to FPS counter
77c60eaca2812f5b7b91b03705fa64e3
0
Obunako 101 Jul 15, 2003 at 08:47

i make this question, because, i calculate the FPS between Vertex Arrays and whitout, and de frame rates are the same. After this i said, maybe my FPS counter has a bug.

Vertex Arrays gains FPS against inmediate mode ( glVertex.. ) ?

What do you think about the Repaint thread ? :yes: :no:

Thanks all replies

In response to complied_vertex_array
Db7c6256c6650d0a94ac64a980503733
0
MA_Mestre 101 Jul 15, 2003 at 08:37

Ok, thanks …i try to develop a application that test this extension.

In response to CPU clock speed
6ad5f8c742f1e8ec61000e2b0900fc76
0
davepermen 101 Jul 15, 2003 at 08:31

google(“rdtsc”);

RDTSC Read Time Stamp Counter

Mnemonic: RDTSC
Opcode : 0F 31
Bug in : Poorly documented for Pentium Processor

Function:
RDTSC reads a Pentium internal 64 bit register which is being incremented
from 0000 0000 0000 0000 at every CPU internal clockcycle. Note that this
gives a clockcycle-accurate timer with a range of more than 8800 years at
66 Mhz…

The instruction places the counter in the EDX:EAX register pair.

source

In response to CPU clock speed
Db7c6256c6650d0a94ac64a980503733
0
MA_Mestre 101 Jul 15, 2003 at 08:27

:lol: great piece of code !!! Thanks apex.

Maybe u can explain me how works ‘rdtsc’ instruction, my assembler is old ( 8086 :P ).

I need to bring up to date about asm, some URL, pdf ?

thanks.

In response to very simple question
Db7c6256c6650d0a94ac64a980503733
0
MA_Mestre 101 Jul 15, 2003 at 08:10

if u use apex’s code ( into VC6.0 ), and u need #include <windows.h> u must put #include <winsock2.h> before windows include. Otherwise the compiler found data types repeated. ;)

In response to very simple question
Fdbdc4176840d77fe6a8deca457595ab
0
dk 158 Jul 15, 2003 at 03:53

If you’re using windows, you can get your IP address using WinSock. You can’t get the IP address in “C/C++”. You’ll have to use a library.

      #include <winsock2.h>

      WORD wVersionRequested;
      WSADATA wsaData;
      char name[255];
      CString ip;
      PHOSTENT hostinfo;
      wVersionRequested = MAKEWORD( 2, 0 );

      if ( WSAStartup( wVersionRequested, &wsaData ) == 0 )
      {

            if( gethostname ( name, sizeof(name)) == 0)
                  if((hostinfo = gethostbyname(name)) != NULL)
                        ip = inet_ntoa (*(struct in_addr *)*hostinfo->h_addr_list);
           
            WSACleanup( );
      } 

don’t forget to link with Wsock32.lib

In response to Ray/Cube Intersection
7f31d4c4bf8648e1257d77609430952c
0
Julio 101 Jul 15, 2003 at 02:49

well, the easiest method would just to use some sort of bounding sphere collision detection. if you test a side (a ray-plane intersection) you would have to take into account rotations and such. ray-plane intersection itself isn’t too difficult, but I think bounding sphere might be your best bet.

In response to FPS counter
E05263ec846eb85da803f56e2917962d
0
Noor 101 Jul 14, 2003 at 22:26

Thanks for the link it’s pretty good, I suggest that you add it to devmaster.net links page! contact apex for more info.

In response to FPS counter
7f31d4c4bf8648e1257d77609430952c
0
Julio 101 Jul 14, 2003 at 22:19

you can check out how I implimented an fps counter in my timer class. it’s on my website [URL=http:// julio.programmers-unlimited.com]here[/URL].

In response to FPS counter
Fdbdc4176840d77fe6a8deca457595ab
0
dk 158 Jul 14, 2003 at 22:05

Does it work? The FPS calculation itself seems correct. However, I would not calculate it inside the WM_PAINT event. I would put it inside the Render() function/method.

065f0635a4c94d685583c20132a4559d
0
Ed_Mack 101 Jul 13, 2003 at 22:26
6ad5f8c742f1e8ec61000e2b0900fc76
0
davepermen 101 Jul 13, 2003 at 21:49

you can fake it by creating an (arbitary sized) vertexbuffer, and then just write all the glVertex calls to it (and the others, of course, too..).. and when ever it get filled, just draw it on screen.. and start at the front again..

works rather well.. seen some classes doing it floating around in the web..

F8373d605afbee29635b253538a03788
0
Force_Of_Will 101 Jul 13, 2003 at 19:59

(I glanced at the GL_ATI_fragment_shader and.. YUCK!!)
why do you say that the ati_fragment_shader sucks ?

F7a4a748ecf664f189bb704a660b3573
0
anubis 101 Jul 13, 2003 at 06:02

thx for the link, i’ll certainly read through it

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…

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

Recent Tags

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