News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Can't get a rendering context, wglCreateContext fails

Started by hamper, November 11, 2013, 10:30:52 PM

Previous topic - Next topic

dedndave


Gunther

You have to know the facts before you can distort them.

jj2007

#152
Quote from: dedndave on November 17, 2013, 07:16:43 AM
question - does Franck's (hitchhikr) example work under win7-64 ?

\Masm32\Examples\exampl04\opengl

Works fine under my XP, but again, much too fast. Once you add ...

NoMsg:         ; No pending messages: draw the scene
         invoke Sleep, 1
         invoke   DrawScene

... it's a really beautiful demo. Strange that Franck's demo uses the same unorthodox message handling as the OP's code ::)

I wonder why it's by default slow in Win-7. Either they added a Sleep(1) in later OpenGL, or the OS handles the message loop differently.

I attach a minimalistic (plain Masm32) example showing how fast non-messages are handled:
  .While 1
invoke PeekMessage, ADDR msg, 0, 0, 0, PM_NOREMOVE
.if eax
invoke GetMessage, ADDR msg, NULL, 0, 0
.Break .if !eax
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
.else
inc ct
test ct, 65536*16-1
.if Zero?
movzx eax, word ptr ct+2
print str$(eax), " " ; XP: ca. 1s/line
.endif
.endif
  .Endw

Under my XP, about one line per second fills the screen. If the OS hypothesis holds, it should be very, very slow on Win-7.

P.S.: Just tested on Win7-64 - it's as fast as on XP, so the OS has not changed behaviour. Unless Win7-32 is different, of course.

Gunther

Jochen,

under Windows 7 it fills the screen. Windows XP nothing happens.

Gunther
You have to know the facts before you can distort them.

jj2007

Quote from: Gunther on November 17, 2013, 08:49:41 PMWindows XP nothing happens.

Gunther,

Now that is really strange. This is just a naked GUI, plain Masm32, no MasmBasic whatsoever... and it just prints a number (occasionally) when PeekMessage returns zero.

What happens if you increase the granularity, e.g. test ct, 256-1?

Gunther

Jochen,

could you please post the command line options for assembling with ml.exe (version 6.14.8444 installed) and linking with link.exe (5.12.8078 installed).

Gunther
You have to know the facts before you can distort them.

jj2007

Gunther,
Just open the asm file in qEditor and use Console build all.

dedndave

i would venture a guess that it's OpenGL
after version 1.x, it underwent a lot of changes
by the time they get to windows 7, they are at version 4.x
that means a lot + a lot + a lot of changes - lol

personally, i can't see writing code that will not run under XP
there are still way too many XP users out there
so - you can take the multiple version approach - or use OpenGL 1.2 code   :P
it may be that some things that work under 1.2 do not work under 4.x
that's what i am trying to figure out

it's also possible that running code that was intended for 1.x runs slow under 4.x
because updated code would not use the same approach
i.e., if i wrote the code with version 3/4 style techniques, it may run faster

one of the nicer tutorials i saw mentioned OpenGL version 3.3 or better
something really big must have happened at that level

i think, if i want to use OpenGL and get good performance, i have to use at least a 2-version approach

Gunther

Jochen,

Quote from: jj2007 on November 17, 2013, 10:01:59 PM
Just open the asm file in qEditor and use Console build all.

that doesn't work.


Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

Assembling: C:\masm32\Work\MsgLoopTest.asm

***********
ASCII build
***********

Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

LINK : fatal error LNK1181: cannot open input file "C:\masm32\Work\MsgLoopTest.o
bj"
_
Link error


Please post the command lines.

Gunther
You have to know the facts before you can distort them.

GoneFishing

This thread is already #5 in Top 10 Topics (by Replies)
#3 and #4 both have 161 replies
So the bronze medal is guarantied in next few hours  ;)

Gunther

Hi vertograd,

that's true, but not the question. I would like to assemble and link Jochens version successfully and that doesn't work. So, any help is welcome.

Gunther
You have to know the facts before you can distort them.

GoneFishing

Quote from: Gunther on November 17, 2013, 10:45:44 PM
...
Please post the command lines.

Hi Gunther,
QEDITOR likes to have the asm file being assembled on the same drive ( even better in one of MASM32 subdirectories)

EDIT: Hmm, sorry, I'd have read your post better . It's on the same drive and in MASM32 subfolder ...
:redface:       
Just tried to compile it with Console Build All here  -  all worked well

dedndave

try this Gunther
ml /c /coff MsgLoopTest.asm
link /SUBSYSTEM:WINDOWS /OPT:NOREF MsgLoopTest.obj


if it can't open the OBJ - there is a good reason
maybe it didn't get assembled

EDIT: oops - should be /SUBSYSTEM:CONSOLE

jj2007

Quote from: Gunther on November 17, 2013, 10:45:44 PM

that doesn't work.

Please post the command lines.

Very strange....

@echo off
\Masm32\bin\ml.exe /c /coff MsgLoopTest.asm
\Masm32\bin\link.exe /SubSystem:Console MsgLoopTest.obj
dir MsgLoopTest.*
MsgLoopTest.exe
pause


P.S.: Just saw that Dave posted an (almost) identical set of commandlines. This must work without any environment variables set but, as vertograd rightly wrote, \Masm32\bin must be on the same drive as the asm file.

Gunther

Dave and Jochen,

thank you for the command line. Assembling and linking was successful. I've changed:


test        ct, 256-1


in line 41 of Jochen's code and it fills the screen with numbers very fast under both environments. Should I post the changed code?

Gunther
You have to know the facts before you can distort them.