Anyone with BMax experience?

BlitzMax Forums/OpenGL Module/Anyone with BMax experience?

DH(Posted 2005) [#1]
"Unable to calculate tex size"



This really puts a dampening on the learning if I cant even load a texture in without an error. The code posted here is from a tutorial over at the blitzmax wiki... Everything else goes ok, just this texfrompixmap command errors out. The texture is a 256x256 png

Hanging out in the opengl programming forum will be a complete waste of time as the previous post is 23 hours old, and down from that, 3 days, 1 week, and so on.... I need an answer asap to continue the learning otherwise I am at a complete standstill....

Please assist!


Braincell(Posted 2005) [#2]
You probably have more chance of help in the BlitzMax programming forum?

I dont know max.


BlitzSupport(Posted 2005) [#3]
GL stuff was changed slightly in 1.12. Changing the second line to this works (runs anyway):

GLGraphics(640,480)



DH(Posted 2005) [#4]
GL stuff was changed slightly in 1.12. Changing the second line to this works (runs anyway):


Changed the line, still doesnt work.....

This is really frustrating, and discouraging....


DH(Posted 2005) [#5]
Thanks for moving my topic into a dead forum......

Been at a stand still for 6 hours now with now way of loading a freakin texture......


Yan(Posted 2005) [#6]
Blimey...Calm down dear! ;o)

I haven't got a clue about all this GL stoof, but, a quick flick through the docs, and...




DH(Posted 2005) [#7]
Did you run it? Did it work for you?

The reason I am so buggered on this is because I can't really sit and learn how to do proper 3D opengl in Blitzmax if I can't even load a texture.. A world without textures is rather boring... And I dont want to move on to more advanced topics since they involve textures as well...

Thanks for the reply, but I am still just as frustrated, and still discouraged over this...

I can run opengl windows just fine. I can get through all the NEHE tutorials that dont require textures.. But this GLTexFromPixmap is just killing me here...


Chris C(Posted 2005) [#8]
YanCanCode's code works just fine here, have you tried it?


DH(Posted 2005) [#9]
*sigh*

Here:



And here's the error:



Here's the texture (256x256 crate.png):

Tried converting it to a bmp, tried taking the image size down to 32x32 in all png, bmp, jpg formats, no difference.

Machine specs: P4 3.0 Ghz HT | 512 MB DDR | Intel 82865G with driver 6.14.10.4299


INTEL(R) EXTREME GRAPHICS 2 REPORT


Report Date: 12/03/2005
Report Time[hr:mm:ss]: 04:14:04
Driver Version: 6.14.10.4299
Operating System: Windows XP* Professional, Service Pack 1 (5.1.2600)
Default Language: English
DirectX* Version: 9.0
Physical Memory: 494 MB
Minimum Graphics Memory: 0 MB
Maximum Graphics Memory: 96 MB
Graphics Memory in Use: 6 MB
Processor: x86
Processor Speed: 2992 MHZ
Vendor ID: 8086
Device ID: 2572
Device Revision: 02


* Accelerator Information *

Accelerator in Use: Intel(R) 82865G Graphics Controller
Video BIOS: Not Available
Current Graphics Mode: 1280 by 1024 True Color (60 Hz)



* Devices Connected to the Graphics Accelerator *


Active Monitors: 1


* Monitor *

Monitor Name: Plug and Play Monitor
Display Type: Analog
Gamma Value: 2.20
DDC2 Protocol: Supported
Maximum Image Size: Horizontal: 14.9 inches
Vertical: 11.8 inches
Monitor Supported Modes:
640 by 480 (60 Hz)
640 by 480 (67 Hz)
640 by 480 (72 Hz)
640 by 480 (75 Hz)
720 by 400 (70 Hz)
800 by 600 (56 Hz)
800 by 600 (60 Hz)
800 by 600 (72 Hz)
800 by 600 (75 Hz)
832 by 624 (75 Hz)
1024 by 768 (60 Hz)
1024 by 768 (70 Hz)
1024 by 768 (75 Hz)
1152 by 864 (75 Hz)
1152 by 870 (75 Hz)
1280 by 1024 (60 Hz)
1280 by 1024 (60 Hz)
1280 by 1024 (75 Hz)
Display Power Management Support:
Standby Mode: Not Supported
Suspend Mode: Not Supported
Active Off Mode: Supported

* Other names and brands are the property of their respective owners.


Any other info?

I have run games in opengl on this machine many-a-time. Nothing has changed on the machine since then... I can run opengl apps with blitzmax fine, I can see polygons, i can see colors, I can do anything BUT use the GLTexFromPixmap function!


DH(Posted 2005) [#10]
Alright, the following code works:


So the question is why.... Going to figure it out tomorrow, i am dead tired from trial and error tonight.


Yan(Posted 2005) [#11]
Did you run it? Did it work for you?
Your version doesn't, my version does (if I comment out the SetGraphics() command, I get the 'Unable to calculate tex size' error).

That picture isn't showing the code I posted!

Also, isn't BGL_DEPTHBUFFER throwing an error for you?
It does for me.


DH(Posted 2005) [#12]
Your version doesn't, my version does (if I comment out the SetGraphics() command, I get the 'Unable to calculate tex size' error).


I just pasted your code in (the entire thing just to say to myself that I tried it your way), and I get the same error.
That picture isn't showing the code I posted!

Because your code states "'above 3 line can be replaced with : GLGraphics 640,480,0,60, GRAPHICS_BACKBUFFER | GRAPHICS_DEPTHBUFFER
'...aparently :o)", so i figured I would try it that way as well.

Also, isn't BGL_DEPTHBUFFER throwing an error for you?
It does for me.


Oddly enough, it isnt throwing an error. In fact, I can run all the stuff without textures with it (strange). I am running 1.14 and did a fresh synmods before I started this thread.

Seems either your Blitzmax is different than mine, or there is some other issue.

At least the nehe tutorials work (with the minor modifications for the new glgraphics and what not). So I can continue on the lessons. But it still leaves me to wonder if it will work the same at home as well (I am at work currently). This is somewhat disturbing.


Chris C(Posted 2005) [#13]
I'd recommend service pack two for xp!!
and updating you graphics drivers too...


DH(Posted 2005) [#14]
I'd recommend service pack two for xp!!


Sorry, would rather burn in hell. Besides, I can't ask every enduser to have SP2 either. SP1 is one thing, but SP2 is nothing but crap....


and updating you graphics drivers too...


I don't see why my graphics drivers are allowing the way he is doing the NEHE tutorial to work, but not the simple opengl tutorial over at the wiki to work....... Do you?


Floyd(Posted 2005) [#15]
Oddly enough, it isnt throwing an error.

It will if you put Strict at the top of your code.

With Strict you should get a message that BGL_DEPTHBUFFER is not found.
Without Strict a new variable named BGL_DEPTHBUFFER will be created and given a value of 0.


Chris C(Posted 2005) [#16]
Sorry, would rather burn in hell. Besides, I can't ask every enduser to have SP2 either. SP1 is one thing, but SP2 is nothing but crap....

Well if you want to get hacked thats your problem! SP2 is just fine as well as having being out ages, you must be missing a whole bunch of updates lol!
I don't see why my graphics drivers are allowing the way he is doing the NEHE tutorial to work, but not the simple opengl tutorial over at the wiki to work....... Do you?

Yes its where you implementation of opengl comes from.
the nehe examples are fairly out of date now, are there any particular ones your having problems with? I have some of them converted...


Yan(Posted 2005) [#17]
It will if you put Strict at the top of your code.
DOH!...I didn't notice that. I must of just added it out of habit. :o)


DH(Posted 2005) [#18]
Well if you want to get hacked thats your problem! SP2 is just fine as well as having being out ages, you must be missing a whole bunch of updates lol!


lol, tell you what, if you can break into my network, i will gladly update to sp2....

the nehe examples are fairly out of date now, are there any particular ones your having problems with? I have some of them converted...


I have run games in opengl on this machine many-a-time. Nothing has changed on the machine since then... I can run opengl apps with blitzmax fine, I can see polygons, i can see colors, I can do anything BUT use the GLTexFromPixmap function!



It's just that function....

Honestly though, I do appreciate everyones effort to help.


REDi(Posted 2005) [#19]
Just replace
CreateGraphics( 640,480,0,60,GRAPHICS_BACKBUFFER | BGL_DEPTHBUFFER )

With
GLGraphics( 640,480,0,60,GRAPHICS_BACKBUFFER | BGL_DEPTHBUFFER )

Using the code from your original post, works fine here.


Sveinung(Posted 2005) [#20]
You mean

from:
CreateGraphics( 640,480,0,60,GRAPHICS_BACKBUFFER | BGL_DEPTHBUFFER )

To:
GLGraphics( 640,480,0,60,GRAPHICS_BACKBUFFER | GRAPHICS_DEPTHBUFFER )

I hope... :)

Sveinung


REDi(Posted 2005) [#21]
DOH :)


Hotcakes(Posted 2005) [#22]
SP2 is nothing but crap....

DEP is very nice. Security Center and Firewall improvements are less nice, but nice nonetheless.

you must be missing a whole bunch of updates lol!

Updates are still coming out for SP1.


xlsior(Posted 2005) [#23]
I've only seen one computer ever refuse to boot up after upgrading to SP2.

Unfortunately it was my own.


Hotcakes(Posted 2005) [#24]
Mine didn't refuse to boot, but the HTTP: protocol was completely routed. Get it? Routed? Never mind.

Anyways, that was on a 3 year old machine, on brand new installs it works perfectly...


H&K(Posted 2006) [#25]
@ First Post

You are Creating a graphic Object but not selecting it
Change second line to

SetGraphic (CreateGraphics( 640,480,0,60,GRAPHICS_BACKBUFFER | BGL_DEPTHBUFFER ))


ImaginaryHuman(Posted 2006) [#26]
Or just use GLGRaphics() by itself.

Also I seem to remember that the "unable to calculate texture size" error has something to do with the screen not being opened or not being supported by your hardware, more than anything whatsoever actually to do with textures.


H&K(Posted 2006) [#27]
Its An error in GLAdjustTexSize called by GLTexFromPixmap.

I Agree that Saying use GLGraphics is a good answer, but that wouldnt explain what Dark had done wrong, which was that they were createing a graphic object, and not setting it as the one to use


N(Posted 2006) [#28]
Four months old.


H&K(Posted 2006) [#29]
Its not just an answer for Dark thou is it?
Its also for the next time someone has this error,(which happened to me Yestrday).
So it doesnt matter How old the thread is. Its still there to be searched.


N(Posted 2006) [#30]
Its not just an answer for Dark thou is it?

@ First Post


I rest my case.


H&K(Posted 2006) [#31]
@ dark or @ first post. Hmmmm, wonder if they might mean differnt things ;)


N(Posted 2006) [#32]
"@ dark or @ first post. Hmmmm, wonder if they might mean differnt things"

Nope, since Dark Half made the first post.


H&K(Posted 2006) [#33]
ParicleEmmiter ptr or FirstParticle ptr,
Hmmmm, wonder if they might mean differnt things


N(Posted 2006) [#34]
That is the worst rebuttal I've seen in.. two days.


H&K(Posted 2006) [#35]
LOL. Ok maybe
But I did honsetly mean my post to be for anyone else who was getting the error and not just dark.
It is an easy thing to do, (well I have done it at least twice). And the error message never points to where you havent rememberd to select the graphics object you have created;(

And the error "Unable to calculate tex size", doesnt give much clue to the fact you made the misstake in the first 3 lines of code.

I honestly cut GLAdjustTexSize and GLTexFromPixmap from the source and put it in my program adding loads of console prints all over the place.

It was only after I had given up on trying to call it that I got an error message that led me to realise my mistake.