News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Picture Format

Started by morlok, October 27, 2006, 12:28:28 PM

Previous topic - Next topic

morlok

When I try Load_PICTURE with the 'masm32.bmp' from media dir, it work fine. But when i put my own picture (24 bits) the image don't appears on the screen. Load_Picture return TRUE.
What can be the problem?



thanks

hitchhikr

paste the code you're using & the picture.

morlok

Here are the code (based on your framework)


InitGl      Proc            uses esi edi ebx


invoke glShadeModel, GL_SMOOTH                     ;Enables Smooth Shading

invoke glClearColor, CFLT(0.0),CFLT(0.0),CFLT(0.0), CFLT(1.0) ;Black Background


invoke glClearDepth,  CDBL(1.0) ;Depth Buffer Setup
invoke glEnable, GL_DEPTH_TEST ;Enables Depth Testing
invoke glDepthFunc, GL_LEQUAL              ;The Type Of Depth Test To Do

invoke glHint, GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST   ;Really Nice Perspective Calculations


invoke Load_PICTURE, CSTR("Julieta.JPG"), addr Texture1, -1
.if eax == FALSE
    mov eax, FALSE
    ret
.endif

invoke Init_Textures_Context

invoke  Create_2D_Texture, Texture1._Datas, Texture1._Width, TRUE, GL_RGBA, GL_RGBA
mov Texture1_Id, eax
.if eax == FALSE
   ret
.endif

ret
InitGl endp


and the Draw Part

invoke glClear, GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT or GL_STENCIL_BUFFER_BIT


; Draw scene here
invoke glPushMatrix
invoke glTranslatef, CFLT(0.0), CFLT(0.0), CFLT(-4.0)
invoke glRotatef, RotX, CFLT(0.0), CFLT(1.0), CFLT(0.0)
invoke glRotatef, RotY, CFLT(1.0), CFLT(0.0), CFLT(0.0)
invoke glRotatef, RotZ, CFLT(0.0), CFLT(0.0), CFLT(1.0)

                                                      invoke glEnable, GL_TEXTURE_2D
invoke glBindTexture, GL_TEXTURE_2D, Texture1_Id
invoke glTexParameteri, GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR
invoke glTexParameteri, GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR

invoke glBegin, GL_QUADS
invoke glColor3f, CFLT(1.0), CFLT(1.0), CFLT(1.0)
invoke glTexCoord2f, CFLT(0.0), CFLT(0.0)
invoke glVertex3f, CFLT(-1.0), CFLT(-1.0), CFLT(1.0)
invoke glTexCoord2f, CFLT(1.0), CFLT(0.0)
invoke glVertex3f, CFLT(1.0), CFLT(-1.0), CFLT(1.0)
invoke glTexCoord2f, CFLT(1.0), CFLT(1.0)
invoke glVertex3f, CFLT(1.0), CFLT(1.0), CFLT(1.0)
invoke glTexCoord2f, CFLT(0.0), CFLT(1.0)
invoke glVertex3f, CFLT(-1.0),  CFLT(1.0), CFLT(1.0)

invoke glTexCoord2f, CFLT(1.0), CFLT(0.0)
                                    invoke glVertex3f, CFLT(-1.0), CFLT(-1.0), CFLT(-1.0)
invoke glTexCoord2f, CFLT(1.0), CFLT(1.0)
invoke glVertex3f, CFLT(-1.0),  CFLT(1.0), CFLT(-1.0)
invoke glTexCoord2f, CFLT(0.0), CFLT(1.0)
invoke glVertex3f, CFLT(1.0),  CFLT(1.0), CFLT(-1.0)
invoke glTexCoord2f, CFLT(0.0), CFLT(0.0)
invoke glVertex3f, CFLT(1.0), CFLT(-1.0), CFLT(-1.0)

invoke glColor3f, CFLT(0.5), CFLT(0.5), CFLT(0.5)
invoke glTexCoord2f, CFLT(0.0), CFLT(1.0)
invoke glVertex3f, CFLT(-1.0),  CFLT(1.0), CFLT(-1.0)
invoke glTexCoord2f, CFLT(0.0), CFLT(0.0)
invoke glVertex3f, CFLT(-1.0),  CFLT(1.0), CFLT(1.0)
invoke glTexCoord2f, CFLT(1.0), CFLT(0.0)
invoke glVertex3f, CFLT(1.0),  CFLT(1.0), CFLT(1.0)
invoke glTexCoord2f, CFLT(1.0), CFLT(1.0)
invoke glVertex3f, CFLT(1.0),  CFLT(1.0), CFLT(-1.0)

invoke glTexCoord2f, CFLT(1.0), CFLT(1.0)
invoke glVertex3f, CFLT(-1.0), CFLT(-1.0), CFLT(-1.0f)
invoke glTexCoord2f, CFLT(0.0), CFLT(1.0)
invoke glVertex3f, CFLT(1.0), CFLT(-1.0), CFLT(-1.0f)
invoke glTexCoord2f, CFLT(0.0), CFLT(0.0)
invoke glVertex3f, CFLT(1.0), CFLT(-1.0), CFLT(1.0f)
invoke glTexCoord2f, CFLT(1.0), CFLT(0.0)
invoke glVertex3f, CFLT(-1.0), CFLT(-1.0), CFLT(1.0f)

invoke glColor3f, CFLT(0.7), CFLT(0.7), CFLT(0.7)
invoke glTexCoord2f, CFLT(1.0), CFLT(0.0)
invoke glVertex3f, CFLT(1.0), CFLT(-1.0), CFLT(-1.0)
invoke glTexCoord2f, CFLT(1.0), CFLT(1.0)
invoke glVertex3f, CFLT(1.0), CFLT(1.0), CFLT(-1.0)
invoke glTexCoord2f, CFLT(0.0), CFLT(1.0)
invoke glVertex3f, CFLT(1.0), CFLT(1.0), CFLT(1.0)
invoke glTexCoord2f, CFLT(0.0), CFLT(0.0)
invoke glVertex3f, CFLT(1.0), CFLT(-1.0), CFLT(1.0)

invoke glTexCoord2f, CFLT(0.0), CFLT(0.0)
invoke glVertex3f, CFLT(-1.0), CFLT(-1.0), CFLT(-1.0)
invoke glTexCoord2f, CFLT(1.0), CFLT(0.0)
invoke glVertex3f, CFLT(-1.0), CFLT(-1.0), CFLT(1.0)
invoke glTexCoord2f, CFLT(1.0), CFLT(1.0)
invoke glVertex3f, CFLT(-1.0), CFLT(1.0), CFLT(1.0)
invoke glTexCoord2f, CFLT(0.0), CFLT(1.0)
invoke glVertex3f, CFLT(-1.0), CFLT(1.0), CFLT(-1.0)
invoke glEnd

            invoke glDisable, GL_TEXTURE_2D
invoke glPopMatrix
ret





Another thing, if i rename the attached jpg, and put it the name 'masm32.jpg', and place it into framework dir 'Media', then the program 'Display_JPG.exe' don't work.

thanks for your answer. and your FrameWork of couse.


regards







[attachment deleted by admin]

hitchhikr

Textures' sizes need to be power of 2 (eg. 1024x1024, 512x512 etc).

morlok

Ok, works fine.

Thanks

regards