Qbasicnews.com
April 12, 2021, 07:04:47 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: 1 [2]
  Print  
Author Topic: translating win32API C tutorial to fB ::New question::  (Read 7842 times)
Glu
New Member

Posts: 5


« Reply #15 on: March 17, 2005, 05:29:17 PM »

dumbledore

Okay, thanks for the tip.


I took a quick look at those win bi's( there's several thouisand lines of code), but I don't see any reference to :

 hRC = wglCreateContext  (hDC)
            wglMakeCurrent (hDC, hRC)

In fact, I did'nt see any reference to a Rencering Context (hRC) either.


PIXELFORMATDESCRIPTOR is in there as a MYTYPE and it's memebers can be defined thru that with pfd ....end with.... mechanism.  But, I did'nt see an implementation of sizeof in the examples.


I see references to GLYPHS and to GLYPHMETRICS but, as to the font buffer GLYPHMETRICSFLOAT, I did'nt see that either.

2d and 3d font could be created easily with that:       wglUseFontOutlines
                wglUseFontBitmaps

and more......But, I did'nt see them either.

I'm sure I missed some. Just took a quick peek in there and there's several thousand lines of code.

It's not a big deal to set up OpenGL thru the Win32 Api. In fact, most of what is needed to do it is allready there. Just a few "key" functions seem to be missing.

But, like I said......It was a quick peek in there after all.


Glu
Logged
adosorken
*/-\*
*****
Posts: 3655



WWW
« Reply #16 on: March 17, 2005, 08:41:28 PM »

wglCreateContext doesn't even exist in the C headers...I found some info about it on the MSDN but frankly, I have no clue where the hell it's defined. Could be a macro for all we know...where's the 3D genuises when you need them?
Logged

I'd knock on wood, but my desk is particle board.
red_Marvin
Na_th_an
*****
Posts: 1509



WWW
« Reply #17 on: March 18, 2005, 12:37:23 PM »

I tested and edited the declaration of dialogboxparam()
in user32.bi to function instead of sub, and all worked well
and it returned the correct value. Who should I notify of
this?
Logged

/post]
red_Marvin
Na_th_an
*****
Posts: 1509



WWW
« Reply #18 on: March 18, 2005, 05:55:13 PM »

Double post because of new question.
If I find a win32API function (in this case createdialog) that is not
declared in the correct bi file (in this case usert32.bi) is it enough
that I add the declaration after looking it up on msdn or something,
=Is all functions there in the library files and they are just not declared?
Logged

/post]
Sisophon2001
Member
*
Posts: 58



WWW
« Reply #19 on: March 19, 2005, 03:54:28 AM »

Hi:

You will need to check with some reference to see what versions of windows the function is supported in, and what are its parameters, and check to see if all the parameter types used by the function are declared correctly, and usable in FreeBASIC.

If you do not have a good reference, then download the Programmers Software Development Kit (PSDK) from Microsoft.

Have fun

Garvan
Logged
Sisophon2001
Member
*
Posts: 58



WWW
« Reply #20 on: March 19, 2005, 11:13:04 AM »

Quote from: "Glu"
Hi
<snip>

With that said, I can't seem to make the FB compiler understand the following wgl statements from msdn:

hRC = wglCreateContext hDC

wglMakeCurrent hDC, hRC

wglMakeCurrent NULL, NULL

wglDeleteContext hRC

The compiler does'nt seem to understand them and it says "variables not declared " when it encounters them.


I need to create a Rendering context with the Device context and then make them current.

Also, on exit , I need to null them both as well as delete the Rendering context.


I'm trying to see a way of setting updirectly OpenGL thru the Win32 API.  But, the above  and maybe just a couple of other things are getting in the way.

<snip>
Glu


Hi:

I translated one of NeHe’s OpenGL tutorials (Lesson29) to FreeBASIC. It does OpenGL through the Win32 API so it answers your questions above. I found a bug in the DEVMODE definition, and I needed to add 4 new function definitions. I will post the details in a separate thread where they will be more noticeable.

Other than this, all was plain sailing.

The glaux library is not distributed with FreeBASIC, but as far as I know, this is not much used except for loading bitmaps. I am sure you could find it on the internet if you need it, or just use raw format files like lesson29. I will see if I can make a replacement function for loading bitmaps. Or perhaps there are already some available?

I put NeHe’s Lesson29 on my website in case you want to have a look at it. You will find it on this page.

http://www.freewebs.com/weekendcode/windows.htm


Have fun

Garvan
Logged
lillo
Guru
**
Posts: 269


WWW
« Reply #21 on: March 19, 2005, 11:34:50 AM »

Nice work, but I don't understand why you're using the win32 API... Apart from being a good coding exercise, it makes the code not portable.
SDL or the built-in gfxlib (whose OpenGL driver was based on the NeHe basecode btw) are a better choice IMHO... See the FB examples/gfx/fbgfx_opengl.bas example, it's NeHe lesson 4 ported to gfxlib; as you can see it can't be made easier to set up an OpenGL mode.
Logged

ngelo Mottola - EC++
Sisophon2001
Member
*
Posts: 58



WWW
« Reply #22 on: March 19, 2005, 12:41:51 PM »

Quote from: "lillo"
Nice work, but I don't understand why you're using the win32 API... Apart from being a good coding exercise, it makes the code not portable.
SDL or the built-in gfxlib (whose OpenGL driver was based on the NeHe basecode btw) are a better choice IMHO... See the FB examples/gfx/fbgfx_opengl.bas example, it's NeHe lesson 4 ported to gfxlib; as you can see it can't be made easier to set up an OpenGL mode.


Hi:

In this case it was a programming exercise.
 
I like the gfxlib because it works on my computer without having to set anything up, but I need to learn more about it. So far I have just compiled the samples, and read the help file.

SDL is not so interesting to me because I don’t like the need to distribute and set up dlls with small utilities.

I honestly don’t know much about the other graphic technologies. A little DirectX, and that is it. I have a lot to learn.

Garvan
Logged
Glu
New Member

Posts: 5


« Reply #23 on: March 21, 2005, 11:00:31 PM »

Garvan




Quote
I translated one of NeHe’s OpenGL tutorials (Lesson29) to FreeBASIC. It does OpenGL through the Win32 API so it answers your questions above. I found a bug in the DEVMODE definition, and I needed to add 4 new function definitions. I will post the details in a separate thread where they will be more noticeable.




Okay, good work!..

I need to take a look at the code.  I just quickly executed the EXE.  On exit and in fullscreen mode it does´nt seem to re-establish the previous screen resolution.  I'm not sure if that is a bug in devmode or in the change display serttings function.


Like I said, I need to take a look at the code when I get a chance.


Again, Good work and Good going.


Glu
Logged
Sisophon2001
Member
*
Posts: 58



WWW
« Reply #24 on: March 22, 2005, 02:28:15 AM »

Hi:

I retested and it works correctly here using WinXP Home on a Toshiba laptop. Did you recompile the exe? We might have different versions of FreeBASIC.

The code uses two different methods to change display settings, if the first fails, it tries the second, so I could easily have missed a bug during testing. Or perhaps both methods fail on your machine? Have you tried using the F1 key to toggle full screen and windowed mode? As a check you could download a version compiled in C from NeHe’s site and test that exe.

Any help would be appreciated.

Thanks

Garvan
Logged
Glu
New Member

Posts: 5


« Reply #25 on: March 23, 2005, 02:31:18 AM »

Hi again


Okay. I retested your new version on another machine and it seems to return the previous resolution when exiting  in fullscreen mode.


However, when pressing the F1 key, when in fullscreen mode, instead of changing back to windowed mode, will end up cutting the app. But, when in windowed mode, it will change to fullscreen mode.

Just a minor detail, really.


The gfx full screen option produces an illegal error on this machine.  Go figure.


Thnx and again, good work.






Glu
Logged
thegrogen
Ancient QBer
****
Posts: 444



« Reply #26 on: March 26, 2005, 05:32:05 PM »

This is kind of late, but okay...

About the CreateWindow thing...

The original Win32 API used CreateWindow to create windows, and it was actually a real function. It took a WNDCLASS for a parameter instead of a WNDCLASSEX. So, CreateWindowEx takes a WNDCLASSEX. Any Win32 thing (or DX function, or any MS function for that matter) with an EX on the end of it is an updated version of the original. (WNDCLASSEX has one more structure element than WNDCLASS, and CreateWindowEx has one more parameter).
Logged

.14159265358979323846264338327950288419716939937510582709445
Glarplesnarkleflibbertygibbertygarbethparkentalelelangathaffendoinkadonkeydingdonkaspamahedron.
Pages: 1 [2]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!